Sonoff Tasmota OpenHAB Reply MQTT

  • Platform information:
    • Hardware: RaspberryPI 3
    • OS: Openhabian
    • openHAB version: newest

Hi, i think i have an easy question.

Can Somebody tell me, the item code for the Tasmota Firmware on Sonoff has to be, that i will get the Status of the Sonoff after pressing the Hardware Button?

Now i can switch it on/off via openhab, but when i toggle it with the Hardware Button, its inversed becase openhab doesn’t know anythin about this Toggles …

I hope that somebody can help me.

Thank you!!

Hi there,

there’s plenty of documentation on that here:

take a look here:

Switch BA_Washingmachine "Washingmachine" <washer> (BA)
    { mqtt=">[broker:cmnd/sonoff-E8A6E4/POWER:command:*:default],
            <[broker:stat/sonoff-E8A6E4/POWER:state:default]" }

the Sonoff sends MQTT messages, when it is triggered (regardless, if per hardware button or otherwise).
so, note the part with the "<", which means, openHAB2 listens to the expected MQTT-message.

Also, you can see all the messages that get sent by opening the console through the WEB Admin page for the Sonoff Device.

Its pretty handy to see all the messages and what they are publishing, though I’ve yet to figure out what the Vcc value indicates. I’m guessing voltage but not sure what I can do with that just yet, nor am I certain that is what it is. The Tasmota firmware is great but a lot of these little details are either not documented or really hard to find.

Yes, that’s right VCC is short for Positive supply voltage. And normally that indicator is of no use if you’re with a utility provider, which provides reliable power… :wink:

1 Like


It is really easy! No it works perfectly!

Yesterday i hat time and flashed all my devices. I got the 4ch Version and the TH and the POW. Works very fine :slight_smile:

Before i used Tasmota, i used ESPeasy. I had the feeling that Tasmota is more stable, so i choosed it.
What do you think about it?

But i miss the rules, in ESPeasy it was possible to create your own rules, so i can write a little rule, that my light should always switch of after 5min, i want to use it for a room where i got bad Wifi connection. The most time it is ok, but not always and i want to be sure, if i forget the light, it will turn off.

Thank you again! :wink:

You should make a rule in openhab. When your sonoff item changed to on start a timer that runs for 5 mins and then sends a off command. Here is a motion sensor example, try modding it for your own needs.

var Timer motionHal_timer = null

rule "Verlichting hal beweging"
		Item motionHal changed to ON
		if (lampHalModus.state == 1) {
			if (motionHal_timer !== null) { 
				motionHal_timer = null
			sendCommand(lampHal, 100)
			logDebug("verlichting", "Hal beweging gedetecteerd, schakel verlichting in")
			motionHal_timer = createTimer(now.plusSeconds(30)) [| 
				if (lampHalModus.state == 1) { 
					logDebug("verlichting", "Hal GEEN beweging meer gedecteerd, verlichting uitschakelen")
					sendCommand(lampHal, OFF)

I use a rule in openhab that tells me if the esp tasmotta device disappears offline

I then use pulsetime that can be configured through the web os on the esp to turn off a switch after a set period of time… . Very easy and no need to write a rule on the esp

This is for safety so that I know my switch will go off even if openhab fails or Mqtt broker or wifi fails