We need to get to the bottom of why your driver seems to be losing connection with the broker, if indeed that is what is happening. And yes, we will need to run logs over a 24 hour period so we can catch any errors that are happening. Do you have the CLI installed? If you can run it on a Windows machine, simply download and run the install file here.
Once you have that, send me a direct message and I’ll walk you through getting the logging going so we can diagnose this.
Are you using the MQTT Discovery/Handler Edge driver? Can you please post your device Settings for the MQTT Discovery device so we can see how you have it configured?
Did you actually get the MQTT switch device created already? You would have had to do that by using an MQTT client like this:
(Note the actual message payload doesn’t matter. )
If your MQTT Discovery device is properly configured and connected to your broker, once you publish that message, a new MQTT switch device should be created in your SmartThings ‘No room assigned’ room.
Only if you’ve successfully complete those steps, can you expect to have the message published from Node Red trigger the switch device.
@gst is correct. The way you need to send your message is as follows:
Topic: “smartthings/switch/fan/state”
Message payload = “on”
and
Topic: “smartthings/switch/fan/state”
Message payload = “off”
This is assuming you are using the MQTT Discovery driver, which I’m not 100% sure of! If I’m wrong about that, please let me know and disregard this and my prior post!
Hold up! You have two different drivers going on the SmartThings side so I think you have things a bit confused.
The driver you are using for your device called MQTT Switch is one that I’ve just been developing, and haven’t even made public yet, so I’m surprised you even found that. I’m going to direct message you so we can sort this out.
I’m sharing a new MQTT driver today - MQTT Devices V1 - that addresses a use case not covered by my previous MQTT drivers: specifically, cases where the MQTT topic used by your device or application cannot be configured. One example is Tasmota devices that publish MQTT messages to a specific topic and respond to messages on a specific topic.
How is this different from the MQTT Handler/Discover driver?
The MQTT Handler/Discovery driver requires messages to be published to a specific topic format (starting with ‘smartthings/’), and was implemented as a SmartThings version of the Home Assistant MQTT Discovery feature. It allows for devices that support HA’s implementation to be integrated with SmartThings. Another feature is that a new SmartThings device is created by sending an MQTT message with a specific topic format.
With the new driver (MQTT Devices V1), devices are created within the SmartThings mobile app using a ‘master’ creator device (not unlike my vEdge driver) and then are individually configured to respond to whatever topic string you want. It supports MQTT messages that are JSON-formatted, as well as simple strings.
Initially, the new driver supports Switch, Momentary Button, Contact, and Motion type devices, with more to come. The Switch and Button devices can also be configured to publish MQTT messages when the switch or button state is changed within SmartThings.
For more information, please see the README file in the github repository.
Thanks go out to @gst and @montyfert for being initial testers of this new driver.
hi @TAustin, is it requires mqtt broker or it can connect directly? I don’t have experience with it. But read than it easier way to connect any device directly to home assistant. Just curious if it has a same way to connect with smartthings ?
Sorry for the delay. I have CLI installed now, however, today I have the MQTT running flawlessly for 36 hours already. I wonder if the hub FW upgrade did something. I’ll ping you in the direct messages if I see the issue again.
Thanks. I try to configure V1 in the device settings menu. It requires me to provide a ip-adres with a minimum of 10 characters. What about the following alternative? 10.0.0.9 has only 8 characters
Is it possible to change this?
You’ve really outdone yourself with this one. This is essentially what I’ve been looking for all wrapped up in a neat little package. I don’t think I’d still be on the SmartThings platform if it wasn’t for you and your excellent code. A sincere thank you for all that you do for the community is in order!
HA doesn’t have a broker built in per se, but one can easily use the add-on store to install the Mosquitto broker (as long as you’re running Home Assistant with Supervisor).
Been testing this out for the last hour or so and so far I’ve really only had one hiccup. Looks like there’s a limit of 32 characters for the subscribe topic, and I have several devices that have topics that are longer.
Is the 32 char limit a ST thing, or is it something that you could increase on your end?
Otherwise I’m blown away at how freaking awesome this is!