External led status in HA

Hello everyone,

I have some issue I would like to address.

I have a switchboard with 6 switches and 6 LEDs.

It controls my HVAC zones and was not designed to be smart.

While I know how to press buttons I have no idea how to read status of LEDs on it and create status icon in HA.

My home setup is Zigbee and WiFi based. Main server sits on dedicated thin client. I am not afraid of soldering but prefer something already soldered. Ideally if this could do button press and reads LED status on one board- any ideas? Arduino? RPI?

Anyone wishing to help would need to know what this is exactly…

ESP32 (or ESP8266 at a push) and ESPHome. If your switchboard uses mains electricity please ensure you know what you’re doing.

Smells like XY problem…
What are you trying to achieve, exactly?

In point :slight_smile:

ok - this one I want to use for 2 integrations:

  1. controlling my Mitsubishi Heavy Indystries (MHI) HVAC
  2. controlling my 3 state fishtank lamp

First is a bigger project - our HVAC installators have installed me a wall remote RC-EXZ3A what cannot control 5 (initially) or 6 (after upgrade) zones (it can control 4). Instead of upgrading the remote to RC-EXZ3D (integrated control for up to 8 zones) they added a small switchboard on the side of remote. While RC-EXZ3A can be connected to cloud via not the best but still Intesis Home WiFi Dongle, I truely believe that zone operations still will be not there (as the MHI remote does not know anything about having zones). I am waiting for their response about upgrading system to one-in-place remote, but assuming they replying for a few days already probably they will claim it is not possible and I will finish with cloud controll without zones. Here is comming ESP32 or ESP32 x8 relay board where I can virtually press buttons but also would like to know what zones are on already as someone locally might turn on/off something or controller sometimes is not in mood and you need to press a few times). ESP32/ESP32 ralay board have some IN lines that I can read status of lit LED lights from zone switchboard and can export it to custom made Climate Control panel in HA.

Will try to attach photos later.

2nd - Fishtank lamp has 4 states - off / blue leds only / white leds only / full on (what gives proper light for fish - similar to daylight). You can change state by touch switch on top of the lamp. ATM I have a power supply on timer plugged into wall but the problem is that lamp always start from random state. here I would like to connect 2 sensord - one to white led one to blue led and make proper time controlled light for fish (with some times off, some blue night light and some full light).

I am pretty sure it runs on low voltage - it is connected to the zones controller I believe with RJ45 cable, what allows me to assume this is not high voltage.Will try to measure some values on Friday evening

Cool.
Do you have access to the electronics, or are you looking for an optical solution?

If you have access to the electronics, I think optocouplers are the way to go, but I have currently no experience with it.

While you are right with XY problem, I am happy to hear better solutions than I have prepared.

ok - so I have done some research during the weekend.

Project 1:
here is how this looks like:


I did research on the board and it looks like 5V appears on red circled pin when switch is pressed and nothing when it is not.
Same with LED - 2V appears on one leg when it lit and nothing when it is not.

My assumption is to use ESP32 with logic 3v3 to 5v converter. Thinking about solder that 5v outs to all switches “red circled” - this should enable me to virtually pressing buttons on the controller via HomeAssistant. Alternatively I can use 6 port 3V3 relay board to short red circled pin to one on oposite side, but prefer to avoid this as relay board is quite big and may disturb aesthetic. Also consumes more power and do not like that clicking noise when it operates so trying to avoid that. Another thing is to check that controller picked that “button press” and here is green circle that should confirm with 2V on it what ESP32 should be able to read on IN pin, also defined in HA as binary sensor.

Project 2:
TBH I didnt expected such a sophisticated controller in such a simple thing as Fish Tank Led panel.


When I touch the circle in the middle it change its status doing from off to blue then white then white and blue and off again. The brain of this device is

what is serial shift register with documentation here:

I believe that the easiest way to make it smart is to connect registers to ESP32 inputs (via 5V to 3V3 bi-dir converter) and read status of the lamp. Then connect A or B pin to ESP32 out (also using voltage converter) - this should allows me to virtually “tap” on switch and changes lamp modes. ESP will know status of the lamp via active 74HC outs so can “tap” to the desired state.

Also - particular reads can be a binary sensors in HA and vierual switch can be accessible via button.

What are your thoughts?

Ok - for project 2 - made further investigation and see that not all pins are connected. This is what actually have any pads soldered:
image

1 and 2 are bridged and this is our ESP32 OUT. pins 3 and 4 are our LED panels status (one for blue and one for white - need to figure out what is what). Those are our ESP32 INs

Thinking about adding some nano ESP32 board or even replace this IC with ESP32.

You can use an opto coupler.
They are very small and make no noise.

Probably cheaper than a 3-5 volt level shifter too.

have checked the prices - 8-channel bi-dir level shifter - AU$4, 1ch optocoupler - AU$1.5
level shifter is also small.
While price is one thing and size is another - is there any pros of using opto couplers rather than shifter?

There are four chanel opto couplers, which seems to be what you need to read the LEDs.
You can use an opto coupler also to feed the button presses.

I’m not sure which is better to be honest.
An opto coupler is what I would choose since it isolates the two circuits from each other.
An opto coupler shines a LED internally to signal the other circuit, that seems safer in my opinion than having them wired together.

Edit; see now that you need six opto couplers to read all LEDs.

ok - with voltage shifter I need to use one wire to LV pin that went to HV pin and that goes to the switch pin. How to connect that opto coupler?

Essentially the same as a relay.
You have one side with anode and cathode (since it’s actually a LED inside).
And the other side has two connections, one for the source voltage and the other to what you want to control.

OK - have ordered some PC817 in good price ($5 for 50 pce with shipment). Now - is it possible to plug 3v3 on one side (from ESP32) and have output at level 5V ?

So pin 1 is from the ESP32 any digital output pin.
You might need a current limiting resistor in between.

Then pin 2 is ground.

Pin 3 is where you feed it 5 volt, and pin 4 is where you get a 5 volt signal when the ESP sends 3.3 volt on pin 1 so on the button on the PCB.

When you want to read the LED you connect it as following.
From the PCB LED to pin 1 (no resistor, I’m assuming the PCB already has this).

Pin 2, ground.
Pin 3, 3.3 volt
Pin 4, ESP digital input.

If you don’t want to mess around with soldering individual optocouplers, you can buy ready made PC817 boards which don’t take up to much space.

They come in 1, 2, 4 or 8x optocouplers per board and are quite cheap. Got the 8x on for less than €2 and I’m happy with it.

https://a.aliexpress.com/_Ejzv1JN

I would say they take up significant much more space than just the opto coupler.
But sure it’s a good solution if you don’t know how to solder

I thought about it but they are far more expensive and usually I need some werid amounts of I/O (like 6/6 or 2/1). And because it is hobby/DIY I can use that single channel ones.

what value of the resistor ? 100k ohm?