Openhab2 MQTT Binding won´t work properly

I´m using OpenHab2 on a Raspberry Pi 3 running Raspbian to control currently 2 Sonoff Basics with Tasmota flashed. They used to work perfectly fine until today, when I tried to add something new. The lights won´t turn off/on anymore. So I undid all my changes, but the problem remained. Figuring that would be the easiest way to go I reinstalled openhab and reconfigured the switches following this tutorial:
But it still doesn´t work and I have currently no clue whatsoever why. I guess I´m just missing something and hoping that somebody can point it out to me.




Switch BedRoom_Light "Bedroom_Light" <light> (gLight)
    { mqtt=">[broker:cmnd/sonoffSchlafzimmer/POWER:command:*:default],
            <[broker:stat/sonoffSchlafzimmer/POWER:state:default]" }

Switch LivingRoom_Light "Livingroom_Light" <light> (gLight)
    { mqtt=">[broker:cmnd/sonoffWohnzimmer/POWER:command:*:default],
            <[broker:stat/sonoffWohnzimmer/POWER:state:default]" }


sitemap mySmarthome label="MySmarthome" {
        Frame label="Licht" {
                Switch item=Bedroom_Light label="Schlafzimmer"
                Switch item=Livingroom_Light label="Wohnzimmer"

JavaScript, JSONPath and Map Transformation are installed. MQTT Binding and Action are also installed.

The switches are controllable, I can turn the lights on/off by sending the MQTT Message directly so they are properly conntected to the mosquitto server running on the raspberry. Thanks in advance!

what’s the problem, then? :wink:

They aren´t controllable via OpenHab, but if I send the command via e.g. mqttFX they work. So they are working properly, but I failed to configure OpenHab correctly and I don´t know where my mistake is.

retain property is boolean (true/false). I don’t know if that’s the reason however.

In my setup I set only broker url. The whole rest, including clientId and retain properties, is commented out.

Try to uninstall the mqtt Action, sometimes that causes problems and check the log if openhab establishes a connection to the broker

ah - please have a look here:

you could just change to that thread also, and please provide the entries in events.log (there should be some indication for the broker connection and some information on the changing switches)

As suggested by @PawelGrzembka I commented the retain part out (and corrected it to a boolean value, but I already did that beforehand, just forgot to update my post).

Thanks @binderth for pointing me towards the event log. I should have started by looking into that. I had a few errors/warnings there:

15:07:07.606 [ERROR] [.ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Livingroom_Light' for widget org.eclipse.smarthome.model.sitemap.Switch
The “R” of LivingRoom_Light was supposed be a a capital one like in the items file.

Also this warning, but I guess it didn´t cause any problems (yet)
15:06:06.808 [WARN ] [.sitemap.internal.SitemapProviderImpl] - Filename myHome.sitemap does not match the name mySmarthome of the sitemap - please fix this as you might see unexpected behavior otherwise.

Now everything seems to work fine again. Thanks guys! :slight_smile:
This time I´ll make a backup before changing anything else even though there is not much to actually make a backup of :laughing:

1 Like

glad it worked out.

yes, it’s just a warning, but you should name your sitemap accordingly to the filename (or vice versa, if you like!) - then the log entry is gone!

Nobody likes warnings, so I changed that :slight_smile: