Tasmota Plug Binding [3.2.0;4.0.0)

tasmota

As of OH 4.1.0 M4, this binding is now included in the official openhab-addons repository.

I made this very simple binding to easily connect Tasmota flashed smart plugs to openHAB without having to setup mqtt or utilize complicated http binding item configurations. Plugs with up to 4 relay channels are supported

The plug must report the status of the relay via the url http://$PLUG_IP/cm?cmnd=Power in order for the binding to work.

Supported Things

There is exactly one supported thing type, which represents any supported Tasmota smart plug.
It has the plug id.
Multiple Things can be added if more than one plug is to be controlled.

Discovery

Discovery is not supported. All things must be added manually.

Thing Configuration

At minimum, the host name must be specified.
The refresh interval and number of channels can be overridden from the default.

Parameter Description
hostName The host name or IP address of the plug. Mandatory.
refresh Overrides the refresh interval of the plug status. Optional, the default is 30 seconds.
numChannels Number of channels on the Tasmota Plug (1-4) default 1

Channels

The number of channels depends of on the numChannels configuration parameter.
Channels above the number specified are automatically removed.
Therefore numChannels cannot be changed upward after thing creation.
If the number of channels must be increased, delete the thing and re-create it with the correct number.

Channel ID Item Type Description
power Switch Turns the smart plug relay #1 ON or OFF
power2 Switch Turns the smart plug relay #2 ON or OFF
power3 Switch Turns the smart plug relay #3 ON or OFF
power4 Switch Turns the smart plug relay #4 ON or OFF

Full Example

tasmotaplug.things:

tasmotaplug:plug:plug1 "Plug 1" [ hostName="192.168.10.1", refresh=30 ]
tasmotaplug:plug:plug2 "Plug 2" [ hostName="myplug2", refresh=30 ]

tasmotaplug.items:

Switch Plug1 "Plug 1 Power" { channel="tasmotaplug:plug:plug1:power" }

Switch Plug2a "4ch Power 1" { channel="tasmotaplug:plug:plug2:power" }
Switch Plug2b "4ch Power 2" { channel="tasmotaplug:plug:plug2:power2" }
Switch Plug2c "4ch Power 3" { channel="tasmotaplug:plug:plug2:power3" }
Switch Plug2d "4ch Power 4" { channel="tasmotaplug:plug:plug2:power4" }

tasmotaplug.sitemap:

sitemap tasmotaplug label="My Tasmota Plugs" {
    Frame label="Plugs" {
        Switch item=Plug1

        Switch item=Plug2a
        Switch item=Plug2b
        Switch item=Plug2c
        Switch item=Plug2d
    }
}

Changelog

Version 1.0

Initial Add-on Marketplace release

Version 1.1

Add support for 2-4 channel plugs

Resources

https://github.com/mlobstein/openhab-addons/releases/download/v1.1.0/org.openhab.binding.tasmotaplug-4.1.0-SNAPSHOT.jar

Source Code: https://github.com/mlobstein/openhab-addons/tree/tasmotaplug/bundles/org.openhab.binding.tasmotaplug

Pull Request: [tasmotaplug] Initial contribution by mlobstein · Pull Request #15857 · openhab/openhab-addons · GitHub

2 Likes