Hi I have a Hue light bulb with a brightness and a color temperature channel
Control with the OH android app works fine.
When I control it with a switch (via Rule) I have to press the button (Xiaomi hardware switch) a few times to get it to work.
Rule:
//Bedroom switch
rule "bedlamp on/off"
when
Channel "mihome:86sw2:158d0001641c68:ch1" triggered
then
if (E2Lbedlamp_dimmer.getStateAs(OnOffType) == OFF) {E2Lbedlamp_dimmer.sendCommand(100)}
if (E2Lbedlamp_dimmer.getStateAs(OnOffType) == ON) {E2Lbedlamp_dimmer.sendCommand(0)}
end
the event.log shows:
mihome:86sw2:158d0001641c68:ch1 triggered SHORT_PRESSED
2019-02-15 23:46:27.564 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 100
2019-02-15 23:46:27.568 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 100
2019-02-15 23:46:27.573 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 0 to 100
2019-02-15 23:46:27.580 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 0
2019-02-15 23:46:27.583 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 0
2019-02-15 23:46:27.584 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 100 to 0
2019-02-15 23:46:29.619 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d0001641c68:ch1 triggered SHORT_PRESSED
2019-02-15 23:46:29.630 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 100
2019-02-15 23:46:29.631 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 100
2019-02-15 23:46:29.635 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 0 to 100
2019-02-15 23:46:32.692 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d0001641c68:ch1 triggered SHORT_PRESSED
2019-02-15 23:46:32.708 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 0
2019-02-15 23:46:32.710 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 0
2019-02-15 23:46:32.713 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 100 to 0
2019-02-15 23:46:34.304 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d0001641c68:ch1 triggered SHORT_PRESSED
2019-02-15 23:46:34.312 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 100
2019-02-15 23:46:34.323 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 100
2019-02-15 23:46:34.328 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 0 to 100
2019-02-15 23:46:34.331 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 0
2019-02-15 23:46:34.333 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 0
2019-02-15 23:46:34.334 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 100 to 0
2019-02-15 23:46:36.143 [vent.ChannelTriggeredEvent] - mihome:86sw2:158d0001641c68:ch1 triggered SHORT_PRESSED
2019-02-15 23:46:36.153 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 100
2019-02-15 23:46:36.154 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 100
2019-02-15 23:46:36.155 [vent.ItemStateChangedEvent] - E2Lbedlamp_dimmer changed from 0 to 100
2019-02-15 23:46:36.165 [ome.event.ItemCommandEvent] - Item 'E2Lbedlamp_dimmer' received command 0
2019-02-15 23:46:36.167 [nt.ItemStatePredictedEvent] - E2Lbedlamp_dimmer predicted to become 0
Can’t find where goes wrong.
If I send on/off instead of 0 or 100% I get the same result.
Update:
I added , autoupdate=“false” to my Item. Sill have to press the button multiple times