I have a switch with the following configuration
switch:
platform: rfxtrx
automatic_add: True
devices:
0b110000015b026601010f80:
name: remote1Button1
fire_event: True
then i have the following automation
automation:
- alias: Use remote to enable scene
trigger:
platform: state
entity_id: switch.remote1Button1
to: 'on'
action:
service: scene.turn_on
entity_id: scene.LivingroomAllOn
- alias: Use remote to disable scene
trigger:
platform: state
entity_id: switch.remote1Button1
to: 'off'
action:
service: scene.turn_on
entity_id: scene.LivingroomAllOff
now this works great if the remote is in the right state, ie if the remote switch is in mode On i can turn Off and if the remote is in mode Off i can turn on… but i cant turn off if the remote is set as Off… isn’t that what fire_event
is for?
I have tried to use the following but it didn’t work:
trigger:
platform: event
event_type: button_pressed
event_data: {"state": "on", "entity_id": "switch.remote1Button1"}
So what am i missing?
Does any one have a idea how to configure this correctly?
Edit: i have verified the configuration both with the built in cli function, the Web GUI function and YMAL Lint all said it was valid.
I enabled logging and got the following when i press the button
17-03-08 17:43:37 DEBUG (Thread-3) [homeassistant.components.rfxtrx] Device_id: 15b02662 device_update. Command: Off
17-03-08 17:43:37 INFO (MainThread) [homeassistant.core] Bus:Handling <Event button_pressed[L]: entity_id=switch.remote1button1, state=off>
17-03-08 17:43:37 INFO (Thread-3) [homeassistant.components.rfxtrx] Rfxtrx fired event: (event_type: button_pressed, entity_id: switch.remote1button1, state: off)
If i read it correctly it says that device remote1button1
sent the event type button_pressed
is home assistant case sensetive? and if yes why on earth is it lowercase when i defined it as remote1Button1
?
Why on earth does that not fire the following:
- alias: Use remote to disable scene
trigger:
platform: event
event_type: button_pressed
event_data:
state: off
entity_id: switch.remote1Button1
action:
service: scene.turn_on
entity_id: scene.LivingroomAllOff
Also tried the following no success:
- alias: Use remote to disable scene
trigger:
platform: event
event_type: button_pressed
event_data: {"state": "off", "entity_id": "switch.remote1Button1"}
action:
service: scene.turn_on
entity_id: scene.LivingroomAllOff
So what am i missing?
Im using Python 3.6.0 and home assistant 0.39.3
It seems it was a case related issue, i posted a bug report https://github.com/home-assistant/home-assistant/issues/6495