Get on/off status of AV equipment that is "dumb"

Everyone who has tried to automate/script multiple devices on or off via IR knows about the problem that you can’t send ON or OFF, you toggle, and you don’t know what state it is in.
I have read some ideas about remembering the state and that might work if the remotes are not used.
That won’t work here…

So I started looking for other ways and thought about the SCART connection. (Don’t know how common they are outside Europe, but here it has been standard connector since 70’s and most new devices still has one at least).

Anyways, it has two pins that is useful, pin 8 and 14.
Pin 8 gives a voltage depending on the output format (4:3 or 16:9), meaning most of us will have 12 volts across pin 8 to ground pin 14, if the device is off it gives 0-2 volts. (0 in my case)
Problem is that when the device turns on there is a risk of a spike in voltage. On my set top box I got 18 volts, and because of that it spooked me enough to build it optically isolated with and LED and a photo resistor.


Forgot to edit the resistor value by the LED. I think I used a 470 Ohm.
The photo resistor acts as the first resistor in an voltage divider to make sure the output is either high or low.
The resistor value may be different for you depending on the photo resistor and the intensity of the LED (try before solder).


To make sure it does not short circuit anything I removed all the other pins from the connector.


I removed all the other wires from the cable to save space inside the connector.


Parts soldered in place.


Connector soldered on.


Tested on the device to see that it works. (cable is not there that is why there is a hole)


Cut off wires that is not to be used.


Wires soldered on.



Done!

Now connect the cables to ESP chip and use ESPHome to read the status.

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO16
      mode: INPUT_PULLDOWN_16
    name: "Digitalbox"


And there it is! Now I can make automations and scripts that first look at the state before sending the IR code to turn on/off!

3 Likes

Very nice ! Wouldn’t it been a lot easier if you’d put a shelly plug on it and measure power consumption? :slight_smile:

1 Like

Perhaps. But I’m not sure there is that much difference in consumption.
The device is still on when it’s off.
As far as I can see it’s “only” the output that is off.

It still has an IP and even the optical audio is still on when it’s off.
I don’t have a Shelly, but all the parts used here was what I already had.

There will be a huge difference. Power in standby for a TV might be 1w, ideally lower. When its on it could be anywhere from 30w - 600w depending on its size and display technology.

Interesting approach though! Definitely good to use items you already have.

1 Like

Irrelevant to this case since it’s not the TVs status I’m interested in.
If it was the TV then the SCART connector is not a good approach anyways since the TV is the receiving end, not a transmitter.

But even if it was the TV I was interested in, I would still not use a Shelly.

  1. That would add a breaker that can be in the wrong position.
  2. There is no need for it’s main purpose (on/off).
  3. It costs far to much for such a simple task. I know they are not expensive, but given how little it actually costs to read the status of a TV then it’s a lot.

But some people like buying stuff instead of building, nothing wrong with that. But it’s not me.

Most modern TVs have a usb port which can be used similarly. 5v supplied when tv on, 0v when off. Probably no need to cater for a surge.

And if that’s not available, just look for service ports, LEDs on the back, LEDs on the inside, or if all that fails just look at the large LED/LCD/plasma/CRT backlight or bleed light on the inside and “read” that.

A power meeter is overkill in my opinion.

I have “solved” this problem recently by putting a photoresistor near the power LED of the device (usually internally). Then adc via esphome.

That works too.
The only difference is that adc requires analog inputs.
So either just one per 8266 or you need a 32 chip.
But it’s probably simpler to set up.

Just goes to show, there is right way or wrong way to do this kind of thing. Lots of good ideas here :slight_smile:

I wouldn’t say any method is wrong.
The only wrong method posted here would be using SCART on the TV which I have big doubts about.
I have not measured the voltage on the TV but I assume it has nothing since it’s input.

But other ways to solve it has been presented, some may find them more appealing than my method.

Physically easy, but took some playing with esphome filters to get consistent result. My problem was that the LED flashes when the soundbar subwoofer is not yet connected. Voltage is 0.00 when off, about 0.85 when on, and alternates when flashing. So, I used an average to detect flashing. Here’s my esphome section for an ESP32:

sensor:

  • platform: adc
    pin: GPIO36 # ADC0
    name: “VHT510 Photoresistor Voltage”
    update_interval: 3s # the ESP reads a new value every interval (constantly)
    filters:
    • sliding_window_moving_average:
      window_size: 5
      send_every: 3
    • delta: 0.2 # data sent to HASS only when avg changes this much

In my switch.vht510_power:
value_template: “{{ states(‘sensor.vht510_photoresistor_voltage’) | float > 0.2 }}”

Probably way overkill, but I would probably use the fact that it’s flashing to get the third state.
That means you get 0.4 volt when flashing in average? You could publish this value in it’s raw state and have HA decode that 0.4 is flashing, 0 is off and above 0.8 is on.

Nice way to overcome the problem though.

Right, but I just want on or off. Flashing is a form of on, and a distraction to me. Subwoofer will connect shortly anyway. I appreciate your interest and comments.