Integration Solutions using MQTT

We may need the driver logs to figure this out. Could you download the SmartThings CLI?

Just make sure there aren’t any accidental trailing blanks either in the device settings fields…

OK, so this is creepy. Smartthings went offline this morning from 7:40 - 7:46. Now MQTT is working. Honestly, I made no changes to anything since our last conversation. Going to add more devices and see if they work out of the gate. If not, I’ll reboot ST and see what happens. Go figure.

1 Like

Glad it’s working now!

When in doubt…reboot lol. Glad you got it going!

1 Like

Oh well. I created a second contact device and it didn’t work. So I tried the ST re-boot and now both devices don’t work. Can’t catch a break here. Off to CLI and see where that gets me.

That’s a bummer. Does the creator device show that it is connected and does it list both topics in the subscribed topics field? What happens when you tap the Refresh button?

Last night I went ahead and created all my zones, none worked. This morning, they all work. I’m beginning to think this is more of a flakey ST transition thing more than anything else. Used a device in a routine and it worked perfectly. Very happy at the moment. I’ll continue to check what each new day brings but all seems well. :grinning: I did notice that ActionTiles doesn’t recognize these devices but I’m assuming that’s an ActionTiles issue as we transition. Thanks everyone for your help.

Side note: I am so impressed with this app: easy install and deployment and very logically laid out. MQTT integration is not a top-10 smart home user request I’m sure so that fact that Todd pulled this off is absolutely amazing. This app, as well as the virtual edge driver will allow me to survive the ST transition. Thank you!

2 Likes

I’m looking at the code today and I think there are some changes I can make that could improve recovery from connection failures. Will be back with an update…

1 Like

I’ve pushed a update to the MQTT Devices driver. Given the reports of instability and disconnects by @raisingskell and @gst, I’ve tried to to beef up recovery from disconnects.

If the connection with the broker cannot be made at driver startup, or is later lost after successfully connecting, the driver will retry every 15 seconds to (re)establish the connection. Once established, all topics will be (re)subscribed. The status field in the creator device will tell you of any reconnections, and you can also look in the device History to see prior status changes.

Also, remember that you can tap the Refresh button at the bottom of the creator device Controls screen and this will force a disconnect/unsubscribe all/reconnect/re-subscribe all sequence.

New driver version: 2022-11-20T02:05:26.759176946

Please let me know of any further issues.

In my experience it disconnected randomly (unrelated to a reboot of the hub or due to inactivity) and almost immediately showed “reconnecting” and “connected” but until I clicked the refresh it wouldn’t recieve topic messages.

I changed to using post/get messages which has been much more reliable, so I won’t be able to verify if this update has fixed the problem.

hi mqtt is not working for me at all today in or out of smartthings , im getting this error
? Select a driver. 7
2022-11-20T14:36:48.472944812+00:00 TRACE MQTT Devices V1 Received event with handler capability
2022-11-20T14:36:48.478509562+00:00 INFO MQTT Devices V1 <Device: c48b3040-c2d3-447f-86c4-f19b1399ed50 (MQTT node red)> received command: {“args”:{},“capability”:“switch”,“command”:“on”,“component”:“main”,“positional_args”:{}}
2022-11-20T14:36:48.484075062+00:00 TRACE MQTT Devices V1 Found CapabilityCommandDispatcher handler in MQTT Devices
2022-11-20T14:36:48.487840603+00:00 INFO MQTT Devices V1 Switch triggered: on
2022-11-20T14:36:48.493526728+00:00 INFO MQTT Devices V1 <Device: c48b3040-c2d3-447f-86c4-f19b1399ed50 (MQTT node red)> emitting event: {“attribute_id”:“switch”,“capability_id”:“switch”,“component_id”:“main”,“state”:{“value”:“on”}}
2022-11-20T14:36:48.526810020+00:00 ERROR MQTT Devices V1 MQTT node red thread encountered error: [string “st/dispatcher.lua”]:233: Error encountered while processing event for <Device: c48b3040-c2d3-447f-86c4-f19b1399ed50 (MQTT node red)>:
arg1: table: 0x2662940
[string “cmdhandlers.lua”]:32: network connection is not opened
2022-11-20T14:37:09.246457204+00:00 TRACE MQTT Devices V1 Received event with handler capability
2022-11-20T14:37:09.320969013+00:00 INFO MQTT Devices V1 <Device: c48b3040-c2d3-447f-86c4-f19b1399ed50 (MQTT node red)> received command: {“args”:{},“capability”:“switch”,“command”:“off”,“component”:“main”,“positional_args”:{}}
2022-11-20T14:37:09.327614730+00:00 TRACE MQTT Devices V1 Found CapabilityCommandDispatcher handler in MQTT Devices
2022-11-20T14:37:09.330637343+00:00 INFO MQTT Devices V1 Switch triggered: off
2022-11-20T14:37:09.333944522+00:00 INFO MQTT Devices V1 <Device: c48b3040-c2d3-447f-86c4-f19b1399ed50 (MQTT node red)> emitting event: {“attribute_id”:“switch”,“capability_id”:“switch”,“component_id”:“main”,“state”:{“value”:“off”}}
2022-11-20T14:37:09.349364891+00:00 ERROR MQTT Devices V1 MQTT node red thread encountered error: [string “st/dispatcher.lua”]:233: Error encountered while processing event for <Device: c48b3040-c2d3-447f-86c4-f19b1399ed50 (MQTT node red)>:
arg1: table: 0x261eca0
[string “cmdhandlers.lua”]:32: network connection is not opened
listening for logs… done

nevermind just rebooted smartthings hub and its working fine .
martin

1 Like

OK, leave it to me to ask the dumb questions. :face_with_open_eyes_and_hand_over_mouth: I’m assuming I update the driver for each device? When I go to select a new driver there’s no MQTT Devices driver listed. I then went to the channel to uninstall and re-install MQTT Devices and I get an uninstall error “unexpected error Request failed with status code 504 (code undefined)”. How do I update the MQTT Devices driver?

You don’t have to do anything; the driver is automatically updated on your hub (for all devices) when I update it on the channel. Supposedly it can take up to 12 hours for updates to reach your hub, but it’s usually much faster.

You can check what driver version you have by tapping the three-vertical-dot menu icon in the upper right of your creator device Controls screen, and tapping ‘Driver’.

Had you tried tapping the Refresh button? If that’s not correcting things I’d like to figure out why not. You really shouldn’t have to be rebooting your hub.

Yes i tried refreshing , restating mqtt broker even removing mqtt device creator and re adding it .

OK, sorry for the hassle. I’ll see if I can recreate the problem or figure out what may be happening from your logs (thanks for providing).

1 Like

its no hastle at all ,
thanks
martin

does this work with lights too? or just switches motion sensors etc?