🧯 Script Blueprint that generates 3 EZ buttons to Manage your Tasmota Cluster

This Script Blueprint generates 3 Buttons to help you manage your Tasmota installed base. Restart All, Update a few, and Update all.

:bookmark_tabs: Changelog

  • 2022-05-05: Updated for 2022.5.0 HA. Added shortcut and.
    • Add alternate MQTT topic format
  • 2022-02-07: Add Retain flag to fix HA start-up bug.
  • 2022-02-04: Add Automation suggestion to fix HA start-up bug.
  • 2022-01-07: First blueprint version :tada:

:envelope_with_arrow: Get Started

I was looking for a Home Assistant Related project and when chatting to Luma from the HASPOne Project a couple of days ago, he mentioned how he uses an MQTT Trick to Generate entities inside of a Blueprint.
This spawned an idea in my head, and Voilia, we have this Blueprint.

I have had these EZ buttons for quite a while on my system. The idea of the 2 Update Buttons came from Digiblur. Recently for 2021.12.0 the Home Assistant Team came out with buttons. I converted my update scripts to buttons.

After chatting Luma, I put the 2 together, and here we have a Script Blueprint that uses MQTT Discovery to generate 3 buttons for your Tasmota Devices.

1>

Press a button to restart ALL Tasmota Devices (Also to use during 
Home Assistant Restart to get all current State and Sensor readings)  

2>

Press a button to update a couple of Tasmota devices to test that the 
new version will not break something,  
(Think of these units as your canary's in the coal mine.)  

3>

Press a button to update ALL Tasmota devices to the latest version. 

More details and Requirements in the Blueprint Decription and the Input Descriptions.

Option 1: My Home Assistant

Click the badge to import this Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Please Click the :orange_heart: at the end of the Post if you find this Useful

Option 2: Direct Link

Copy this link if you want to import the blueprint in your installation.

https://github.com/SirGoodenough/HA_Blueprints/blob/master/Scripts/Tasmota_EZ-Buttons.yaml

:open_book: Description

First, let’s go over Blueprints and what they are. Blueprints are a way to share scripts (in this case) and is built into Home Assistant. Simple as that. You can import my template code and a copy of it will reside in your configuration. Once there, you can can edit it (if you need changes only) or you can call up that Blueprint to build a script. It will collect the information needed based on your entities and your personal adjustments, and provide a working script. You will have to have or add the required hardware and entities that the Blueprint needs to function.

:gear: Usage

:hammer_and_wrench: Installation

  • Open Home Assistant with administrator privileges and on a Lovelace screen, click anywhere in the main entity area and type the letter ‘c’. A selection box should pop up. Type blue and select the button to navigate to blueprints. You can also find blueprints by selecting configuration from the left menu and then blueprints from the center menu.
  • Once there, click on the ‘Import Blueprint’ button in the lower right side of the main screen.
  • In the ‘URL of the blueprint’ line type or paste in the URL of my Blueprint. I have the blueprint stored on my Public GitHub:

GitHub - SirGoodenough/HA_Blueprints: My Collection of Automation and Script Blueprints for Home Assistant

:dna: To make the blueprint work it will need

  • MQTT Broker happy and running your Tasmota Device connection to Home Assistant.
  • Home Assistant 2021.12.0 or newer because that is where the MQTT Button Entity Debuts.
  • Home Assistant Tasmota Integration installed and talking to all yout Tasmota Devices.
  • The default GroupTopic of ‘Tasmotas’ is available on all your Tasmota Devices.
  • Tasmota Devices firmware default MQTT topic is set to: %prefix%/%topic%/ If you did not change the topic in your Tasmota Devices then leave it as the default here as well. The other option available to you is to flip them as I do in my Home Assistant personally.
  • Your Tasmota devices need to be updated to the same ‘breaking change’ generation as the Released version of Tasmota for this to be able to update. Currently that is v9.1 minumum.

:airplane: Extended Information

This implementation is exactly the implementation in the Home Assistant Docs.
For further information, reference the links below.

 https://www.home-assistant.io/integrations/button/
 https://www.home-assistant.io/docs/automation/using_blueprints/
 https://www.home-assistant.io/integrations/tasmota/
 https://tasmota.github.io/docs/Upgrading/
 https://tasmota.github.io/docs/Commands/#mqtt

To build the script:

Open your Home Assistant instance and show your blueprints.

  1. Click on ‘Create Script’ Open your Home Assistant instance and show your scripts. and ‘Use Blueprint’
  2. Add a Description so you can tell what this one is for
  3. Pick the names you want for your buttons or accept the defaults
  4. The ‘ez_canary_grouptopic’ selection MUST be in lower_case_chase format for this to function correctly. Also you need to install this GroupTopic on a select number of your Tasmota Devices. This allows you to update these first, and you can see if the update is going to work for you before pushing the Update-All Button. What you put here has to exactly match what you put in your devices.
  5. The ‘ez_canary’ name must be changed from the default to enable this button.

:speaking_head: Generating the Buttons

Once the names have been selected and you click the ‘Save Script’ button, you only need to execute the script once, and it builds the buttons.
Look in your Devices list for ‘Tasmota EZ Buttons’.

Open your Home Assistant instance and show your devices.

:bulb: Other Ideas

You can effectively use the Tasmota Reset Button to ‘reload’ all of your Tasmota Devices shortly after you start/restart Home Assistant. This will give Home assistant a current look at all the states and sensors without relying on retain as it starts up.

UPDATE: I have noticed that the buttons become disabled after Home Assistant Restart. Very annoying, but easy to fix. I have added a start-up Automation to Home Assistant to refresh the buttons a little while after the HA system starts. The delay is to ensure things are going well and the system is not too busy when this is run. I have found 22 seconds to be a good number for this on my system, feel free to adjust as needed. I am also pressing the Tasmota Restart button a little while after that to refresh all the Tasmota’s at boot and provide fresh data for HA to update it’s register status. The script name and button name will need to be changed to reflect your choices when you built the blueprint control script.

Example automation:

####################################################
# MQTT Restart Tasmota                             #
####################################################
####    Use this automation to get all your devices in sync, including
####     power state, immediately after Home Assistant is (re)started.
- id: Tasmota_Restart_Sequence-random-oisjg98uwr8ytjw9ut8344
  alias: Power state on HA start-up
  initial_state: on
  trigger:
    - platform: homeassistant
      event: start
  action:
    - delay: 00:00:22
    - alias: Make sure EZ Buttons are active
      service: script.tasmota_ez_button_for_update_and_restart_all_2022_01_07a
    - delay: 00:00:22
    - alias: Push the Tasmota Restart - One Button to Rule them All
      service: button.press
      target:
        entity_id: button.ez_restart_button_tasmota

:globe_with_meridians: All My Blueprints

Link to ALL my Blueprints

Here is a list of each of my blueprints, a quick description and jump links to the Blueprints Exchange post…

:cyclone: Scripts

:fire_extinguisher:Broadlink on Script Blueprint

This is a SCRIPT Blueprint that uses my Broadlink RM3 to turn my TV on and get it into the correct mode, Pushes remote buttons in sequence.

:fire_extinguisher:Tasmota EZ Button Blueprint

This Script Blueprint generates 3 Buttons to help you manage your Tasmota installed base. Restart All, Update a few, and Update all.

:fire_extinguisher:Play Media File Script Blueprint Blueprint

This is a SCRIPT Blueprint. This provides a way to play canned media files with the big long list of YAML entries but keep the main script or automation clean.

:fire_extinguisher:TTS All Message Blueprint

This script can use any of the 11 integrated TTS Platforms in Home Assistant to send a message to a media player.

:arrows_clockwise: Automations

:fire_extinguisher:Auto Fan Control Blueprint

TThis Blueprint is for controlling a 3 speed fan based on a temperature sensor. Both fan% control & MQTT fan control versions.

:fire_extinguisher:Door Open TTS Cloud-Say Message Blueprint

This Blueprint is a TTS.cloud-say version of another Door Announcer I found in the HA Blueprint Exchange.

:fire_extinguisher:Keypad Lock or puzzle Box Tool Blueprint

This Blueprint accepts 5 actions & when done in the right order, flips an input_boolean.

:fire_extinguisher:Zigbee2MQTT - Xiaomi Cube Controller Blueprint

This Blueprint uses a Zigbee2MQTT built sensor to sort out the multitude of commands from the Xiaomi Magic Cube Remote.

:fire_extinguisher:Zigbee2MQTT - ZemiSmart ZM-RM02 Controller Blueprint

This Blueprint uses the Z2M (Zigbee2MQTT) imported Action sensor to sort out the 18 commands from the ZemiSmart ZM-RM02 Controller.

:man_juggling:t5: Contact Links or see my other work

What are we Fixing Today Homepage / Website: https://www.WhatAreWeFixing.Today/

Channel Link URL: (WhatAreWeFixingToday) https://bit.ly/WhatAreWeFixingTodaysYT

What are we Fixing Today Facebook page (Sir GoodEnough): WhatAreWeFixingToday

What are we Fixing Today Twitter Account (Sir GoodEnough): https://bit.ly/WhatAreWeFixingTodayTW

Discord Guild: (Sir_Goodenough#9683) WhatAreWeFixingToday?

:cheese: If you want to support me

Buy me Coffee: Sir GoodEnough

PayPal one-off donation link: PayPal.Me

#WhatAreWeFixingToday

#SirGoodEnough