Help Smartthings/Docker/unRAID installation - almost there

I’ve been using HA for about 4 days and I’ve got almost all my devices configured, except for the big one - Smartthings.

I’ve followed this post https://home-assistant.io/blog/2016/02/09/Smarter-Smart-Things-with-MQTT-and-Home-Assistant/ and it looks like I’m almost there as the logs of my smartthings-mqtt-bridge is showing activity entries like:

info: Incoming message from SmartThings: smartthings/Motion - Front Room Window/temperature = 20
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = active
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = inactive
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = active
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = inactive
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = active
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = inactive
info: Incoming message from SmartThings: smartthings/Motion - Front Room Middle/motion = active

but my smartthings devices aren’t showing in HA - I’m so close I think. Can someone help please?

unraid docker settings:

configuration.yaml:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: xxxxxxxx
  longitude: xxxxxxxxxxxxx
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 150
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/London

# Show links to resources in log and frontend
# introduction:

# Enables the frontend
frontend:

http:
  # Uncomment this to add a password (recommended!)
  # api_password: PASSWORD
  # Uncomment this if you are using SSL or running in Docker etc
  # base_url: example.duckdns.org:8123

# Checks for available updates
updater:

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time.
history:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Weather Prediction
sensor:
  platform: yr

# Text to speech
tts:
  platform: google

#MQTT
mqtt:
  broker: 192.168.1.10
  port: 8082
 

media_player:
  - platform: cast
  - platform: plex
  - platform: yamaha
    source_names:
      AV1: "Amazon FireTV"
      AV2: "YouView"
      AV3: "Chromecast" 

#Switches
switch:
  - platform: tplink
    host: 192.168.1.83
    name: lamp_window
  - platform: tplink
    host: 192.168.1.85
    name: lamp_clear

#Groups
group:
  bedroom: media_player.dz_bedroom
  living room: media_player.front_room, switch.lamp_window, switch.lamp_clear, media_player.yamaha_receiver
  playroom: media_player.play_fire_aftm
#Sensors
# sensor:
# - platform: plex

config.yml


mqtt:
# Specify your MQTT Broker’s hostname or IP address here
host: 192.168.1.10
# 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: AzureDiamond
# password: hunter2

Port number to listen on

port: 8080

Thanks in advance for any help.

pleading for help please. So frustrating as I can see that the bridge is picking up activity from my smartthings hub, but the information just isn’t making it through to HA.

I’m probably doing something basic that’s wrong - I just need a few pointers and then I concentrate on automation

I am in the same boat trying to get it going on unraid. But i am not even seeing the hits in the log so i must be doing something wrong too. That being said i am noticing your switch config doesnt look right in HA. It is missing payload, state and command topics and if you have dimming brightness. Also isnt the platform always going to be mqtt? And a question for you and maybe why mine isnt working. Why isnt your MQTT on the default port of 1883?

Here is how i am going to have my dimmer setup:
switch:
platform: mqtt
name: “Basement Back”
state_topic: “smartthings/Basement Back/switch”
command_topic: “smartthings/Basement Back/switch”
brightness_state_topic: “smartthings/Basement Back/level”
brightness_command_topic: “smartthings/Basement Back/level”
payload_on: “on”
payload_off: “off”
retain: true

Hi Tim - it’s your lucky day! I’ve just logged onto this forum for the first time today in a long time.

I had another crack at HA about 4 months ago and I got it all working. It’s a lot easier if you are on 6.4 and can assign IP addresses to all dockers

  1. Install MQTT docker:

(i also use this for owntracks i.e. owntracks–>MQTT–>HA)

  1. Install Smarthings-MQTT Bridge docker

  1. Edit bridge config.yml file appdata/smatthings-mqtt-bridge\config.yml

  1. get the mac address of the bridge docker using SSH

docker inspect smartthings-mqtt-bridge

  1. go to smarthings IDE and the device as per this page https://home-assistant.io/blog/2016/02/09/Smarter-Smart-Things-with-MQTT-and-Home-Assistant/

    MQTT Bridge IP Address: IP address of Bridge Docker
    MQTT Bridge Port: 8080
    MQTT Bridge MAC Address: mac address from 4

  2. In your configuaration.yaml put:

    mqtt:
    broker: IP address of MQTT docker
    discovery: true
    discovery_prefix: smartthings
    username: !secret mqtt_username
    password: !secret mqtt_password

and add devices e.g. Plug

switch:
  - platform: mqtt
    name: "PL"
    state_topic: "smartthings/NAME_IN_SMARTTHINGS/switch"
    command_topic: "smartthings/NAME_IN_SMARTTHINGS/switch"
    payload_on: "on"
    payload_off: "off"
    retain: true

Motion Sensor:

binary_sensor:
  - platform: mqtt
    name: "Motion Living Top"
    state_topic: "smartthings/Motion - Front Room Top/motion"
    command_topic: "smartthings/Motion - Front Room Top/motion"
    payload_on: "active"
    payload_off: "inactive"
    retain: true

If you check the MQTT or bridge logs you’ll see the relevant MQTT details to enter for each payload.

Occasionally, the flow ST<->Bridge<–>MQTT<–>HA breaks down, usually all works flowing to HA, but not back i.e. breaking at the Bridge–>ST stage. When this happens I double-check the mac address hasn’t changed (it seems to if you change the docker IP address)

Thank you this is helpful! I have a couple of questions though:

  1. I found the passwords.txt file but MQTT folder keeps having files disappear. Is there a chmod that needs to be done that will keep it permanently? I am also not seeing any logs.

  2. The bridge in the logs says it is listening on localhost. I have set different ip addresses for all three dockers. Is localhost ok?

  3. what format for the mac address is needed? xx:xx:xx etc… or xxxx.xxxx.xxxx or xxxxxxx?

Also is there anything special about the port for HA?

  1. I didn’t bother with adding a password for MQTT - so I just added my IP, preface and port to the config.yml for the Bridge.

Edit: if you mean the !secret mqtt_username bit, I’ve got a secrets.yaml file with all my passwords in Storing secrets - Home Assistant . you can just add the password etc to your configuration.yaml file if you want, but I try to put all in my secrets file as it makes it easier to share stuff
2. If this is what you are referring to, then it’s fine as it works!

[email protected] start /usr/src/app
node server.js

info: Starting SmartThings MQTT Bridge - v2.0.0
info: Loading configuration
info: Loading previous state
info: Perfoming configuration migration
info: Saving current state
info: Connecting to MQTT at mqtt://192.168.50.83
info: Configuring autosave
info: Configuring API
**info: Listening at http://localhost:8080**
  1. I paste mine in with colons, but I think it works without as well
  2. Nope, just install the HA docker on its own IP address

Ugg this is killing me. Do you see any activity in your bridge logs when you trigger devices?

I see this in MQTT when flipping switch in Home Assistant:
1516989590: Received PUBLISH from 6e09131a-8296-4f51-9272-6d1576e5d08f (d0, q0, r1, m0, 'smartthings/Basement Back/switch', ... (2 bytes))
1516989590: Sending PUBLISH to 6e09131a-8296-4f51-9272-6d1576e5d08f (d0, q0, r0, m0, 'smartthings/Basement Back/switch', ... (2 bytes))

But i see nothing change in the bridge logs and it does not turn on and off the switch.

Here is my HA config: switch (zwave zoos24 v2 switch)
mqtt:
broker: 192.168.69.90
discovery: true
discovery_prefix: smartthings
username: mynameredacted
password: mypassredacted
switch:
platform: mqtt
name: “Basement Back”
state_topic: “smartthings/Basement Back/switch”
command_topic: “smartthings/Basement Back/switch”
brightness_state_topic: “smartthings/Basement Back/level”
brightness_command_topic: “smartthings/Basement Back/level”
payload_on: “on”
payload_off: “off”
retain: true

Maybe it is my smartthings config? I didnt see anything in instructions about device ID after he says to use random numbers because we will address this later.

another thing i discovered is i cannot ping the dockers from the unraid terminal but i can elsewhere on the network. Does that matter?

Do you see anything going the other way when you operate the switch from ST? As I said, it tends to be the Bridge–>ST stage that falls down when you check all the steps one at a time i.e. HA–>MQTT MQTT–>Bridge.

If it is failing at the bridge–>ST stage, check the smartapp is setup correctly and also try posting the mac address with and without colons.

Ooooh i am so close. I deleted everything and started from scratch. I can see the commands coming to my bridge log both ways now which i could not before.

But i am getting a weird error from my hub itself when i initiate a command from HA:

info: Incoming message from MQTT: smartthings/Basement Back/switch = on
error: Error from SmartThings Hub: Error: connect ECONNREFUSED 192.168.69.181:39500

error: {

"code": "ECONNREFUSED",
"errno": "ECONNREFUSED",
"syscall": "connect",
"address": "192.168.69.181",
"port": 39500
}
error:

I am still confused by credentials so i have not used any secrets or usernames. Do i need my smartthings username and password somewhere?

Not sure what that error message - maybe it’s just related to that switch? What type is it? Check the MQTT Switch support as maybe you’re trying to pass something that’s not supported e.g. I have lights that don’t support colour temp MQTT Switch - Home Assistant

Sorry, I forgot to add how to create a MQTT password

Passwords for Mosquitto

Mosquitto likes encrypted passwords, but these are difficult create for a docker instance.
In the mosquitto.conf file, you will see the password file is called passwords.mqtt. Do not change this.

To add passwords to the MQTT instance, just store a file called passwords.txt in this directory and restart the docker.
The passwords will be encrypted and stored in passwords.mqtt and the old passwords.txt file will be deleted.

The contents of passwords.txt should look like this:

bob:bobpassword
fred:fredpassword

The new passwords are added to the top of password.mqtt when they are encrypted. MQTT uses the first username/password
combo that it finds. You can delete the old passwords manually if you wish.
Other than that you don’t need to enter any others (and the MQTT password is optional as well).

Have you followed the Smartthings steps here? Smarter SmartThings with MQTT and Home Assistant - Home Assistant If you’re getting flows both ways into the Bridge then you should have it working/be almost there as HA–>MQTT–>Bridge and ST–>Bridge , which is the hardest flow.

I did it! Not sure what was wrong but i recreated the samsung device and included home away and night, gave it a new name, AND rebooted the hub. I think the key was rebooting the hub. But whatever it was I am now using smartthings to turn off lights in basement. Now to learn automation and integration. And try and figure out how to get my go control to open and close via home assistant!

1 Like

Good news. Once you’ve created a few automations you’ll get the hang of it and can build up

DZMM - you are a genius. I’ve spent the last 3 days trying to make this work. Thank you SO much.

The only thing I still can’t get to work is the discovery process. I’ve got:

mqtt:
broker: 192.168.0.10
discovery: true
discovery_prefix: smartthings

It doesn’t find anything. I can get to Smartthings devices via this bridge in HASS, when i manually add them to configuration.yaml

Any thoughts?

Discovery doesn’t work with smartthing devices through mqtt.