NOTA: Não experimentei isto porque não tenho SonOffs com Tamota mas consta que funciona bem. Caso experimentem publiquem as vossas experiências.
Fonte: https://gist.github.com/tikkerei/70722e842874f7174e9e5ba5b901e1f7
Aceder à interface do SonOff e adicionar o seguinte URL no menu “Firmware Upgrade”:
http://sonoff.maddox.co.uk/tasmota/sonoff.bin
(presumo que possa ser qualquer endereço onde tenham sempre a ultima versão)
No Home Assistant, adicionar o seguinte aos scripts:
script:
check_sonoffs_version:
sequence:
- service: mqtt.publish
data_template:
topic: "cmnd/sonoffs/status"
payload: 2
update_sonoffs:
sequence:
- service: mqtt.publish
data_template:
topic: "cmnd/sonoffs/upgrade"
payload: 1
E nos sensores:
sensor:
- platform: rest
name: Sonoff latest release
resource: https://api.github.com/repos/arendst/Sonoff-Tasmota/releases/latest
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: Sonoff 01 Version
state_topic: "stat/sonoff01/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
- platform: mqtt
name: Sonoff 02 Version
state_topic: "stat/sonoff02/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
- platform: mqtt
name: Sonoff 03 Version
state_topic: "stat/sonoff03/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
- platform: mqtt
name: Sonoff 04 Version
state_topic: "stat/sonoff04/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
- platform: mqtt
name: Sonoff 05 Version
state_topic: "stat/sonoff05/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
- platform: mqtt
name: Sonoff 06 Version
state_topic: "stat/sonoff06/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
- platform: mqtt
name: Sonoff 07 Version
state_topic: "stat/sonoff07/STATUS2"
value_template: "{{ value_json['StatusFWR'].Version }}"
Cada equipamento Sonoff/Tasmota que quiserem actualizar deverá ter um sensor. Como é óbvio, se copiarem e colarem o que está acima sem editarem os nome e os state_topic não irá funcionar.