Skip to content

Instantly share code, notes, and snippets.

@nsotnikov
Last active November 18, 2020 10:30
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nsotnikov/70722e842874f7174e9e5ba5b901e1f7 to your computer and use it in GitHub Desktop.
Save nsotnikov/70722e842874f7174e9e5ba5b901e1f7 to your computer and use it in GitHub Desktop.
Home Assistant - Tasmota
# Just an example how to check and upgrade the sonoff-tasmota from the Home Assistant: configuration.yaml
# One click upgrade all Sonoff-Tasmota devices, check the current installed and latest available version of firmware.
# Twitter link: https://goo.gl/e3y7pa
#
# 1. Open your sonoff webinterface and add in the "Firmware Upgrade" menu following OTA Url, save! Example: https://goo.gl/6ZMjzA
# OTA Url: http://sonoff.maddox.co.uk/tasmota/sonoff.bin
#
# 2. Below the Home Assistant configuration:
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
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 }}"
@forrestjr
Copy link

Works great! I only had to change the state_topic to match my local config and it worked fine. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment