IR as an entity

I have learned IR codes trought Broadlink and I made some buttons. But now i would like to use these interactions with google home, so i need an entity such as remote control or something similar. I am not very familiar with HA, I have just started and I would need help, someone can help me?

Do you mean you want entities to represent the devices you are switching on and off with Broadlink?

One way of doing this is to create an input_boolean (or “toggle helper”) for each device, then an automation to send the Broadlink turn on command when the input_boolean is changed to on and a similar automation to send the turn off command when it is changed to off.

For example:

- id: '1614420014623'
  alias: Study socket 1 off
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.study_socket_1
    to: 'off'
  condition: []
  action:
  - service: remote.send_command
    data:
      device: study_socket_1
      command: Turn off
    entity_id: remote.broadlink_remote
  mode: single

and:

- id: '1614420014624'
  alias: Study socket 1 on
  description: ''
  trigger:
  - platform: state
    entity_id: input_boolean.study_socket_1
    to: 'on'
  condition: []
  action:
  - service: remote.send_command
    data:
      device: study_socket_1
      command: Turn on
    entity_id: remote.broadlink_remote
  mode: single

The input_booleans can then be exposed to Google home so that they can be turned on and off with voice commands.

Hi @Stiltjack,

Thanks for sharing, as mention by the author the thread.
I am also looking to have a similar setup to show the state of my Wall Fan if its on or off on my HA dashboard.

Currently i am controlling it via Broadlink IR, as the Power On/Off button is the same on my original remote, which i have learned via broadlink IR. How can i create an entity in a way that it will show on or off inside a single button?

Include tap action: toggle in the button definition?

      - type: button
        tap_action:
          action: toggle
        entity: input_boolean.study_socket_1

Alternatively, you can replace the input_boolean with a switch:

  - platform: broadlink
    mac: 24dfa7e87063
    switches:
      - name: counter_lights
        command_off: JgBYAAABJJITEhMTExITEhMSExMTEhM3EzcTNxM3EzcTNxM3EzcTEhM3ExITNxM3EzcTExMSExITExI3ExMTEhMSEzcTNxM3EwAFHQABKEkTAAxaAAEmShMADQUAAAAAAAAAAAAAAAAAAA==
        command_on: JgBQAAABJJITEhMTExITEhMSExMTEhM3EzcTNxM3EzcTNxM3EzcTEhMTEhMTNxM3EzcTEhMSExMTNhQ2ExMTEhMSEzcTNxM3EwAFHgABJ0kTAA0FAAAAAAAA

There’s a bit about creating custom switches in the Broadlink docs: