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!