How to set state of switch/dimmer through REST API?
From python bash I send request:
data123 = {'DimmedZal4': str(intens)}
requests.put('http://192.168.1.3:8080/basicui/CMD', data123)
In .rule:
rule "RULE_Dimmer_DimmedZal41"
when
Item DimmedZal4 received update
then
logInfo("Exec4", 'DimmedZal4 received update: ' + DimmedZal4.state.toString)
end
rule "RULE_Dimmer_DimmedZal42"
when
Item DimmedZal4 received command
then
logInfo("Exec4", 'DimmedZal4 received command: ' + DimmedZal4.state.toString)
end
rule "RULE_Dimmer_DimmedZal43"
when
Item DimmedZal4 changed
then
logInfo("Exec4", 'DimmedZal4 changed: ' + DimmedZal4.state.toString)
end
In OH2 log:
2017-02-27 16:13:32.108 [INFO ] [eclipse.smarthome.model.script.Exec4] - DimmedZal4 received command: 100
2017-02-27 16:13:32.115 [INFO ] [eclipse.smarthome.model.script.Exec4] - DimmedZal4 received update: 100
2017-02-27 16:13:32.154 [INFO ] [eclipse.smarthome.model.script.Exec4] - DimmedZal4 changed: 100
How just to update state of switch/dimmer without event “received command”?
If my lamp is ON, then python must send notification to OH about change state of Item.
But if I change state of Item from OH, then OH.rule must send command to lamp.