New item:
Create an items file in the items folder: heating.items
Put that in it:
Switch HeatingValveSwitch
Create a rules file in the rules folder: heating.rules
Put that in it: (replace yourItem with the item you used)
rule "Heating Valve changed"
when
Item yourItem changed
then
val valve = Integer::parseInt(yourItem.state)
if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end
Hello, is that right?
I get in the HABPanel as a result “NULL”.
rule "Heating Valve changed"
when
Item ebus:bai:5d51fcb4:08:bai_boiler_state-diverter-valve changed
then
val valve = Integer::parseInt(ebus:bai:5d51fcb4:08:bai_boiler_state-diverter-valve.state)
if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end
I’m using Item Linking = Simple Mode set to on.
It would have to work that way?
rule "Heating Valve changed"
when
Item ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve changed
then
val valve = Integer::parseInt(ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state)
if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end
rule "Heating Valve changed"
when
Item ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve changed
then
val valve = Integer::parseInt(ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state.toString)
if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end
rule "Heating Valve changed"
when
Item ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve changed
then
logInfo("VALVE STATE", ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state.toString)
val valve = Integer::parseInt(ebus_bai_5d51fcb4_08_bai_boiler_state-diverter-valve.state.toString)
if (valve == 0) HeatingValveSwitch.postUpdate(OFF)
if (valve == 100) HeatingValveSwitch.postUpdate(ON)
end