[SOLVED] Tasmota MQTT with config files

Just use PaperUI and remove all mqtt items, then clean the cache. After that you will have only the items defined in your files. Make sure simple mode is off.:wink: To clean cache first stop OH like shown above then type sudo openhab-cli clean-cache and restart.

There can be only one device, your sonoff. See my sitemap section for the items I gave as an example above.

Frame label="Living Room Light"
	{
		Switch item=LivingRoom_Light
		Text item=LivingRoom_Light_Temp
		Text item=LivingRoom_Light_Humidity 
	}
	Frame label="Couch Light"
	{
		Switch item=CouchLight

I’m using just a switch and its name, in this case its CouchLight.

I edited the rule above to use only the switch item and omitted the relay. Give that plus the sitemap adjustment a try.

Oh and move the channel to the switch and edit out the relay part like below.

Switch Bathroom_Tasmota_Switch "Boiler" <switch> {channel="mqtt:topic:mosquitto:Bathroom_Boiler_Control:Bathroom_Boiler_Relay" }
#Switch Bathroom_Tasmota_Relay "Tasmota" <switch> 

@Joris nothing new? You either have it working or needed a break.:grin: Hope it’s the first one and it’s all smooth.:wink:

If your still having issues repost your things, items, rules, etc… and we’ll git it figured out.

If all is working please check the square box on the post that provided the solution as to mark this topic solved. Thanks

Nope still nothing here. Your suggestion to replace the channel to the switch… Doesn’t that make my rule useless? Because I’m giving the ‘ON’ ‘OFF’ commando to the Bathroom_Tasmota_Relay and not to the Bathroom_Tasmota_switch.

Yes… i needed a break…

I’m not sure if the situation now got any better:

Rules:

rule "Tasmota"
when
    Item Bathroom_Tasmota_Switch changed 
then
    if (Bathroom_Tasmota_Switch.state == ON) {
        Bathroom_Tasmota_Switch.sendCommand(OFF)
    }

    else if (Bathroom_Tasmota_Switch.state == OFF){
         Bathroom_Tasmota_Switch.sendCommand(ON)
    }
end

Item

Switch Bathroom_Tasmota_Switch "Boiler" <switch> {channel="mqtt:topic:mosquitto:Bathroom_Boiler_Control:Bathroom_Boiler_Relay" }

thing

Bridge mqtt:broker:mosquitto [ host="192.168.178.39", secure=false ]
{
    Thing mqtt:topic:Bathroom_Boiler_Control "Bathroom Boiler Control" @ "Haardvuur Controller"{
    Channels:
        Type switch : Bathroom_Boiler_Relay [ stateTopic="stat/tasmota-switch/POWER", commandTopic="cmnd/tasmota-switch/POWER", on="ON", off="OFF" ]        
    }
}

Now, when I manipulate the switch on my basicUI. It just jumpes back. Like it doesn’t work (While if I work on my old way (using _Relay and _switch) I do see the switch moving…

log:

2019-11-17 20:02:50.903 [ome.event.ItemCommandEvent] - Item 'Bathroom_Tasmota_Switch' received command ON
2019-11-17 20:02:50.909 [nt.ItemStatePredictedEvent] - Bathroom_Tasmota_Switch predicted to become NULL

And this is why I don’t recommend writing things files
The syntax is not easy. And very easy to get wrong
If you configure your things and channels via PaperUI you can’t get it wrong.

So in the end it did work. It was a mistake .device file.

Switch Bathroom_Tasmota_Relay "Tasmota" <switch> {channel="mqtt:topic:Bathroom_Boiler_Control:Bathroom_Boiler_Relay" }

Previously I always mentioned the broker as well. This was not working.
The method of only using the switch didn’t work. So I went back to the use of the _switch and the _relay. Maybe not the most clever one. But it did the trick.