OpenHAB switch reports wrong state - Request for Guidance & help

I had created an OpenHabian on RPi3 and have connected to tasmota (on sonoff).
After the configurations the lights are working one.

Added the .items with MQTT and tagging.
Configured cloud connector and linked to googlehome for automation.

Used paper UI and network bindings to search the smart switches and added the things.
Issue 1:-
After linking items to the things in channels->Online->Linkeditems.
It was observed that the log viewer reports switch turning ON from off state (as event), automatically (without user input). This seems to be resulting in the switch status on APP and cloud to be changing the status to ON state. But the light would be off itself(only state of switch changes)

As a part of debugging unlinked the switch (item) from the Thing and everything works fine (switch status correc, no unexpected event of switch turned on reported)

Issue 2:-
When the things are linked with items by paper UI. The switches / things appear in Control panel of paper UI. If i referesh the page then the switch becomes inoperable (Disabled, cannot click on it)
The only way to recover is to unlink the item from the things and link it back.
But at the same time the switch can be operated from Mobile app and google assistant. When operated from app/assistant the switch status get updated in the control panel (but not able to control from control panel of Paper UI)

Switch GF_Photo_Light “Photo Light” (gBalcony) [ “Lighting” ]
{mqtt=">[mosquitto:cmnd/photolight/POWER:command:default],
<[mosquitto:stat/photolight/POWER:state:default]" }

Current status:-
I ahd decided to unlink the items from the things discovered in paper UI and had used habpanel to create the switches. Everything works fine now

issue3:
Now everything works fine but the switches are not populated in openhab APP (in local as well as remote modes).But the lights could be controlled from google assistant.

I assume that the if i create .things manually (by scripting) it may work.

Please help me in solving the issue and guiding me how to create the .things (might be some examples) would be fine

There is some confusion here.
The MQTT binding does not have “things”. It’s a 1.x binding and MUST be declared in the item definitions just as you have above:

Switch GF_Photo_Light “Photo Light” (gBalcony) [ “Lighting” ] { mqtt=">[mosquitto:cmnd/photolight/POWER:command:default],<[mosquitto:stat/photolight/POWER:state:default]" }

That is a good valid definition and it should work provided your broker name and topics are correct.

The control panel of Paper UI only shows things from 2.x bindings and therefore you will not see the MQTT items.
This interface is only designed for monitoring the state of items and is not a control interface.

Correct.

What do you mean by openhab APP?
On your phone?
You need to create a sitemap to be able to use the APP

Correct

Your are assuming incorrectly

Things are not needed. You are on the right track
All you need is to create a sitemap to control your switches

https://www.openhab.org/docs/tutorial/sitemap.html
https://www.openhab.org/docs/configuration/sitemaps.html

In your items file, the out going command needs 5 parameters. Note below the * added between command and default.

Switch GF_Photo_Light “Photo Light” (gBalcony) [ “Lighting” ]
{mqtt=">[mosquitto:cmnd/photolight/POWER:command:*:default],
<[mosquitto:stat/photolight/POWER:state:default]" }

Crap! I missed that!

@vzorglub I can say this, it doesn’t happen often.:smiley: I have learned a lot reading and studying your reply’s to others. Keep up the great work!

Thanks a lot All… Now everything is perfectly working… Have 2 lights integrated from tasmota (Sonoff)… Planning to get few more connected

I didn’t yet get the issue… I am new to openhab (like a baby!!!)

One General Question:

If I search for Things in Paper UI and link each item to it…then

what makes it malfunction. I mean switch status shows ON after sometime (an event is also created). But no commands send to switch (which means switch remains off).

Wondering why this is happening

As mentioned above, “The control panel of Paper UI only shows things from 2.x bindings and therefore you will not see the MQTT items.”

Set BasicUI up and control from there.

1 Like