How to create a simple timer scene in openhab?

hi guys
I have an electric coffee maker plugged into a Tuya Basic. In the Tuya app I created a scene to turn the coffee maker on and off after 3m15s. I’m going to put Tasmota on that device and I would like to create the same scene in Openhabian. I think the easiest thing would be to use Expire-Binding but I was unable to operate another tasmota switch connected to a lamp to do a test.
Is it possible and better to just use Expire? Do I have to create Rules?
Thank you

If you want to do this in openHAB then I would use the Expire binding, as you suggest.

However, it looks like you can do this directly in Tasmota using the PulseTime command:

In the Tasmota console, just type:

PulseTime 1950

and the switch will turn off 195 seconds after being switched on!

Thanks. That’s so easy.

Tasmota is incredibly powerful - I only use about 1% of its capabilities!

If possible I prefer to automate the Tasmota device itself, rather than use openHAB, just in case there is a rare issue with openHAB itself and I’m not around. Personal preference though!

1 Like

The tricky thing about this approach is remembering what you did and where you did it. I’ll sometimes find myself months later wondering why something is behaving a certain way, having forgotten that the configuration happened on the device. So from an efficiency standpoint I prefer to automate at the device level, but from a maintenance standpoint I sometimes think it’s better to keep the automation all in openHAB. That being said, my system rarely fails on me so I perceive the risk of it being unavailable to be low. That won’t be the case for everyone.

1 Like

I can somewhat agree with this. I actually have something in between setup, where openHAB configures and arms a bunch of timers on Tasmota switches when the house becomes empty, and then disarms them when the house is occupied again. This way, openHAB does the initial work, but Tasmota is responsible for the continuous automation whilst the house is empty (and therefore no-one is around if openHAB keels over).

1 Like

I’d like to have all set in openhabian too like you said but I’m struggling to make 2 switches work.
Every time is a new challenge. Now they send 2 log messages every second and when I turn a switch on manually the lamp turns off right after that.

That doesn’t make sense. Are the switches used in rules?

I don’t know what’s happening. It was not this way before.
My log is going up like crazy.

The only way to use the switches properly (manually and through Alexa) is by erasing mqtt.things and .items and reboot openhabian. But then I can’t use it anyway.

No. no rules

The log is telling you that something is spamming commands at your switch. The question is, what’s doing it?

FYI, the “predicted to become” statements are due to autoupdate. You probably don’t need that for Tasmota devices, so you can turn it off.

{ channel="", autoupdate="false" }

I don’t think that’s the problem here, but that’s why you’re getting two messages each time.

You’ll need to share your mqtt.things content.
I think you have an unwanted postCommand option in the same channel as a commandTopic causing a feedback loop.

1 Like


Switch Sonoff1 “Luz Sala”
Switch Sonoff2 “Luz Mesa”


Bridge mqtt:broker:mosquitto “Mosquitto” [ host=“”, port=1883, secure=false, username=“openhabian”, password=“as1689”, clientID=“Paulo” ]
Thing mqtt:mosquitto:LSid:LSid “Luz Sala”
Thing mqtt:mosquitto:LMid:LMid “Luz Mesa” {
Type switch : light “Power” [ stateTopic=“stat/Sonoff1/POWER”, commandTopic=“cmnd/Sonoff1/POWER” ]
Type switch : light “Power” [ stateTopic=“stat/Sonoff2/POWER”, commandTopic=“cmnd/Sonoff2/POWER” ]


sitemap casa label=“CASA” {
Frame label=“Sala” {
Switch item=Sonoff1 label=“Luz Sala” icon=“lamp”
Switch item=Sonoff2 label=“Luz Mesa” icon=“lamp”

and that’s one of the switches tasmota log

:17:00 MQT: cmnd/Sonoff1/POWER =
20:17:01 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:01 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:01 UPP: Multicast (re)joined
20:17:01 MQT: Attempting connection…
20:17:01 MQT: Connected
20:17:01 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:01 MQT: cmnd/Sonoff1/POWER =
20:17:02 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:02 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:02 UPP: Multicast (re)joined
20:17:02 MQT: Attempting connection…
20:17:03 MQT: Connected
20:17:03 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:03 MQT: cmnd/Sonoff1/POWER =
20:17:03 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:03 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:03 UPP: Multicast (re)joined
20:17:03 MQT: Attempting connection…
20:17:03 MQT: Connected
20:17:03 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:03 MQT: cmnd/Sonoff1/POWER =
20:17:04 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:04 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:04 UPP: Multicast (re)joined
20:17:04 MQT: Attempting connection…
20:17:04 MQT: Connected
20:17:04 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:04 MQT: cmnd/Sonoff1/POWER =
20:17:05 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:05 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:05 UPP: Multicast (re)joined
20:17:05 MQT: Attempting connection…
20:17:06 MQT: Connected
20:17:06 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:06 MQT: cmnd/Sonoff1/POWER =
20:17:06 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:06 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:06 UPP: Multicast (re)joined
20:17:06 MQT: Attempting connection…
20:17:06 MQT: Connected
20:17:07 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:07 MQT: cmnd/Sonoff1/POWER =
20:17:07 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:07 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:07 UPP: Multicast (re)joined
20:17:07 MQT: Attempting connection…
20:17:07 MQT: Connected
20:17:07 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:07 MQT: cmnd/Sonoff1/POWER =
20:17:08 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:08 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:08 UPP: Multicast (re)joined
20:17:08 MQT: Attempting connection…
20:17:08 MQT: Connected
20:17:08 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:08 MQT: cmnd/Sonoff1/POWER =
20:17:09 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:09 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:09 UPP: Multicast (re)joined
20:17:09 MQT: Attempting connection…
20:17:09 MQT: Connected
20:17:09 MQT: tele/Sonoff1/LWT = Online (retained)
20:17:09 MQT: cmnd/Sonoff1/POWER =
20:17:10 MQT: stat/Sonoff1/RESULT = {“POWER”:“OFF”}
20:17:10 MQT: stat/Sonoff1/POWER = OFF (retained)
20:17:10 UPP: Multicast (re)joined
20:17:10 MQT: Attempting connection…

These Items have no connection at all with the Things and channels you have defined.
mqtt= is old version syntax for version 1 binding.
Version 2 Things and channels binding uses channels.
Switch ... (channel='blah;bleh"}

The Item in question is named in the events.log you showed us.
It’s probably an auto generated Item from Simple Mode.
You’ll almost certainly want to turn Simple Mode off (a system wide setting) as it becomes a huge nuisance if you are wanting to define your own Items, even give them sensible names.

1 Like

So I just erase everything?

Your things and items just aren’t quite right. I posted my things file recently for someone else. Have a look at that.

Once your things are defined, your items just need to reference them.

Thanks. I’ll try to fix it now.
so these two lines below are for turn On and Off the same device?
I think that’s one plug with 2 outlets

        Type switch : power1 "Outlet 1" [ stateTopic="stat/tasmotaop/POWER1",commandTopic="cmnd/tasmotaop/POWER1" ]

        Type switch : power2 "Outlet 2" [ stateTopic="stat/tasmotaop/POWER2",commandTopic="cmnd/tasmotaop/POWER2" ]

The publish to, and listen to, whatever topics you have set up here. Whether that is different devices or not depends on what topics you have set up in your external devices.

But in general for Tasmota, POWER1 and POWER2 would represent different relays within one box.
The parts of the topics you have given as tasmotaop is generally the unique name that you gave to a box.

So those two channels look like two relays in same box to me.

I’ve made these changes:


Switch Sonoff1 “Luz Sala”
{ channel=“mqtt:Sonoff1:mosquitto:Sonoff1:power” }
Switch Sonoff2 “Luz Mesa”
{ channel=“mqtt:Sonoff2:mosquitto:Sonoff2:power” }


Bridge mqtt:broker:mosquitto “Mosquitto” [ host=“”, port=1883, secure=false, username=“openhabian”, password=“as1689”, clientID=“Paulo” ]
Thing topic Sonoff1 “Luz da Sala” {
Type switch : light “Sonoff1” [ stateTopic=“stat/Sonoff1/POWER1”, commandTopic=“cmnd/Sonoff1/POWER1” ]
Thing topic Sonoff2 “Luz da Mesa” {
Type switch : light “Sonoff2” [ stateTopic=“stat/Sonoff2/POWER1”, commandTopic=“cmnd/Sonoff2/POWER1” ]

After rebbot it looks like it’s working fine. Until I use the HABpanel to turn on and of my devices.
After that the log goes crazy again and the switches turns back to the state after trying to switch on or off.