diff --git a/Home-Assistant.md b/Home-Assistant.md index 91b9841a..51d56942 100644 --- a/Home-Assistant.md +++ b/Home-Assistant.md @@ -126,4 +126,60 @@ This can also be done manually in Home Assistant UI through Developer tools - ![ data: topic: "sonoffs/cmnd/SetOption19" payload: "1" -``` \ No newline at end of file +``` +### Tip: Make all Tasmota devices report their firmware version + +``` +- id: 'sonoff_firmware_installed' + alias: Sonoff Firmware Installed + trigger: + - event: start + platform: homeassistant + action: + - data: + payload: '2' + topic: sonoffs/cmnd/status + service: mqtt.publish + initial_state: 'true' +``` +Then you can make a sensor that detects the latest version of Tasmota and alerts you if there is an update. +From my configuration.yaml +``` +# Tasmota Firmware +# Getting Firmware from JSON for Tasmota + - platform: rest + resource: https://api.github.com/repos/arendst/Sonoff-Tasmota/releases/latest + name: Sonoff Firmware Version Available + username: !secret githubuser + password: !secret githubpass + authentication: basic + value_template: '{{ value_json.tag_name }}' + headers: + Accept: application/vnd.github.v3+json + Content-Type: application/json + User-Agent: Home Assistant REST sensor + - platform: mqtt + name: "Coffee Maker Firmware" + state_topic: "sonoff1/stat/STATUS2" + value_template: 'v{{ value_json.StatusFWR.Version }}' + - platform: mqtt + name: "Garage Door Firmware" + state_topic: "sonoff5/stat/STATUS2" + value_template: 'v{{ value_json.StatusFWR.Version }}' +binary_sensor: + - platform: template + sensors: + sonoff_update_available: + value_template: >- + {{ (states.sensor.sonoff_firmware_version_available.state > states.sensor.coffee_maker_firmware.state) or (states.sensor.sonoff_firmware_version_available.state > states.sensor.garage_door_firmware.state) + }} +``` +Note the above is for 2 switches. + +In customize.yaml +``` +binary_sensor.sonoff_update_available: + friendly_name: Update Available Sonoff + device_class: problem +``` +Then it will show as an alert icon that you can show in Lovelace. \ No newline at end of file