Calculations with dzVents
Posted: Monday 08 July 2019 18:29
Hi All,
I need some help with a relative simple dventz script.
I have 2 sensors;
IDX347, which is the current percentage charge of the battery of my Renault ZOE,
IDX353, which has the current range
IDX518, in this dummy sensor I would like do calculate the predicted max range of my car. Should be calculated by (Range/%charge)*100).
I tried to do it the following way;
This doesn't seem to work (ok, I still have to figure out to put in the result in IDX516, but by printing it in the LOG I at least should know that I'm on the right track. However, I get an error;
Can somebody help me?
Thanks,
David
I need some help with a relative simple dventz script.
I have 2 sensors;
IDX347, which is the current percentage charge of the battery of my Renault ZOE,
IDX353, which has the current range
IDX518, in this dummy sensor I would like do calculate the predicted max range of my car. Should be calculated by (Range/%charge)*100).
I tried to do it the following way;
Code: Select all
return {
on = { timer = { "every 2 minutes" }}, -- Change to your liking to 1,2,3,4,5,6,10,12,15 or 20
execute = function(dz, item)
local Predicted_MaxRange = dz.devices(516)
local rangeZOE = dz.devices(353)
local accuZOE = dz.devices(347)
local Predicted_Maxrange = ((rangeZOE / accuZOE) * 100 )
domoticz.log('----predicted maxrange------------------')
domoticz.log(Predicted_Maxrange)
domoticz.log('----------------------')
end
}
Code: Select all
2019-07-08 18:08:00.461 Status: dzVents: Info: ------ Start internal script: Predicted_max_range_ZOE:, trigger: every 2 minutes
2019-07-08 18:08:00.468 Status: dzVents: Error (2.4.22): An error occured when calling event handler Predicted_max_range_ZOE
2019-07-08 18:08:00.468 Status: dzVents: Error (2.4.22): ...ts/dzVents/generated_scripts/Predicted_max_range_ZOE.lua:19: attempt to perform arithmetic on local 'rangeZOE' (a table value)
2019-07-08 18:08:00.468 Status: dzVents: Info: ------ Finished Predicted_max_range_ZOE
Thanks,
David