stjohnjohnson / smartthings-mqtt-bridge

Bridge between SmartThings and MQTT
https://hub.docker.com/r/stjohnjohnson/smartthings-mqtt-bridge/
MIT License
368 stars 243 forks source link

can't seem to get this to work #158

Closed evanrich closed 6 years ago

evanrich commented 6 years ago

Just bought a smartthings hub today, found this and tried to follow directions... i can't seem to make it work though (home assistant just toggles lock/unlock without doing anything to the door)

mqtt logs:

{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542352901,"msg":"server started","mqtt":1883,"http":80,"v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542353122,"msg":"client connected","client":"mqttjs_15875a67","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542404712,"msg":"client connected","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542404714,"msg":"subscribed to topic","topic":"smartthings/Front Door Lock/set","qos":0,"client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542548703,"msg":"unsubscribed","topic":"smartthings/Front Door Lock/set","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542548704,"msg":"closed","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542626115,"msg":"client connected","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542627590,"msg":"subscribed to topic","topic":"smartthings/Front Door Lock/set","qos":0,"client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542719738,"msg":"unsubscribed","topic":"smartthings/Front Door Lock/set","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542719738,"msg":"closed","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542796212,"msg":"client connected","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542797517,"msg":"subscribed to topic","topic":"smartthings/Front Door Lock/","qos":0,"client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542803088,"msg":"unsubscribed","topic":"smartthings/Front Door Lock/","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542803089,"msg":"closed","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542805672,"msg":"client connected","client":"","v":1}
{"pid":1,"hostname":"mqtt-5d764fd6df-rnhdg","name":"mosca","level":30,"time":1531542807651,"msg":"subscribed to topic","topic":"smartthings/Front Door Lock/","qos":0,"client":"","v":1}

MQTT-BRIDGE logs

info: Starting SmartThings MQTT Bridge - v3.0.0
info: Loading configuration
info: Loading previous state
info: Perfoming configuration migration
info: Saving current state
info: Connecting to MQTT at mqtt://localhost
info: Configuring autosave
info: Configuring API
info: Listening at http://localhost:8080
info: Saving current state

I'm running this in kubernetes, so I created a nodePort and put the following in for the device preferences:

IP: 192.168.1.20 (IP of the K8s node) mac: aa:bb:cc:dd:ee:ff (mac of the primary interface of the kubernetes node) port: 31334 (node port config)

Here's the service.yaml for k8s:

apiVersion: v1
kind: Service
metadata:
  name: mqtt
spec:
  selector:
    app: mqtt
  type: NodePort
  ports:
  - name: mqtt
    port: 1883
    targetPort: 1883
    nodePort: 31333
  - name: mqtt-bridge
    port: 8080
    targetPort: 8080
    nodePort: 31334

so 31334 on any node should go to port 8080

my home assistant config (lock.yaml)

 - platform: mqtt
    name: Frontdoor
    state_topic: "smartthings/Front Door Lock/"
    command_topic: "smartthings/Front Door Lock/set"
    payload_lock: "LOCK"
    payload_unlock: "UNLOCK"
    retain: true

any help would be hugely appreciated. The app shows "OK" for the bridge, but it's greyed out and i can't seem to do anything except view it or save it, unlike the docs that say "configure it and it will begin 2way auth

evanrich commented 6 years ago

update 1.) sorta got it from another post somewhere, had to associate with the market place (my devices). Now, I see messages in the MQTT, but pressing buttons in HA doesn't unlock/lock my door.

evanrich commented 6 years ago

closing this finally got it to work. Had to use the MAC of the physical adapter, lowercase and maybe afew other things. but it works now.