0
Under review

Finding X lowest values

Rait Lotamõis 4 years ago in bOS Configurator / Tasks updated 4 years ago 5

I'm trying to put together a Task to run a pool circulation pump only on the hours when the electricity cost is the lowest. I can get the prices from nordpoolspot.com API. I end up with 24 Doubles, one for each hour of the day. But I have not managed to figure out a way to filter out the lowest values.


For instance I need to run the pump for 6 hours every day. So at every hour I need a way to check "Is this current hour one of the 6 cheapest hours for today?"


Any ideas?

I still have not managed to find a way to achieve this, however I'm using a temporary "good enough" solution. I'm calculating the average of the days power cost and then checking to see if current hours cost is below average. If it is, it counts as one of the "safe" hours.


The only problem is, when I need to run the pump for longer than there are hours with below average costs in a given day. For that case I'm currently just logging an error message saying "The pump was asked to run for X hours, but it only ran for Y hours yesterday." To give me a heads up should this happen.

Under review

Hello,


do those "cheaper hours" start every day at the same time? When do you receive your prices from your API?


Regards.

The prices get fetched at 00:00 every day and that is when I reset the "Hours ran today" variable for the circulation pump. So it's all a clean slate.

Hello,


since this is a more advance technical question and will require additional work, please create a ticked in our Comfortclick ticketing system.


To open a ticket:


  1. Login to your account on our web page http://www.comfortclick.com/ (or create an account if you don't have one).
  2. Click on your User name (upper right corner) and select Support Tickets from the drop down menu.
  3. Create a New Ticket

We'll get back to you in the shortest possible time.


Regards


That's ok. The reason for this question was to see if something like that is currently possible. It's not important enough for me to have you guys do custom work on it. I just enjoy pushing the boundaries of new systems and see what I can get away with :)