Hi all,
I’m running Hass.io on a Linux server and using a lot of MQTT door/window sensors based on the ESP32 chip from Espressif. The ESP library supports the over-the-air (OTA) firmware update, which I want to manage with HA.
I imagine it this way:
- HA: Manual upload of binary firmware file and meta information (type, version, …)
- HA: On upload event publish a “Firmware Update” MQTT message containing the meta information
- SENSOR: On next wake-up (open/close event) the “Firmware Update” message is received and evaluated. If it is a valid firmware, a “Firmware Get” MQTT message is send to the broker containing the sensor IP address/DNS name (needed by OTA process).
- HA: On receipt of a “Firmware Get” message the OTA process is started.
Because I’m quite new to HA it would be great to get some hints or ideas how to realize this with HA.
Here are my thoughts:
Step 1
At the moment I use the “Configurator” component to upload the binary firmware file. Regarding the meta information (type, version a.s.o) I plan to use a text file, where every line represents one firmware meta information record in JSON: { "fw_type": "DoorSensor", "fw_version_major": 0, "fw_version_minor": 2, ... }
Step 2
To realize the upload event and getting the JSON data the “File Sensor” component could be used?!
Then an automation could retrieve the JSON data from the “File Sensor” and publish the “Firmware Update” message via a “Shell Command” service.
Step 4
The “Firmware Get” message could be retrieved by a “MQTT Sensor” component which triggers an automation to start the OTA process via a further “Shell Command” service.
Hopefully my description is not too complicated!
Any help is appreciated.
Greetings,
endym