2.2 KiB
2.2 KiB
ESP-NOW open/close sensor
ESP-NOW based open/close sensor ESP8266 RTOS SDK. Alternate firmware for Tuya/SmartLife/eWeLink WiFi sensors.
There are two branches - for ESP8266 family and for ESP32 family. Please use the appropriate one.
Features
- Automatically adds sensor configuration to Home Assistan via MQTT discovery as a binary_sensor.
- Update firmware from HTTPS server via ESP-NOW.
Notes
- For initial settings use "menuconfig -> ZH ESP-NOW Open Sensor Configuration". After first boot all settings will be stored in NVS memory for prevente change during OTA firmware update.
- To update the sensor firmware, press the button for > 5 seconds and send the "update" command to the root topic of the sensor (example - "homeassistant/espnow_sensor/70-03-9F-44-BE-F7"). The update paths should be like as "https://your_server/zh_espnow_open_sensor_esp8266.app1.bin + https://your_server/zh_espnow_open_sensor_esp8266.app2.bin". The time and success of the update depends on the load on WiFi channel 1. Average update time is less than one minute. The online status of the update is displayed in the root sensor topic.
Build and flash
Run the following command to firmware build and flash module:
cd your_projects_folder
bash <(curl -Ls http://git.zh.com.ru/alexey.zholtikov/zh_espnow_open_sensor/raw/branch/esp8266/install.sh)
cd zh_espnow_open_sensor
make menuconfig
make
make flash
Tested on
See here.
Attention
- A gateway is required. For details see zh_gateway.
- Highly recommended connect an external power supply during firmware update.
- Because this sensor is battery operated, it has an additional controller (MCU) that controls the power of the WiFi module (Module) and transmits data to it for transmission to the network. The communication is done via UART at 9600 speed. Make sure that the protocol is correct before flashing. Details here.
- Use the "make ota" command instead of "make" to prepare 2 bin files for OTA update.