How to remote control a light

Tags: #<Tag:0x00007f3f186d25a0> #<Tag:0x00007f3f186d2230>

Hello everybody.

I have configured all switch from my remote on HA. I have add too my yeelight light but i don’t know to simply control my light with my remote. I don’t found documentation or topic here for this basic task soo thanks for your help.

You dont mention what type of remote control. Lets assume it is a lirc Infra-red:

automation:
- id: poutre_toggle
  alias: 'Poutre Toggle'
  trigger:
    platform: event
    event_type: ir_command_received
    event_data:
      button_name: A1 # make sure this is your button name
  action:
    service: light.toggle
    entity_id: light.poutre # make sure this is the entity_id of your light

Tanks for your attention.

switch come from rfxtrx remote like :

switch:
  platform: rfxtrx
  automatic_add: true
  devices:
    0b11000001313efeXXXXXfXX:
      name: t1a1

Ok, try this:

automation:
- id: poutre_toggle
  alias: 'Poutre Toggle'
  trigger:
    platform: event
    event_type: button_pressed
    event_data: {"entity_id": "switch.t1a1"}
  action:
    service: light.toggle
    entity_id: light.poutre # make sure this is the entity_id of your light

You will also have to change your switch config to:

switch:
  platform: rfxtrx
  automatic_add: true
  devices:
    0b11000001313efeXXXXXfXX:
      name: t1a1
      fire_event: true  #  <------ add this

after 2 days of adventures, i’ve progress on my home assistant code understanding.
My light turn on correctly when i manually activate my automation but my remote controlleur has one button for on and one button for off. she is correctly add to hasio like rfxtrx switch because hasio update correctly this switch on his panel but my automation triggr don’t work.

See my automation code

#on automation
- id: '1566199046443'
  alias: 'poutreOn'
  trigger:
    - platform: event
      event_type: button_pressed
      event_data: {"entity_id": "switch.t1a1"}
  action:
    service: light.turn_on
    entity_id: light.poutre

for your comprehension this is my remote
chacon-dio-ch54761-telecommande-16-canaux-433mhz-dio-eq-myfox-ta3008

What is the entity id of this switch?
Also what is the entity id of the switch you want to use to turn off the light?

That does not show the entity ids of the switches.

Open up your lovelace card and copy the relevant on and off button entities. e.g:

Paste them here. Don’t screen shot them.

You still have not said which is the button that you want to use to turn off the light.

i want turn off and turn off my light at the end but for the moment, the switch trigger don’t work for anything. Just turn on fort first step will make me happy

Try this then:

- id: '1566199046443'
  alias: 'poutreOn'
  trigger:
    platform: state
    entity_id: switch.t1a1
    to: 'on'
  action:
    service: light.turn_on
    entity_id: light.poutre

ha ha ha ! it’s alive !!!
light go to on :slight_smile:

thanks, first step managed

my automation for on off (probably coded like a bear but work)

- id: '1566199046443'
  alias: 'poutreOn'
  trigger:
    platform: state
    entity_id: switch.t1a1
    to: 'on'
  action:
    service: light.turn_on
    entity_id: light.poutre
    data:
      brightness: 255 #light power
      kelvin: 4400 #light color
    
- id: '1566199046444'
  alias: 'poutreOff'
  trigger:
    platform: state
    entity_id: switch.t1a1
    to: 'off'
  action:
    service: light.turn_off
    entity_id: light.poutre
1 Like