I try to connect my HA with ST by mosquitto and MQTT bridge. I install mosquitto and bridge in one pi with raspbian IP 192.168.1.12, and HA in another pi 192.168.1.11.
After install mosquitto, npm and node, I follow this guide to install mqtt bridge: GitHub - stjohnjohnson/smartthings-mqtt-bridge: Bridge between SmartThings and MQTT.
sudo npm install -g smartthings-mqtt-bridge sudo npm install pm2@latest -g
pm2 start smartthings-mqtt-bridge sudo nano config.yml
---
mqtt:
# Specify your MQTT Broker URL here
host: mqtt://localhost
# Example from CloudMQTT
# host: mqtt:///m10.cloudmqtt.com:19427
# Preface for the topics $PREFACE/$DEVICE_NAME/$PROPERTY
preface: smartthings
# Suffix for the state topics $PREFACE/$DEVICE_NAME/$PROPERTY/$STATE_SUFFIX
# state_suffix: state
# Suffix for the command topics $PREFACE/$DEVICE_NAME/$PROPERTY/$COMMAND_SUFFIX
# command_suffix: cmd
# Other optional settings from https://www.npmjs.com/package/mqtt#mqttclientstreambuilder-options
username: mosquitto username
password: mosquitto password
# Port number to listen on
port: 8080
pm2 restart smartthings-mqtt-bridge
Then set up the Device Handler, Smart App IDE, and MQTT device
ip: 192.168.1.12
port: 8080
mac: 12ab34cd56ef
The MQTT bridge is available on the Smartthings App, it display as a grey “OK”.
I try to use this command to check the activity of the device:
pm2 logs smartthings-mqtt-bridge
But there is only some basic connecting information and without any response for my motion sensor and simulate switch.
I use this command to check the usage of ports
sudo netstat -tulpn
It seems that the mqtt-bridge listen 8080 at ipv6 only. I am not sure it is the problem or not.