This Tasmota EZ Button Script Blueprint generates 3 Buttons to help you maintain your Tasmota Cluster / Installed Base. Restart All, Update a few, and Update all.
NOTE: Version **2022-02-04** to fix a problem that restart of Home Assistant disables the buttons.
Blueprint code has NOT changed.
See Other Ideas for your Tasmota EZ Buttons Below…
Get Started on your Tasmota EZ Button
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
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
https://github.com/SirGoodenough/HA_Blueprints/blob/master/Scripts/Tasmota_EZ-Buttons.yaml
Tasmota EZ Button 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.
How the Blueprint works:
To import this Blueprint:
- 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 GIST on GitHub:
-
- https://github.com/SirGoodenough/HA_Blueprints/blob/master/Scripts/Tasmota_EZ-Buttons.yaml
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.
- This assumes you have left your Tasmota Devices MQTT topic set as the default.
%prefix%/%topic%/
If not you will need to edit this in a couple of places in the Blueprint to match your Tasmota topic. - 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.
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:
- Click on ‘Create Script’
- Add a Description so you can tell what this one is for
- Pick the names you want for your buttons or accept the defaults
- 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.
- The ‘ez_canary’ name must be changed from the default to enable this button.
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’.
Other Ideas for your Tasmota EZ Buttons
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
Episode: 071
Documentation and everything you want to know about blueprints:
https://www.home-assistant.io/docs/blueprint/tutorial/
https://www.home-assistant.io/docs/blueprint/
https://www.home-assistant.io/docs/automation/using_blueprints/
Blueprint file on Github:
https://github.com/SirGoodenough/HA_Blueprints/blob/master/Scripts/Tasmota_EZ-Buttons.yaml
All my Blueprints can be found here:
https://github.com/SirGoodenough/HA_Blueprints
My Home Assistant Configuration can be found here:
https://github.com/SirGoodenough/Home-Assistant-Config
MQTT-Explorer Download:
http://mqtt-explorer.com/
00:00 Tasmota EZ Buttons
00:44 Video Overview
02:36 Review Button Entity
03:36 Review MQTT Button Entity
04:18 Review my other Blueprints to Download
07:58 Tasmota_EZ-Buttons.yaml Walk Thru
10:31 Tasmota_EZ-Buttons.md Prerequisites
12:35 Blueprint Import
13:39 Create & Run Script
17:14 Look at Tasmota EZ Buttons Device
18:34 Push Buttons to Lovelace
19:12 MQTT-Explorer
20:15 Test the Restart Button
21:00 Auto-Push button at Home Assistant Restart
22:00 Reload Automations
23:20 Summary
#WhatAreWeFixingToday
#SirGoodEnough
#HomeAssistant
#Tasmota
#Blueprint
Contact Links:
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 (WhatAreWeFixingToday):
https://bit.ly/WhatAreWeFixingTodaybFB
What are we Fixing Today Twitter Account (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodayTW
Discord Account: (Sir_Goodenough#9683)
https://discord.gg/Uhmhu3B
Please help support the channel:
If you would like to donate anything to this channel, please use this address:
C/O: Sirius GoodEnough
322 Buena Vista Ave.
Department: DYT
Waukesha, Wisconsin, 53188-3602
Link to this video on YouTube:
https://youtu.be/C78OYKiI0Mc
video add-ins provided by:
spinny,
Video by Tech VideoStack from Pixabay
chalkboard
Video by imotivation from Pixabay
rocky
Video by mohamed Hassan from Pixabay
SirGoodenough Guy Animations Courtesy 3ATIVE Studios https://www.3ative.com/
Music from YouTube Library: Shawl_Paul by Norma Rockwell Compressor_Works_Twang by Max McFerren The Truth by Anno Domini Beats Blacksmith by Godmode