Page 1 of 1

Get and sort lowest values from IDX (control waterheater)

Posted: Wednesday 24 August 2022 14:58
by blaxx
Hi!

I'm planning on controlling my water heater depending on current electrical price.

I have a plugin that adds the hourly rates every night. They are stored in a device (IDX) for every hour (24 in total).
My thought was that heater should be active the six lowest hours every 24 hour.
I'm thinking that this should be doable with dzVents but I dont' know where to start.

I want the script to check all these 24 IDX every day, pick out the six lowest values and when these hours are, then activate a switch.

I'm not completely new to scripting but I've never written any dzVent/Lua scripts before.

Is there anyone that could point me in the right direction or give me an example where to start?

Image

Re: Get and sort lowest values from IDX (control waterheater)

Posted: Wednesday 24 August 2022 16:41
by waltervl
Read the DzVents section History persistant variables
https://www.domoticz.com/wiki/DzVents:_ ... les_API.29

Re: Get and sort lowest values from IDX (control waterheater)

Posted: Friday 26 August 2022 17:31
by hoeby
I don't get it how you know when the lowest hours are, to switch on. It is based on history data.

When the 6 hours are the cheapest yesterday, are they today also the cheapest?

Just some thoughed, how do you know that those hours are also the cheapest today?