Manage Tasmota device using MQTT and Python

Robert Diers
Aug 7, 2022

You can use this Python module to

  • switch Tasmota device on/off
  • read status values from Tasmota device
#connect to MQTT broker
Tasmota.connect(mqtt_broker, mqtt_port, mqtt_user, mqtt_password)
#switch on (please use the topic name configured in Tasmota)
Tasmota.on(topic_name)
#switch off (please use the topic name configured in Tasmota)
Tasmota.off(topic_name)
#read status information (flattened json result)
Tasmota.get(topic_name, "8", ["StatusSNS_SI7021_Temperature"])
Tasmota.get(topic_name, "8", ["StatusSNS_ENERGY_Power", "StatusSNS_ENERGY_Today"])

--

--