Continuing the discussion from DIY: Raspberry Pi UPS/Automatic safe power ON/OFF:
This was the first part of the project, I would go on the same topic if it is not a problem ...
It's about a small project of a smart home.
For now, the hardware is as follows:
several Sonoff T1 (single and double channels) with Tasmota firmware
Xiaomi Gateway (DGNWG02LM); 1 pcs
- AQARA temperature / humidity / pressure sensor; 2 pcs
AQARA motion sensor; 2 pcs
AQARA door / window sensor; 1 pcs
- AQARA water leak sensor; 2 pcs
The gateway should be enabled for developer mode (through the application on the smartphone, set region to Mainland China).
The problem may be if port 9898 is not open, excellent instructions are on:
In Node-RED I used "A Bridge between the Xiaomi Mi Smart Home Gateway and the Mqtt Broker" .
MQTT Broker is locally installed on Raspberry Pi.
The flow of informations for sensors is:
MQTT -> function -> ui_gauge / ui_text / ui_template
for temp / pressure / humidity informations are:
- temperature value (ui_gauge)
- pressure / humidity (text)
- battery level (text)
- battery icon (ui_template; red = battery level is bellow 2.7V, cyan = battery level is above 2.7V)
Similar is to all other sensors (except that there are no gauge and different icons).
All sensors except temp / pressure / humidity (after the start of the Node-RED, a one-time trigger request list of registered sensors from the gateway) have the following statuses:
- if sensor does not respond => text "Error" in red will be displayed instead of the icon,
- if the sensor responds => text "Online" in yellow will be displayed instead of the icon,
- if the sensor activates manually (push butoon on the sensor) => text "Ready" in green will be displayed instead of the icon.
Further sensors show icons with their status.
Night light is a LED on the gateway, this option can be activated or not through the switch in the desired time interval (schedex / gate).
LED light is triggered by a motion sensor (light ON time is fixed:trigger = 2min).
So much for now, with the image of course.