How To Control Tasmota Power Outlets with Mycodo

Tasmota is an open source firmware that can be flashed to a number of devices to expand their functionality. There are many wireless power strips and outlets that are Tasmota-compatible, and these can be a good option to work with Mycodo for remote power-switching applications.

Check out the Tasmota Supported Devices Repository (specifically Plugs and Sockets) to see which devices can be flashed with the Tasmota firmware.

Once flashed with the Tasmota firmware, your outlets can be controlled with commands from Mycodo by two main methods: Web Requests and MQTT.

Web Requests Method

  1. Connect your device with Tasmota to your WiFi modem/router and find its IP address.

  2. In Mycodo, navigate to the Output page, add an On/Off: Shell Script Output, and configure it using the on and off commands as follows, replacing 192.168.0.32 with your device’s IP address.

On Command: curl http://192.168.0.32/cm?cmnd=Power%20On

Off Command: curl http://192.168.0.32/cm?cmnd=Power%20Off

  1. You should now be able to turn on and off the device from the Mycodo Output.

MQTT Method

  1. Set up an MQTT server (see How to Set Up a Mosquitto MQTT Server).

  2. Connect your device with Tasmota to your WiFi modem/router, find its IP address, and connect to that address in your web browser at https://IP_ADDRESS, replacing IP_ADDRESS with the device IP address. You should be greeted with a screen similar to this:

  1. Navigate to the Configuration page.

  1. From here, navigate to the Configure Other page and enable MQTT.

  1. From the Configure page, navigate to the Configure MQTT page, and configure the MQTT Host, Port, and credentials (if applicable). Also set the Client, Topic, and Full Topic similar to below.

  1. In Mycodo, navigate to the Output page, add an On/Off: MQTT Publish Output, and configure it using your MQTT server Host and Port and the options set in Tasmota. Ensure the Client ID is unique and is not used by any other device. Note: my MQTT server is hosted on the same Raspberry Pi running Mycodo, therefore the MQTT Host is localhost rather than an IP address.

  1. You should now be able to turn on and off the device from the Mycodo Output.