Get and sort lowest values from IDX (control waterheater)

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
blaxx
Posts: 2
Joined: Monday 15 October 2018 14:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Get and sort lowest values from IDX (control waterheater)

Post 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
User avatar
waltervl
Posts: 5729
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

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

Post by waltervl »

Read the DzVents section History persistant variables
https://www.domoticz.com/wiki/DzVents:_ ... les_API.29
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

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

Post 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?
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest