Make "Switch" for Broadlink RM Pro

I’m using a Broadlink RM Pro to toggle the power on an air purifier that is plugged into an energy monitoring plug. I’d like to make a switch in HA that looks at the energy usage to determine if it is on or off before it sends a command. Right now it just toggles when I call this script:

toggle_power_exercise_room_air_puifier:
  sequence:
    - service: remote.send_command
      target:
        device_id: b361d3ebc7b36837a14648de246db3cc
      data:
        device: exercise_room_air_purifier
        command: power
        hold_secs: 2.2

I’m guessing templating is involved and was hoping I could get some hints from someone who has already done this.

Isn’t this just a matter of adding a condition to your existing automation? Or if you want a switch, perhaps an input_boolean that toggles with the power level recorded by the plug.

  1. Make an input.select helper with two stands: Purifier ON / Purifier OFF

  2. Make an automation which toggles the state of the input select triggered by the power usage of the purifier

  3. Make an automation, which sends remote commands triggered by whatever, with the right state of the input select as a condition

Thanks for the help. I used the Threshold Helper so I was able to eliminate step 2. Works great.

1 Like