Broadlink RM + scripts/automation

Hi all,

I’m trying to control my AC with a Broadlink RM. Switches are set up, they are working from the HA main screen: if I press the lightning icon, the AC turns on, all is well. I can even control my AC via emulated_hue with a GoogleHome. HA is 0.48.1.

However, if I try to set up an automation or a script, they are not working (config is accepted). If I trigger the corresponding automation event on the HA console nothing happens, no error in the logs (“Executing autom”… is there). What can be wrong?

Switch config (I’ve all the entities needed set up, but wanted to save space :slight_smile: ):

switch:
  • platform: broadlink
    host: 192.168.1.243
    mac: ‘34:EA:34:E3:AB:9F’
    timeout: 15
    frienly_name: “RM3 mini”
    switches:
    ac_samsung_24_airfilter_quiet:
    friendly_name: “Samsung AC 24C with AirFilter in Quiet”
    command_on: ‘JgDyABoAAj5iAAEkEg8SMBEPERARDxEQEQ8SDxIOEi8TDhIOEw4SDhMOEi8SMBEwETARMBIPEg4SDxIOEg8SDhIPEg4SDxIOEg8SDxEPEg8PEhEPERASDhIPEg4TDhIOEw4SDhMOEi8SDxIOEg8SDxEPEg8RMBIvEi8SLxJgZAABIxIvEg4SDxIOEg8SDxEQEQ8SDxEwEQ8SDxIOEi8TLhMuEw4SLxIvEi8SMBAxERARMBIvEg4SDxIOEi8SLxMuEw4SMBEPEg8RDxEQEQ8SDxIvEi8SDxIOEg8SLxIOEg8SDxEQEQ8REBEPETASLxIvEi8TAA0FAAAAAAAA’
    command_off: ‘JgBoARoAAkJjAAEjEg8SLxIPERAQEA8SEBAREBIOEi8SDxIOEi8SLxMOEi8SMBEwDzIRMBIPEg4SDxIOEg8SDhIPEg4SDxIOEg8SDxEQEQ8SDxAQERASDhIPEg4TDhIOEw4SDhMOEg8SDhIPEg8REBEPERARDxEQEDESLxJgYwABIxIvEg8SDhMOEg8SDhIPEg8RDxIvERAREBAxEg4SLxIvEi8SLxIvEjAREBEPEg8RDxAREQ8REBIOEw4SDxIOEg8SDhIPEg4SDxIOEhARDxEQEQ8REBAQERASDhIPEg4SDxIOEw4SDhMOEg8SDhIPEg8RYGMAASMTLxEQERASDhIPEg4SDxIOEg8SLxIOEg8SLxIPEg8RDxIvETASLxMuEy4TLxIOEi8SLxIPEg8REBEwETARMBIOEg8SDhMOEg4TDhIPEg4SLxIvEhARDxEQEi8RDxIPEg4SDxIOEg8SDhIPEg4TLhMvEQANBQ==’

Scripts:

  good_night:
    alias: "Good Night"
    sequence:
      - event: LOGBOOK_ENTRY
        event_data:
          name: Ejszaka
          message: mod bekapcs
      - alias: AC ON (AirFilter + Quiet)
        service: switch.turn_on
        data:
          entity_id: switch.ac_samsung_24_airfilter_quiet
      - delay:
          seconds: 1
      - alias: Display OFF
        service: switch.turn_off
        entity_id: switch.ac_samsung_display

Automation:

- alias: 'Autom: AC a haloban este'
  trigger:
    - platform: time
      at: '20:30'
  action:
   - service: switch.turn_on
     entity_id: switch.ac_samsung_24_airfilter_quiet
- alias: 'Autom: AC disp. off'
  trigger:
    - platform: time
      at: '22:30'
  action:
   - service: switch.turn_off
     entity_id: switch.ac_samsung_display

- alias: 'Autom: AC off'
  trigger:
    - platform: time
      at: '7:30'
  action:
   - service: switch.turn_off
     entity_id: switch.ac_samsung_24_airfilter_quiet

I have a very similar setup but am using homeassistant.turn_on instead of switch.turn_on as service calls. You can also use the developer tool to check if you can actually call switch.turn_on on switch.ac_samsung_24_airfilter_quiet directly. it cloud also be the entity_id being derived from something other than the switch name.

Another way to do this is for the automation to call send_pack directly, though the ir codes will be somewhat redundant:

    service: broadlink.send_packet_192_168_1_243
    data:
      packet:
      - "JgDyAB..."
1 Like

Check the entity id of the AC buttons with http://localhost:8123/dev-state

switches:
ac_samsung_24_airfilter_quiet:
friendly_name: “Samsung AC 24C with AirFilter in Quiet”

With your configuration, the entity id is not ‘switch.ac_samsung_24_airfilter_quiet’.
It may be ‘switch.samsung_ac_24c_with_airfilter_in_quiet’
I think that it is a bug but the Broadlink switch takes the entity id from the friendly_name.

Also I recommand that you use the trigger time with second like the below
trigger:
- platform: time
at: ‘22:30:00’

Thank you, that did the trick. You were right, the entity_id is ‘switch.samsung_ac_24c_with_airfilter_in_quiet’ not what man would think.

http://:8123/dev-state was also a good idea, I’ve never seen it anywhere in the docs, but it’s great. I’ve fixed the .yaml files all is good now!