I’m using OH3 and Mosquitto MQTT v3.1 as my broker.
Everything seems to work fine but I doesn’t seem to figure out what is going wrong with the below thing and item.
So I use an Shelly Plug S which is flashed with Tasmota, the correct template is used for this plug, I’m able to switch the socket on and off. Configured the MQTT parameters and created the following thing:
I got this config from the Tasmota GitHub page for Openhab: openHAB - Tasmota
Now I’m able to switch the switch on and off by command/item, but when I change the state on the Tasmota GUI the item don’t get updated and will retain the previous state.
When I connect to the MQTT Broker using MQTT Explorer and switch plug on the web GUI I see that stat/ShellyStekker1/POWER is changing from ON to OFF and the other way around. So I assume the the thing also reads this update but doesn’t change the item for some reason.
I tried both changes, so I set autoupdate to false and removed on=“ON”, off=“OFF” but unfortunately the state still don’t change when I toggle the switch on the Tasmota GUI.
Yea the strange thing is, I test with the tool MQTT Explorer, when I toggle the switch on the Tasmota GUI, I see that there is an update on stat/ShellyStekker1/POWER, just like I set my Thing, but openhab doesn’t seem to change the state of the linked item…
This would suggest it’s a configuration problem in openHAB. Maybe try configuring your connection via the UI? Make sure to remove your old Things and Items first.
Mosquitto v2 doesn’t let you do that by default, so be sure you have set that up to work without.
But if that means controlling the device from openHAB, then your broker set up is fine.
And what is the payload of that message?
I don’t see anything wrong with your channel set up, but if you have edited your xxx.things file, the binding is rubbish about picking upin-flight changes. Restart binding or openHAB after editing to your best effort.
Nothing jumps out at me as an explanation for the problems you are having.
I use the UI to set up my Tasmota devices in openHAB 3.x, and it has worked well for me. First create a GenericMQTT Thing in the UI, then set up the channels. I usually set up 2 channels, one that gets the state with stat/tasmota-frontporch-switch/POWER and sends commands with cmnd/tasmota-frontporch-switch/POWER. The other channel gets the state from tele tele/tasmota-frontporch-switch/STATE. Both channels are linked to the same item, so get normal updates when the switch state changes, plus updates for cases such as on a reboot, where the state of the item is NULL.
Ok, really strange… so after this changes it didn’t worked right away when I tested it. So I didn’t change anything else afterwards till today, I changes the thing to:
Originally I had “Type switch : power” and changed it to “Type switch : PowerSwitch”, and of course updated the item as well, I tested it again and still not working so I changed it back to “Type switch : power” like I had before and now all of as sudden it started working like it should be.
I really don’t understand why, but now when I toggle the switch on the Tasmota GUI, the item in Openhab also get updated to the new state
Don’t want to change anything on this thing or item now it is working, I also added another 2 Shelly plugs the same way like I described now, they also work like it should be.
Just run into the same issue and think that this is exactly what I want for my Tasmota power outlets. Since I didn’t fully understand what you wrote, I tried it out myself and have now an example config, which may be useful for someone else: