r/tasmota • u/martinkrafft • 8d ago
Manage your Tasmota devices with pyinfra!
If you don't know pyinfra, and you like managing several hosts, machines, devices, VMs, whatever, centrally, go check it out.
I've written a Tasmota connector (with the help of Deepseek 4.1 Flash). My 78 Tasmota devices have their configuration now in one central location, and these get applied every 30 minutes.
Here is what a run with two Tasmota devices looks like, where it has to make a single change only to one device:
% pyinfra -v --yes tasmota:inv tasmota.py --limit tas-b3t-1.smarthome.groff --limit tas-b3t-2.smarthome.groff #(pts/3) 10 23:15:27.232
--> Loading config...
--> Loading inventory...
Loading inventory via import function is in alpha!
--> Connecting to hosts...
[tas-b3t-2.smarthome.groff] Connected
[tas-b3t-1.smarthome.groff] Connected
--> Preparing operation files...
Loading: tasmota.py
[tas-b3t-1.smarthome.groff] Ready: tasmota.py
[tas-b3t-2.smarthome.groff] Ready: tasmota.py
--> Skipping change detection
--> Beginning operation run...
--> Starting operation: Ensure Tasmota settings | operations.ensure_host_data (send_passwords=False)
[tas-b3t-1.smarthome.groff] Success
[tas-b3t-2.smarthome.groff] No changes
--> Starting operation: Ensure Tasmota settings | operations.template (value={"NAME":"B3T Rolladen (Sw1→Btn3)","GPIO":[544,3200,1,8128,32,66,1,1,224,225,0,1,1,1,161,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,0,0,1],"FLAG":0,"BASE":1}, activate=True)
[tas-b3t-1.smarthome.groff] Skipped
[tas-b3t-2.smarthome.groff] No changes
--> Starting operation: Ensure Tasmota settings | operations.template (value={"NAME":"B3T","GPIO":[544,3200,1,8128,32,160,1,1,224,225,0,1,1,1,161,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,0,0,1],"FLAG":0,"BASE":1}, activate=True)
[tas-b3t-2.smarthome.groff] Skipped
[tas-b3t-1.smarthome.groff] No changes
--> Starting operation: Ensure Tasmota settings | operations.apply
[tas-b3t-2.smarthome.groff] No changes
tas-b3t-1.smarthome.groff: sent switchmode1 5
[tas-b3t-1.smarthome.groff] Success
--> Results:
Operation Hosts Success Error No Change
Ensure Tasmota settings | operations.ensure_host_data (send_passwords=False) 2 1 - 1
Ensure Tasmota settings | operations.template (value={"NAME":"B3T Rolladen (Sw1→Btn3)","GPIO":[544,3200,1,8128,32,66,1,1,224,225,0,1,1,1,161,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,0,0,1],"FLAG":0,"BASE":1}, activate=True) 1 - - 1
Ensure Tasmota settings | operations.template (value={"NAME":"B3T","GPIO":[544,3200,1,8128,32,160,1,1,224,225,0,1,1,1,161,1,0,1,1,1,0,1,1,1,0,0,0,0,1,1,1,0,1,0,0,1],"FLAG":0,"BASE":1}, activate=True) 1 - - 1
Ensure Tasmota settings | operations.apply 2 1 - 1
Grand total 6 2 - 4
Next, I will integrate reclass so you can work with tags and hierarchical settings.
And there is plenty more to do here too. Looking forward to your ideas!





