Integration Solutions using MQTT

Is your HA system on the same subnet as your SmartThings hub?

yup. very basic Eero internet configuration. I created a login in the config of the Mosquito add-on in Home Assistant and entered that in the settings in the ST device. No luck so far, but i’m sure i’m missing some setting in the Mosquito add-on that allows it to be seen outside my Home Assistant Yellow.

Greetings; not certain where I missed it but I cannot figure out how to make it work with actual devices; such as the existing zwave smart lock. (configured and working well).
The mqtt stuff is installed on the smartthings hub and working; I can connect to my local MQTT service.
Created a fake? lock device and toggle it via mqtt with out issues.

So now how do I get it to toggle the real lock or other devices.

was hoping to see the smart lock status messages via mqtt and act upon them with HA

Cheers

I have had MQTT Devices driver running on SmartThings hub and MQTT broker running on Raspberry Pi Zero more than year. The MQTT broker and MQTT Devices driver have been functioning flawlessly all time.

I bought a used SmartThings Hub. I added it to a different ST location.
The “new” ST Hub is still located in the same place and network as the other ST Hub.

I have installed also to the “new” SmartThings Hub MQTT Devices driver.

I have started testing local communication between two Hubs.

Temperature values are updated between two Hubs.
State of the switch is also updated between two Hubs.

MQTT Devices driver’s Switch Device is nice. It can publish and subscribe same MQTT topic. Due to this feature, the mirroring of the state of the switch between Hubs is also possible without any additional measures. The state of the switch can be changed from either hub and the state is updated in the other hub.

3 Likes

I knew very little about MQTT, but lately have been trying it out more. @TAustin 's MQTT device driver is a real Swiss Army Knife - didn’t realise how good a utility it is!
Your setup is interesting, in many cases this gets over the dilemma which is starting to arise, of how to locally implement multiple hubs, whether primary or secondary, multi-hub or no etc
Good post.:ok_hand:

1 Like

@refluxologist - Hi sorry for the delay in responding. I doubt that a zwave smart lock would support MQTT, but I suppose it’s possible. Have you confirmed that it does? If so there would be some MQTT configuration (broker address & credentials) that would have to be done on the device side, and you’d need to know what MQTT topics the device responds to or sends out.

1 Like

Hi, I’ve been using the MQTT Devices Driver for a while with various devices and really enjoy it. Thanks @TAustin . I wanted to integrate my EcoVacs robot vacuum cleaner with Smartthings using Node Red and my existing MQTT broker. I was able to do this integration easily using your driver by creating a custom device.

My question is more whether you could enhance the “Robot Cleaner” device to include more controls. For example, some existing buttons don’t seem to be mapped (e.g. Spot, Manual). And it would be nice if we could subscribe to more information like brush lifespan, Battery level (%), Charging status, Cleaning status, etc.

Having these extra information in the device would make a big difference in the integration.

Thanks

Wow! Thanks for all of the great content. I’m going to try and get started with my own projects.

Yes it is true that not all of the controls that are included in the robot cleaner capability are functional in this driver. The challenge of course is that there is wide variation in the data or controls that is available in any particular brand of cleaner.

I could look at adding support for more features. Can you give me more specifics regarding the controls and data that you would like to see added? In other words, what are the associated MQTT messages? Some features may require the creation of custom capabilities.

Hi, here is what I would see.

Commands to the vacuum

  • Resume (missing button and command)

Cleaning Modes to vacuum

  • Spot (button exist but nothing gets sent) → this command would require an extra parameter for the area(s) to be cleaned. I suggest maybe a comma separated string with all the area(s) to clean. Json command example:
    {
    “cmd”: “SPOT”,
    “area”: “0,1,2”
    }

Status from the vacuum

  • Charge Mode → String
    {
    “status”: “ChargeMode”,
    “value”: string
    }
  • Clean Mode → String
    {
    “status”: “CleanMode”,
    “value”: string
    }
  • Battery Level → int (0-100)
    {
    “status”: “BatteryLevel”,
    “value”: int
    }

Thanks for your help

I had this working for a long time, but a few weeks ago, it stopped. I’m not sure what I can do to troubleshoot so any pointers would be helpful. I’ve got mosquitto_sub running and can see messages are being published, but they aren’t showing up in the SmartThings app. The MQTT Discovery app shows “Connected & Subscribed”. The MQTT Device Creator v1.9 shows “Connected” on the Devices page, but if I go into the device, the status says “Not Connected”. Under the “Subscribed Topics” nothing is listed. Tapping “Refresh” does nothing. I can use that device to create new virtual devices, but they don’t so any of the data. Are there any logs I can check to see what is happening?

If you have SmartThings CLI installed you can use CLI command
smartthings edge:drivers:logcat for logging.

GitHub - SmartThingsCommunity/smartthings-cli: Command-line Interface for the SmartThings APIs.

Thanks. When I update a device’s topic name, I get the error:

2024-05-10T17:53:59.976719094Z ERROR MQTT Devices V1.9  Wind Direction thread encountered error: [string "st/dispatcher.lua"]:261: Error encountered while processing event for <Device: 68e4c041-c714-4599-85ee-b8a927a7ae9f (Wind Direction)>:
    arg1: infoChanged
    arg2: table: 0xc67218
"[string "subscriptions.lua"]:146: attempt to index a nil value (global 'client')"

@TAustin

Awesome driver, thanks! I’ve set it up to monitor/control a water heater with the mosquitto broker running on my NAS and the water heater connected via GitHub - excaliburpartners/EnergySmartBridge: MQTT bridge for the EnergySmart Water Heater WiFi Controller. Works great! A couple of nice to have RFEs, a) for Temperature devices which are read only, (Publish temperature changes disabled) to not include the set Temperature slider in the UI, and b) for Text topics allow setting and a defined list of items. The later would be useful to allow setting the mode of the water heater.

@TAustin - Im using the MQTT Devices v1.9 driver to control irrigation hooked up to an ESP and all works as intended until the ESP reboots and reconnects. Depending on the last state, things sometimes get out of sync:

Driver Publishes ‘ON’
ESP Receives ‘ON’
ESP Switches Water ‘ON’
ESP Restarts and Re-Subscribes
Water Remains ‘OFF’ (because published message is no longer there)

Through reading about MQTT it appears this scenario can be overcome by setting the ‘Retain’ flag when publishing the original message. If my understanding is correct, can that setting be added to the driver?

Hello. I already have mosquitto and zigbee2mqtt running. Could someone please ELI5 if and how these drivers would allow me to pull those devices into ST? I feel like I am probably missing something obvious.

Hello. Incredible work @TAustin , I’ve been using your awesome drivers and cannot express my gratitude enough. I recently encountered an issue with the main device (MQTT Device Creator V1.9) getting stuck “reconnecting” after an internet failure/switchover. Only a restart of hub will retrigger it correctly. I’ve tried updating the settings (like changing IP, user), clicked refresh but nothing happens. No new events either in ST. Any idea? The rest of non MQTT devices (Zwave, Zigbee, Wifi etc) work as they should.

I had similar problems when I started to use MQTT Devices Driver. The problem disappeared when I set the value of the setting Reconnection wait to a larger value. Now I have set Reconnection wait to value 50.

1 Like

Tried, same thing but thanks.

Hi again. I’ve tested some more today and it happened that the MQTT Device Creator was still showing as connected, again not trying to reconnect even after pressing Refresh. If it is actually connected then the Refresh works. I’ve found some reference from 2016 that said the ST hub would not reconnect after a router restart which is somehow what I experience. Since this MQTT connection is the only TCP/IP connection I have on the hub it looks it is still happening in 2024. Something is not right in the hub for sure.

For the time being I’ve created a simple watchdog logic to notify me when the MQTT connection is actually down. (one MQTT switch publishing, one MQTT contact subscribed to the same topic, every 30 sec a routine which flips the switch and a routine which waits 5 minutes and if no change in contact position it notifies me that the MQTT is down). I then can manually connect to IDE and restart the hub.

In my home automation this MQTT connection is extremely important especially when not at home as it handles my security with BlueIris AI person detection. If anybody is interested I can detail how it works.

1 Like