Use a button as a switch based on power output

Hi!
I’ve got a broadlink which can turn on/off my air conditioning in the bedroom using the send-command service.

entity_id: remote.universal_remote_remote
device: airco
command: toggle_power
num_repeats: 1
delay_secs: 0.75
hold_secs: 1.5

However, this doesn’t log the on/off status of the air conditioning. For example, if I (or my partner) use the original remote I want to know if it’s on or off in my dashboard based on the power usage, measured by the plug it’s in.

Here’s the catch: Ideally, I would like to have a button on my dashboard that allows me to send the command mentioned above, but the on/off state of that button is measured by the power usage (sensor.power_airco) of the plug (>100w).

Could anyone point me in the right direction to do this, because I’m very stuck.

You can do this with a template switch.

switch:
  - platform: template
    switches:
      pico_remote:
        value_template: >
          {% if states.sensor.power_airco.state|int > 100 %}
            on
          {% else %}
            off            
          {% endif %}
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.air_con
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.air_con

Please change the entity_ids

I suggest you take a look at this. It does what you want very well.

That did the trick. It didn’t have my remote, but when googling my remote I kept finding an alternative that would work with this AC-unit as well. This one did happen to be in SmartIR so I’m a happy camper.

Thanks!

No worries.

You don’t actually need an existing remote code in SmartIR for your device. You can simply learn the remote codes into HA. That’s what I had to do for 3 different devices that I use SmartIR with

I’m aware, but there are a lot of commands to program, and this one just happened to be pre-programmed so it saves some time! :slight_smile: