How to create a simple timer scene in openhab?

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

casa.items

Switch Sonoff1 “Luz Sala”
{mqtt="
>[mosquitto:stat/Sonoff1/POWER1:state:default],
<[mosquitto:tele/Sonoff1/STATE:state:JSONPATH($.POWER1)],
>[mosquitto:cmnd/Sonoff1/POWER:command::default]"
}
Switch Sonoff2 “Luz Mesa”
{mqtt="
>[mosquitto:stat/Sonoff2/POWER1:state:default],
<[mosquitto:tele/Sonoff2/STATE:state:JSONPATH($.POWER1)],
>[mosquitto:cmnd/Sonoff2/POWER:command:
:default]"
}

mqtt.things

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

casa.sitemap

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:

items

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

things

Bridge mqtt:broker:mosquitto “Mosquitto” [ host=“192.168.2.112”, port=1883, secure=false, username=“openhabian”, password=“as1689”, clientID=“Paulo” ]
Thing topic Sonoff1 “Luz da Sala” {
Channels:
Type switch : light “Sonoff1” [ stateTopic=“stat/Sonoff1/POWER1”, commandTopic=“cmnd/Sonoff1/POWER1” ]
}
Thing topic Sonoff2 “Luz da Mesa” {
Channels:
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.

These are not the channels for the Things that you show us. I don’t think they’re valid at all, actually.

It’s possible to work out what a channel is called (UID), more like
mqtt;topic:Sonoff1:light
but the easy way is to find your Thing in PaperUI and copy/paste the channel UID

Okay, we have a broker-Bridge and a Thing.
But this Thing is not linked in any way to the broker-Bridge. It does not assume anything because you may have more than one broker.

There’s two ways to do this; you can tell each Thing which broker it belongs to.
Or the easier way is to nest Things inside their parent broker with { } braces

Bridge mqtt:broker:mosquitto "Mosquitto" [ ... ]
{
   Thing topic Sonoff1 "Luz da Sala" { ...
      Channels ...
   }
   Thing ...
      Channels ...
   }
}

Once again, look closely at your events.log to see the names of the Items involved. You’ve got multiple Items here, some are autogenerated and are not the ones you are editing.

I’m looking at the log but thins turns back to the same 2 or 3 messages per second.
I refuse to assume that I’m too stupid to set this thing :slight_smile:

Maybe you can tell me what’s wrong with this info from my stuff:

Trying to stop openhabian I got this now

Nothing wrong with those items, except the channel links. If you click on your Generic MQTT Things in PaperUI, it should list channels. It’s the channels you want to link to your Items, not the generic Things.

The Item you showed us generating loops in your log was named mqtt_topic_LM1d_LM1d
Maybe that’s changed, but I can’t see the log you’re seeing now.

That’s probably an auto generated Item from your system being in simple mode. I strongly discourage using that setting, it gets in the way of anything you want to do with creating your own configuration.
I think it might hide parts of PaperUI from you as well.

how to change from simple mode?

PaperUI > Configuration > System > “item Linking”
Remember to click save.

i’d advise a restart, I don’t know if that is needed.

Sorry. I’m already using that. I have the Items menu

So, what is the nature of this Item mqtt_topic_LM1d_LM1d that you see in your logs ?

Have you clicked on your generic mQTT Things to see their channels?

Yes. I did that.
I deleted those mqtt_topic_LM1d_LM1

I don’t know what to put in channel in items

copying the thing from de paper UI doesn’t solve

That’s my channel linked to the thing.
Do I have to copy everything like mqtt:topic:mosquitto:Sonoff1:light ?

On/Off Switch

mqtt:topic:mosquitto:Sonoff1:light
Switch

This is the channel UID
That is the part you want to put in the Item’s {channel=‘xxx’} place
Switch someItem ... {channel="mqtt:topic:mosquitto:Sonoff1:light"}

You don’t need to copy On/Off Switch text.