Raspbian home asssitant mqtt broker and samsung smartthings not working

Hi,

With already existing many issues on the same topic which i checked as well, i couldn’t find a solution to make this work. I followed the steps below in the below link

I also referred the below youtube link

and many more but i still can’t make it work.

Steps done:

  1. Installed raspbian
  2. sudo apt-get update and sudo apt-get upgrade -y
  3. installed hass as mentioned in getting started
    which works fine :slight_smile:
  4. Then i proceeded to installing mqtt. first i installed using command
    sudo apt-get mosquitto mosquitto-clients
  5. Due to inconsistency as tried before on raspberry pi, i installed mqtt bridge via npm instead of docker
  6. I created mqtt-bridge directory in /opt and in it i created the mqtt config.yml with the below content
---
mqtt:
    # Specify your MQTT Broker URL here
    host: 192.168.0.122
    # Example from CloudMQTT
    # host: mqtt:///m10.cloudmqtt.com:19427

    # Preface for the topics $PREFACE/$DEVICE_NAME/$PROPERTY
    preface: smartthings

    # The write and read suffixes need to be different to be able to differentiate when state comes from SmartThings or when its coming from the physical device/application

    # Suffix for the topics that receive state from SmartThings $PREFACE/$DEVICE_NAME/$PROPERTY/$STATE_READ_SUFFIX
    # Your physical device or application should subscribe to this topic to get updated status from SmartThings
    # state_read_suffix: state

    # Suffix for the topics to send state back to SmartThings $PREFACE/$DEVICE_NAME/$PROPERTY/$STATE_WRITE_SUFFIX
    # your physical device or application should write to this topic to update the state of SmartThings devices that support setStatus
    # state_write_suffix: set_state

    # Suffix for the command topics $PREFACE/$DEVICE_NAME/$PROPERTY/$COMMAND_SUFFIX
    # command_suffix: cmd

    # Other optional settings from 
    username: kv
    password: kv

    # MQTT retains state changes be default, retain mode can be disabled:
    # retain: false

# Port number to listen on
port: 8081

right now the points are :

  1. yes, i changed port to 8081 since it was mentioned in a blog that hass would use 8080 hence,changed to 8081 and yes , it is the same on the samsung smartthings IDE

  2. yes, i tried the host with various styles as local host, mqtt://localhost,192.168.0.122,mqtt://192.168.0.122,192.168.0.122:1883 and mqtt://192.168.0.122:1883

  3. yes, the spacings in the file are right and i didn’t get any error with respect to the file

  4. I execute the bridge through command pm2 start smartthings-mqtt-bridge, restart and logs commands as well
    8 After changing ownerships and fixing previous access error such as access denied /opt/state.json , the only recent error pending is with line preface: smartthings and i don’t know the reason for the same.

  5. I start with commands
    pm2 start smartthings-mqtt-bridge
    pm2 logs smartthings-mqtt-bridge
    The last output is

> home/pi/.pm2/logs/smartthings-mqtt-bridge-out.log last 15 lines:
> 
> 0|smartthi | info: Starting SmartThings MQTT Bridge - v3.0.0
> 
> 0|smartthi | info: Loading configuration
> 
> 0|smartthi | info: Loading previous state
> 
> 0|smartthi | info: Perfoming configuration migration
> 
> 0|smartthi | info: Saving current state
> 
> 0|smartthi | info: Connecting to MQTT at mqtt://[192.168.0.122](http://192.168.0.122/)
> 
> 0|smartthi | info: Configuring autosave
> 
> 0|smartthi | info: Configuring API
> 
> 0|smartthi | info: Listening at [http://localhost:8081](http://localhost:8081/)
> 
> 0|smartthi | info: Starting SmartThings MQTT Bridge - v3.0.0
> 
> 0|smartthi | info: Loading configuration
> 
> 0|smartthi | info: Loading previous state
> 
> 0|smartthi | info: Perfoming configuration migration
> 
> 0|smartthi | info: Saving current state
> 
> 0|smartthi | info: Connecting to MQTT at mqtt://[192.168.0.122](http://192.168.0.122/)
> 
> 0|smartthings-mqtt-bridge  | info: Configuring autosave
> 
> 0|smartthings-mqtt-bridge  | info: Configuring API
> 
> 0|smartthings-mqtt-bridge  | info: Listening at [http://localhost:8081](http://localhost:8081/)
> 
> 0|smartthings-mqtt-bridge  | info: Saving current state
  1. Next , home assistant last config for mqtt is

mqtt:
broker: localhost
protocol: 3.1
keepalive: 60
client_id: hass-1
username: kv
password: kv

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

I changed the broker as mentioned before range from localhost to 192.168.0.122 but nothing worked.
I am not sure about the state topic(i do not understand to where to get it) but it runs without errors on the ui
.The spacing are right and no error

I ran it multiple times but in vain.
The only thing works is on the smart app mqtt bridge, in recent actvity i could see “send mqtt device notification to mqtt bridge” but i don’t know what happens after that.

The hub is connected through LAN and raspberry pi is connected to a vodafone wifi so that i can have control and do not have security blocks alike in company network.

On changing settings, in the code (like changing ip address) i restart everything in the order
sudo systemctl restart mosquitto.service
pm2 restart smartthings…
hass

FYI: I AM RUNNING BOTH HASS AND MQTT BROKER ON THE PI ITSELF !

Also, i made all the changes required to be done on the smartthings ide as mentioned in the link perfectly. I’ve updated IP address,port and mac address (without colons ) perfectly.

I really don’t know whats the problem . Can some one please help me to solve this problem