added a firmware check and sensor configuration

DavidFW1960 2019-03-20 13:39:12 +11:00
parent 236ccf33a1
commit 469510052d
1 changed files with 57 additions and 1 deletions

@ -126,4 +126,60 @@ This can also be done manually in Home Assistant UI through Developer tools - ![
data: data:
topic: "sonoffs/cmnd/SetOption19" topic: "sonoffs/cmnd/SetOption19"
payload: "1" payload: "1"
``` ```
### 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.