Integration Solutions using MQTT

I’m going to look at periodic resubscribes but technically they shouldn’t be necessary.

What kind of hub do you have?

What is your broker running on? You may also have network problems. Is the machine running your broker under the same router as your hub? Are they both within the same subnet?

Do you have any firewalls, VLANs, VMs, Docker Containers, etc that could be blocking traffic?

1 Like

What kind of hub do you have?
Smartthings wifi

What is your broker running on?
The broker is on home assistant that is running on an odroid board that is the same network as the smartthings wifi hub same subnet

Do you have any firewalls, VLANs, VMs, Docker Containers, etc that could be blocking traffic?

I hate to say it but the wifi mesh hubs have had a lot of trouble with Edge LAN drivers. It’s been reported to SmartThings, but there have been no answers.

It is also possible there is a problem with the HA’s broker. I seem to recall someone else trying to use that and they ended up having to install a separate Mosquitto broker because they were having similar problems.

Do you have anything else you can use to do a long-term test of the MQTT broker connection? Perhaps something like MQTT explorer. You just need something that subscribes to the particular topic and then you leave it running for several days to see if it continues to receive published messages from your broker. Even something like mosquitto_sub could be used, and redirect the output to a file. If that also fails, then we’d know that the problem is not in the Edge driver but rather with your HA broker or the network.

1 Like

Hi - I haven’t heard back from you so, your request is on hold for now. If you are still wanting a generic string device, please reply to the questions I had for you above. Thanks.

Hi - Following up with you on adding illuminance and battery to the MQTT motion device.

How do you anticipate formatting the MQTT message coming from your device? Would it be in one published message with JSON format, something like this?:

  "motion": <active/inactive>,
  "lightlevel": nnnn,
  "batterylevel":  nn

Or would your device publish separate MQTT messages for each of the 3 possible values?

Yes publishing in one payload would be nice!

All of my motion devices send single payloads with JSON formatting similar to your example

I think I will tap out at this point, I will maybe switch to a Samsung hub at some point in the future as I think you’re right. That is the most probable cause.

Hi! I’m interested in using this to connect my arduino projects to smartthings with raspberry. Could I control RGB lights with this? Or could I read temperature and humidity from my weather station?

Hi - I don’t have an RGB device right now, but it may be possible to add. There is a temperature device, and I’m about to release an updated driver with a humidity device.

1 Like

All MQTT Devices driver users: I have pushed out an update to the driver with additional device type support:

  • Humidity (relativeHumidityMeasurement)
  • MotionPlus - includes motionSensor, illuminanceMeasurement, and battery
  • Energy (energyMeter)
  • Text (accepts any text string)

You will need to delete your existing MQTT Device Creator device and then do an Add device / Scan for nearby devices in order to recreate it and have access to the new device types. You will also have to re-enter your broker config in device Settings.

If you don’t care about these new device types, then no action is needed.

Driver Version: 2023-01-05T23:42:33.582130777


Okay thanks for your answer! RGB would be cool.

Just so I’m clear, which direction are you trying to go? Do you have an RGB device outside of SmartThings that you want to control from a SmartThings ‘virtual’ device?

To anyone installing the Mosquitto broker, @wptracy found a very interesting recent change in the way it is installed now: by default it does not allow connections from outside the box. If anyone is having a problem getting any of the MQTT drivers to connect to the broker, this could be the issue. It’s a simple change to the configuration to make it work.

Please see THIS POST for details.

Thanks to @wtracy for posting.

1 Like

I got this version today and started to see it fails to create new devices. I checked logcat but no error is logged. In the app it just hangs and then shows me network error after a while and no device is created. Can you please check if there is any regression?

FYI, I haven’t done anything you mentioned to get the new features yet. The Text sounds really nice and would simplify my current rules about sonos alarms a lot, cant wait to check it out

Did you delete the Master Creator device and create a new one with an Add device / Scsn for new devices?

No i haven’t. Maybe i misunderstood the update. So if Im not yet to create any of those new type I still need to delete the Creator before I can create some other old device types like switch or button?

Question- If I delete the current master Creater device will all my devices created by the old Creator be deleted too?

No it’s safe to delete without affecting your other existing devices.

Herbert_Chen. I had this same problem after the previous update. By trial and error I discovered I had to uninstall/reinstall the mqtt Creator. All is fine. No loss of previous devices.

1 Like

Gotcha, I’ll try it!