Virtual Devices (On/Off-state by power consumption/commands via MQTT)

Hi, have the following setup:
I have a Tasmota IR blaster, a Yamaha AV receiver a LG plasma TV, energy metering plugs for the yamaha and LG. The commands are send to Tasmota IR with MQTT payloads.

I have found the discrete IR commands for the Yamaha and LG for turning them off and on. But since no state is published I cant rely on a MQTT state topic for on/off state.

Best I want to use a media player device for the yamaha (the tv could be an mqtt switch). I want to set the on/off state based on the power consumption of both the TV and the receiver.
I want to be able to switch different inputs etc with IR commands.

How do I do that best?

Right now I have just configured buttons in lovelace for control.

So your Yamaha is not compatible with the available integrations?

Likewise for the LG tv?

both are “dumb” non networked devices

Okay then.

You can create binary template sensors to report the state:

template:
  - binary_sensor:
      - name: "LG TV Power State"
        icon: "mdi:television-classic"
        state: "{{ states('sensor.your_tv_power_sensor_here')|float(0) > 10 }}"
      - name: "Yamaha Power State"
        icon: "mdi:audio-video"
        state: "{{ states('sensor.your_amp_power_sensor_here')|float(0) > 10 }}"

Adjust the power (10W in the examples) to be greater than your TV’s and amp’s standby power draws.

thanks tom, I’ll try that, I was trying to get something similar with an mqtt switch, but till it didnt work.

image

I tried the following (the binary works like a charm btw :wink: Whats the best way to debug stuff like that?

or maybe publishing myself an state topic with a ha automation

image