I want to calculate how much volume of water there is in my rainwater tank.
For this I use a HC-sr04 ultrasonic sensor and this is controlled and read out by a python script that is running on my Raspberry pi. This python script is working with the EXEC binding output in openhab.
Now I try to calculate the volume of water with a rule:
//
rule "watervolume "
when
exec_command31bc7a83_output.state as Number changed
then
logWarn(“Controle”, “De regel ‘berekenen volume’ is zonet uitgevoerd.”)
WaterVolume.postUpdate(LiterPerCm.state as Number * (Maximumdistance.state as Number - exec_command31bc7a83_output.state as Number))
end
//
the 2 variables; LiterPerCm and Maximumdistance are defined as number-item and adjustable on my habpanel.
I can read out my exec output in a habpanel dummy but when I use the exec output in my rule, it looks like the rule doesn’t understand the exec output because it’s a string and not a number-item.