Device turning off - Shims or MQTT issue?

Posted on
Tue Aug 13, 2019 4:59 am
AndyVirus offline
Posts: 257
Joined: Mar 18, 2014
Location: Newport Pagnell, UK

Device turning off - Shims or MQTT issue?

OK. Different issue. (Sorry did not know where to post, Shims or MQTT)

On my Switch Device. After 4 mins a blank message is sent to the /cmd/sonoff/POWER topic which turns off my switch.

Pressing ON sends ON
Pressing Off sends OFF
Every 3-4 mins a blank message is sent which results in switch turning OFF.


Code: Select all
13 Aug 2019 at 11:45:14
   Shims Debug                     Owl Lamp MQTT: actionControlDevice: Turn On
   Shims Debug                     received notification of MQTT message type ##SONOFF## from MQTT Broker
   Shims Debug                     Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"ON"}
   Shims Debug                     Owl Lamp MQTT: Updating state to True

13 Aug 2019 at 11:48:10
   Shims Debug                     received notification of MQTT message type ##SONOFF## from MQTT Broker
   Shims Debug                     Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
   Shims Debug                     Owl Lamp MQTT: Updating state to False

13 Aug 2019 at 11:50:10
   Shims Debug                     received notification of MQTT message type ##SONOFF## from MQTT Broker
   Shims Debug                     Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
   Shims Debug                     Owl Lamp MQTT: Updating state to False

13 Aug 2019 at 11:51:06
   Shims Debug                     received notification of MQTT message type ##SONOFF## from MQTT Broker
   Shims Debug                     Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
   Shims Debug                     Owl Lamp MQTT: Updating state to False
Attachments
Screenshot 2019-08-13 at 11.56.22.png
Screenshot 2019-08-13 at 11.56.22.png (79.16 KiB) Viewed 1629 times

Posted on
Tue Aug 13, 2019 5:27 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Introducing the Shims plugin

It sure looks like your broker is actually sending out those Power Off messages. They're not blank, the payload is there.

Do you have MQTT Explorer or MQTT Box running? It would be good to see if another client is seeing them (or not).

Do you have multiple Broker devices defined? Try changing the trigger to use the one you're actually using.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 13, 2019 5:48 am
AndyVirus offline
Posts: 257
Joined: Mar 18, 2014
Location: Newport Pagnell, UK

Re: Introducing the Shims plugin

I say its blank becuse watching the topic using MQTT.fx on my mac, I can see that there is a publish to /cmnd/sonoff/POWER but nothing is in the payload. If i send ON or OFF then ON or OFF is published but every few mins a payload of blank is sent:

I have change from Any Broker to the specific broker (slip of finger when setting up) and same issue.

Shims Debug received notification of MQTT message type ##SONOFF## from MQTT Broker
Shims Debug Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
Shims Debug Owl Lamp MQTT: Updating state to False
MQTT Debug Sonoff Trigger: Removing Trigger
MQTT Debug Sonoff Trigger: Adding Trigger (This was me changing the broker in the Trigger)

13 Aug 2019 at 12:32:19
Shims Debug received notification of MQTT message type ##SONOFF## from MQTT Broker
Shims Debug Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
Shims Debug Owl Lamp MQTT: Updating state to False

13 Aug 2019 at 12:34:35
Shims Debug received notification of MQTT message type ##SONOFF## from MQTT Broker
Shims Debug Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
Shims Debug Owl Lamp MQTT: Updating state to False

Payload.png
Payload when ON is clicked
Payload.png (108.86 KiB) Viewed 1614 times
no payload.png
Blank payload sent every few mins
no payload.png (108.76 KiB) Viewed 1614 times

Posted on
Tue Aug 13, 2019 5:56 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Introducing the Shims plugin

AndyVirus wrote:
I say its blank becuse watching the topic using MQTT.fx on my mac, I can see that there is a publish to /cmnd/sonoff/POWER but nothing is in the payload. If i send ON or OFF then ON or OFF is published but every few mins a payload of blank is sent:

I have change from Any Broker to the specific broker (slip of finger when setting up) and same issue.

Code: Select all
 Shims Debug                     received notification of MQTT message type ##SONOFF## from MQTT Broker
   Shims Debug                     Owl Lamp MQTT: message_handler: '##SONOFF##' stat/sonoff_owl_lamp/RESULT -> {"POWER":"OFF"}
   Shims Debug                     Owl Lamp MQTT: Updating state to False
   MQTT Debug                      Sonoff Trigger: Removing Trigger
   MQTT Debug                      Sonoff Trigger: Adding Trigger (This was me changing the broker in the Trigger)



The topic '/cmnd/sonoff_owl_lamp/POWER' has no payload. Without one, it's a request status command. But your trigger is on "stat/sonoff_owl_lamp/RESULT", which has a JSON payload of "{"POWER":"OFF"}".

So it looks like something is sending out the status request (POWER topic), which is replying with a RESULT payload, which is causing your lamp to turn off. Do you have any other devices connected to the broker? It's almost like you have two devices with the same name.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 13, 2019 6:07 am
AndyVirus offline
Posts: 257
Joined: Mar 18, 2014
Location: Newport Pagnell, UK

Re: Introducing the Shims plugin

How weird! It seems to happen with MQTT and Shims plugins disabled so totally something local. Sorry to waste your time.

I only have 1 broker and 1 Sonoff (powered). I have connected to the tasmota gui and see if there is some auto off or something set and cant see anything. Will reset the thing. Something is going weird. Wish i could see for sure in MQTT tools who (ip) sent the topic publish. Must be a way...

On a side note, while looking though setting i can see that Tasmota can emulate WeMo and Philips Hue Bridge if you need another example. I know you have WeMo but Hue might be interesting.

Emulation
None
Belkin WeMo single device
Hue Bridge multi device

Thanks for you help and patience.

Posted on
Tue Aug 13, 2019 6:09 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Introducing the Shims plugin

You would need to restart your Mosquitto broker with the --verbose option for it to log (to stderr) the client actions. That should tell you where the message is coming from.

The client doesn't get that info, so you have to use the broker to debug it.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 13, 2019 6:13 am
AndyVirus offline
Posts: 257
Joined: Mar 18, 2014
Location: Newport Pagnell, UK

Re: Introducing the Shims plugin

FlyingDiver wrote:
You would need to restart your Mosquitto broker with the --verbose option for it to log (to stderr) the client actions. That should tell you where the message is coming from.

The client doesn't get that info, so you have to use the broker to debug it.



Will give that a go. Need to shut the Smappee up first as that publishes ever second.
Annoyingly since connecting to the GUI of Tasmota (or pressing the button on the Sonnoff to turn on the Lamp a), the RESULT topic has not changed and neither has any more blank POWER publishes occurred. Grrr.

Posted on
Tue Aug 13, 2019 6:17 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Device turning off - Shims or MQTT issue?

I move these posts to their own thread...

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Aug 13, 2019 2:19 pm
cuhouse offline
Posts: 144
Joined: Feb 21, 2007
Location: Virginia, USA

Re: Device turning off - Shims or MQTT issue?

Andy,

I saw this today on the Tasmota WiKi referring to ghost switching. Might be something you would want to check? https://github.com/arendst/Sonoff-Tasmota/wiki/PowerOnState-Configuration#side-effects-with-using-mqtt-messages

Go into the Tasmota console of the device and type powerretain. If the output is {"PowerRetain":"OFF"} then probably not your issue. If it is on, you may want to check if the broker has retained flag.

I use MQTT Explorer and you can see whether it has a retained flag on your broker. It also allows you to clear it.

May help.

Jody

Edit: I just watched the video tutorial referenced in the link above and there are a few other things you could try.
Attachments
Screen Shot 2019-08-13 at 4.06.12 PM.png
Screen Shot 2019-08-13 at 4.06.12 PM.png (54.76 KiB) Viewed 1509 times

Indigo 2022.1.2, Big Sur v11.7.1, Dedicated late 2014 Mac Mini, PowerLinc 2413U.

Posted on
Tue Aug 13, 2019 11:50 pm
AndyVirus offline
Posts: 257
Joined: Mar 18, 2014
Location: Newport Pagnell, UK

Re: Device turning off - Shims or MQTT issue?

I will take a look. Definitely sounds like the reason. I cant make it happen now. Seemed to stop totally after i restarted the broker in verbose mode so retained does make sense. I did see some retained flags on certain topics using MQTT.fx. Thanks for the info!
I can say with absolute certainty that this is NOT a plugin issue with Shims or MQTT plugin at least.

Posted on
Wed Aug 14, 2019 4:28 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Device turning off - Shims or MQTT issue?

There was a bug in the first couple MQTT plugin versions that all messages were getting sent with retain = True. That's been fixed. So maybe that's how it got set originally.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests