“BLE relay device for Home Assistant that, for the most of time is in a very low energy state and only a few seconds per minute is awake.
The purpose of this project, was to develope a BLE relay device for Home Assistant that, for the most of time, was in a very low energy and emission state and only for few seconds per minute was in awake state.
At the same time I didn’t need that my ON/Off remote commands was executed instantaneously but, for my needs, was enough that every ON/Off command was really executed within a time interval of one minute.
In other words, for my needs (i.e. to start and stop an aged fan coil unit), it’s really unimportant that there is a time delay of at most one minute between the press of the button on the Home Assistant’s dashboard and the effective change of the relay state (that turn off or turn on the fan coil unit).
The project is entirely based on two ESP32 boards, the first acting as a remote BLE server and the second, integrated on the HA platform, acting as BLE client.
At the same time Home Assistant is hosted on a Raspberry Pi 4 Model B.
The remote ESP32 (BLE server) control the relay state by means of an output pin (GPIO 25).
Anyway, since the voltage level of the output pin is high only when the the ESP32 remote server is awake and back to zero volts when the ESP 32 goes in deep sleep state, is needed a way to convert the momentary pulse on GPIO 25 output pin in a permanent signal.
In other words, i.e., if I want that the fan coil is switched on, I need to push the button on the Home assistant dashboard so that a momentary pulse is sent to the output pin during the brief interval in wich the remote ESP32 in awake state and then this pulse is converted in a permanent signal that mantain the relay state ON and the thus the fan coil.
Obviously, to switch the fan coil off, a second pulse will be needed and within the same time interval (about 60 secs) the fan coil will be off.
To do all this, two things are essentially required:
- A BLE connection between the two ESP 32 boards: the first (an HA integration), acting as BLE client and the second, the remote BLE server (directly connected to relay as we said).
- A “momentary switch to toggle switch” logic converter.”