Hi,
I encounter some problem with “rules”. I’m beginner with openhab and especially with the rules.
I read a temperature value from a xiaomi aqara.
Number:Temperature HTP_Temperature { channel=“mihome:sensor_weather_v1:…:…:temperature” }
I would like to transfer the value to the plc (S7-1200)
Number XiaomiGw_TpHum_Z1_Tp “Salon - Temperature [%f]” { simatic=“plc:DB15.DBD0:float:IO” }
This is the rule:
rule “XiaomiGw_TpHum_Z1”
when
Time cron “0/15 * * * * ?”
then
var TeTemperature = HTP_Temperature.state as Number
XiaomiGw_TpHum_Z1_Tp.state = TeTemperature
logInfo("HTP_Temperature: ", HTP_Temperature.toString)
logInfo("XiaomiGw_TpHum_Z1_Tp: ", XiaomiGw_TpHum_Z1_Tp.toString)
end
This is the log info:
2019-07-14 21:24:00.028 [vent.ItemStateChangedEvent] - XiaomiGw_TpHum_Z1_Tp changed from 0.0 to 22.91 °C
2019-07-14 21:24:00.028 [INFO ] [thome.model.script.HTP_Temperature: ] - HTP_Temperature (Type=NumberItem, State=22.91 °C, Label=null, Category=temperature)
2019-07-14 21:24:00.036 [INFO ] [.model.script.XiaomiGw_TpHum_Z1_Tp: ] - XiaomiGw_TpHum_Z1_Tp (Type=NumberItem, State=22.91 °C, Label=Salon - Temperature, Category=temperature)
2019-07-14 21:24:00.466 [vent.ItemStateChangedEvent] - XiaomiGw_TpHum_Z1_Tp changed from 22.91 °C to 0.0
Looks that i copy “state” and not only the value…
Thanks for your help