MQTT Bridge [device + app]

smartapp_misc
mqtt

(Kevin Tierney) #325

Your config looks correct. Here’s one of mine (it’s just an on/off switch)

image

Open up the ST live logging and then try turning it on/off from home assistant. Do you get anything in the log?


(Radu Ovanesian) #326

I din’t get anything in the ST live logs when I turned on/off the switch .
Thanks !


(Radu Ovanesian) #327

I tried everything I can to make this work but HA doesn’t send any commands to ST, but receives from ST.
What I’ve tried:

  1. Deleted the ST device, smart app and device handler and installed them again, according to instructions.
  2. Checked the MAC address on ST device and it matches the one I inserted.
  3. Watched the ST live logs and nothing is coming from the HA to ST
  4. Uninstalled the MQTT bridge and MQTT broker and reinstalled them
  5. I was watching the MQTT traffic over SSH and the commands from the HA switch are received in the broker but not in the bridge, so this might be the problem - the bridge !

Anybody can think of something else that might get the HA to send the commands back to ST ? When I tap on a switch in HA, I can see the message in MQTT broker, but it doesn’t show on the bridge.
The messages from ST to HA are shown in bridge.
Thank you !


#328

I tried all kinds of things to get this to work reliably and just when I think it is working the wheels fall off. I have the same issue ST actions show up in HA with no issue but half the time HA actions back to ST don’t work. I end up checking the logs on the MQTT bridge and it just says it is a duplicate message and ignores it, even though it isn’t a duplicate message. Click the ON in HA and it just toggles to ON then OFF but never turns the light on. I kind of gave up on it. I tried the retain:true retain:false changes, changes in MQTT itself, nothing seems to work.


(Radu Ovanesian) #329

I just noticed this: Connecting to MQTT at mqtt://localhost:1883
Is this ok (the mqtt://) ?

Log:
info: Connecting to MQTT at mqtt://localhost:1883
info: Configuring autosave
info: Configuring API
info: Listening at http://localhost:8080


(Bobby Boucher) #330

I’m getting a lot of duplicate messages like this:
info: Incoming message from MQTT: smartthings/Front Bedroom Thermostat/temperature = 71.5
info: Skipping duplicate message from: smartthings/Front Bedroom Thermostat/temperature = 71.5

is this normal?


(Peter Galbavy) #331

I’m up and running after much head scratching and problems with the npm registry access but was wondering if there is a way to make the loggin less verbose? Running on RPi (in this case with an HDD) I would want to minimise SD card writes except for real errors. I can and do use tmpfs, but… ?


#332

A little help please, if anyone could. I have a couple of Aeon Minimotes and each has child devices in Smartthings for each of the 4 buttons which I have selected as buttons in MQTT Bridge.

I get messages of the format:
smartthings/Minimote button 1/button : pushed
smartthings/Minimote button 1/button : held
but no message when released, so I think my automations will get bunged up.

Any workaround for this?
Thanks


#333

For now, I’ve made a flow in Node-RED to take the incoming MQTT and reformat the topic as either:

smartthings/Minimote button 1/button pushed
or
smartthings/Minimote button 1/button held
in both cases with payload “active”, followed 2 seconds later by another message “inactive”.

It’s a bit clunky though. Better ideas would be welcome.


#334

So is it possible to have a device in MQTT displayed in SmartThings?

I have some BLE devices that I have sending updates to a MQTT broker. Is it possible to send those updates from MQTT to SmartThings and create a virtual device with the data?


(xbb1024) #336

I’m new to SmartThings. What is Docker and how do I install it?


(Peter Galbavy) #337

Docker is not a SmartThings tech, it’s a general “container” technology used by more and more people (except me) for development, testing and prototyping. It can be used for “production” systems, and often is, but there are things to that well outside the scope of this thread. Start at docker.com


(xbb1024) #338

Thanks. I tried to install Docker on my Synology NAS but my particular model doesn’t support it. Instead, I installed mosquitto via a package from the synoCommunity. Now I’m not sure what to do next to configure it (the package created the following files below):

admin@NAS1:/var/packages/mosquitto$ ls
conf enabled etc INFO scripts target
admin@NAS1:/var/packages/mosquitto$ cd conf
admin@NAS1:/var/packages/mosquitto/conf$ ls -l
total 16
-rw-r–r-- 1 root root 87 Jan 20 2018 mosquitto.sc
-rw-r–r-- 1 root root 391 Jan 20 2018 privilege
-rw------- 1 root root 18 Aug 5 18:32 resource
-rw------- 1 root root 27 Aug 5 18:37 resource.own
admin@NAS1:/var/packages/mosquitto/conf$

update: i found my conf file:

admin@NAS1:/var/packages/mosquitto/target/var$ ls
mosquitto.conf mosquitto_install.log mosquitto.log mosquitto.pid

update 2: Trying to npm the smartthings-mqtt-bridge gets me this:

npm ERR! peerinvalid The package joi@13.5.2 does not satisfy its siblings’ peerDependencies requirements!
npm ERR! peerinvalid Peer express-joi-validator@2.0.0 wants joi@6.x.x


#339

@xbb1024, Docker/mosquitto are enabling technologies. What are you actually trying to do?


(xbb1024) #340

hi, I’ve learned a bit more since my last post. At first, all I wanted was for my mqtt devices to communicate directly with Smartthings.

My new plan is to set up Home Assistant on a raspberry pi and follow a guide I found to make that communicate with Smartthings.


(David Martinez) #341

Maybe I’m seeing something incorrect, but I figured this was the thread to bring my situation up in. If needed, I will create a seperate thread…

I recently switched from ST -> HA, then back to ST, when the wife wasn’t quite ready for DIY Home Automation. I was running HA on my Pi3, with the ST-MQTT bridge, and it worked perfectly.

I’m repurposing the Pi for running Node.JS/MQTT now, and having an issue getting ST to pass messages to the bridge. I’ve setup the bridge correctly in NPM, and it shows listening at localhost:2271 in the log as expected. I’ve verified that MQTT is running correctly using a MQTT browser on a laptop.

In the IDE logs, I’m seeing this error, which leads me to beleive something is off since I had removed, then re-added the MQTT bridge device in ST.

 3:34:00 PM: error grails.validation.ValidationException: Validation Error(s) occurred during save():
- Field error in object 'physicalgraph.device.Device' on field 'deviceNetworkId': rejected value [B827EBDA4875]; codes [physicalgraph.device.Device.deviceNetworkId.unique.error.physicalgraph.device.Device.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.error.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.error.java.lang.String,physicalgraph.device.Device.deviceNetworkId.unique.error,device.deviceNetworkId.unique.error.physicalgraph.device.Device.deviceNetworkId,device.deviceNetworkId.unique.error.deviceNetworkId,device.deviceNetworkId.unique.error.java.lang.String,device.deviceNetworkId.unique.error,physicalgraph.device.Device.deviceNetworkId.unique.physicalgraph.device.Device.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.deviceNetworkId,physicalgraph.device.Device.deviceNetworkId.unique.java.lang.String,physicalgraph.device.Device.deviceNetworkId.unique,device.deviceNetworkId.unique.physicalgraph.device.Device.deviceNetworkId,device.deviceNetworkId.unique.deviceNetworkId,device.deviceNetworkId.unique.java.lang.String,device.deviceNetworkId.unique,unique.physicalgraph.device.Device.deviceNetworkId,unique.deviceNetworkId,unique.java.lang.String,unique]; arguments [deviceNetworkId,class physicalgraph.device.Device,B827EBDA4875]; default message [{0} must be unique]
@line 569 (inputHandler)

Based on reading this thread, I can see that the device network ID should be replaced automatically by the MAC address, and that seems to be where it’s failing. Is there any fix for this? Or would it require a full reimage of my hub?

UPDATE: Tried updating the device network ID manually, and got the below error.

Error

500: Internal Server Error

URI

/device/update

Reference Id

9bc097a7-faec-4e97-9094-fbd757677e69

Date

Mon Oct 29 20:05:47 UTC 2018

#342

I have ran into a strange issue I cannot figure out. I have dozens of smartthings devices communicating with Smartthings-MQTT-Bridge with no issues. I can communicate both directions no problem. I recently added 4 Iris Smart Plugs to the bridge with switch, power and energy capabilities. I can control the switch on one with mqtt commands but the other three will not respond. SmartThings IDE logging shows no communication. When I switch these three devices on and off using the smartthings app, their state changes within home assistant and I can see the messages when subscribed to them.

And ideas what I can check to determine why smartthings-mqtt-bridge is not responding to the messages? I’ve looked though the logs on my PC for the bridge and I see no issues.


#343

I guess you can disregard this. All of a sudden, it started working for these three devices.


#344

I discovered that the mqtt -> smartthings issue still exists. I tracked it down to the smartthings-mqtt-bridge state.json file missing the subscriptions for new devices.

First thing I did was delete the file and restart smartthings-mqtt-bridge opened and saved the smartapp. state.json never updated. Next, I manually edited state.json and added the missing subscriptions and immediately, communication from mqtt back to smartthings stated working.

I have no errors in any logs so I’m not sure why it’s not working. I haven’t yet looked into the smartthings-mqtt-bridge code to see what’s happening but figured since so many others have had this issue, I’d pass along what I found.


(Jay S) #345

Where did you find this file?