This part of the script makes it stop when I try to run it for the first time. With 'history true' you can't give an initial value
Code: Select all
local counter = domoticz.data.showerCounter
if counter.getLatest().data == nil then
counter.add(0)
domoticz.log('ShowerCounter op 0 gezet, initial')
end
Luckily I had an other device that I could check the 'latest update' from and use that as a decision whether it was safe to put a '0' value in there. Now the __data file is created, I could use the above code again (but of course it doesn't make sense anymore).