Hi
Today I tried to update from the old the the new Exec-Binding. Unfortunately Items are only working as String and not as Number.
Items:
String PV_Tag “Tagesertrag [%s kWh]” {channel=“exec:command:pv_tag:output”}
String D0_Abgabe_Tag “Tagesabgabe [%s kWh]” {channel=“exec:command:abgabe_tag:output”}
Results (that means exec commands are working):
PV_Tag = 39.9
D0_Abgabe_Tag= 30.6
Now I need to calculate this within a rule:
PV_Tag - D0_Abgabe_Tag
Before it was working with:
var ev = PV_Tag.state as DecimalType - D0_Abgabe_Tag.state as DecimalType
How can I do this with String-Items?
Thanks
Michael
rossko57
(Rossko57)
2
There are some suggestions here
var ev = Double::parseDouble(PV_Tag.state.toString) - Double::parseDouble(D0_Abgabe_Tag.state.toString)
postUpdate(P_EV, ev)
To be honest I don’t know really what’s exactly happening with Double::parseDouble but it’s working now
Thanks
Michael