MQTT Sonoff/ESP-Easy state issues

So, I have an MQTT broker and Sonoff-like ESP-Easy device.

I started off with this:

Switch GF_Dining_Lights {mqtt=">[mosquitto:/ESP_Easy3/gpio/4:command:ON:1],>[mosquitto:/ESP_Easy3/gpio/4:command:OFF:0]"}

At first on the android OpenHab app, it just works as it should on=displays on icon, off=displays off icon
(Even if I turn it off or on via another PC Basic UI).
On my chrome desktop web-browser however, the state icon does not change even when turning it on or off from the browser. I have to hit F5…

What causes this?

Other switches like Intertechno switches do not suffer from this…

Log seems normal too:
2018-01-20 21:28:57.734 [ome.event.ItemCommandEvent] - Item ‘GF_Dining_Lights’ received command ON

2018-01-20 21:28:57.752 [vent.ItemStateChangedEvent] - GF_Dining_Lights changed from OFF to ON

2018-01-20 21:29:02.704 [ome.event.ItemCommandEvent] - Item 'GF_Dining_Lights' received command OFF

2018-01-20 21:29:03.168 [vent.ItemStateChangedEvent] - GF_Dining_Lights changed from ON to OFF

There’s a bug in BasicUI, it won’t refresh items (sometimes it does as you experienced)…

please remove the initial “/” from your topics, it’s not ideal as it basically indicates a “NULL” main topic:

The leading slash is the default setup of ESP-Easy though, so I was wondering about that…

it works - but you could run into some headaches, especially if you’d like to subscribe with wildcards and stuff :wink:
one-to-one communication is absolute fine, though.

Since you know much about MQTT,

Maybe you could help me out with a new issue…

Yesterday I flashed 2 Sonoff clones with ESP_EASY.
I called them ESP_Easy3 and ESP_Easy4…

I now have this weird phenomena that each time I suscribe to ESP_Easy3/# and/or ESP_Easy4/# I find a bunch of /ESP_Easy3/gpio/4,1 /ESP_Easy3/gpio/15,1 and /ESP_Easy4/gpio/4,1 /ESP_Easy4/gpio/15,1

What is really driving me nuts is the fact that I only used ESP_Easy4 at my desk to check that flash worked.
So I am not sure what is actually sending out this MQTT message.
Not sure if some persist or bug (my mistake somewhere) in Openhab, or a broker issue, or…
I checked the .items files and .sitemap on openhab and cannot find anything even containing Easy4… :frowning:

hmmm. I don’t know, how ESP_Easy works, so…
I don’t know a way on how to see the client-id while subscribing, that would be the first way.
Next would be to disconnect the devices one by one and find out, who’s the evil one! :wink:

The way to see client-id seems to be broker-dependent…? perhaps someone else can help here.

Is actually turned out to be that I had messages set as retained and I’m not sure what caused that and I could not delete them. I finally simply clearing out the mosquito database fixed it in a crude way. I also made sure message retaining is off from openhab.

1 Like