dale3h / hue-mqtt-bridge

MQTT bridge for Philips Hue Dimmer and Hue Tap
MIT License
51 stars 6 forks source link

MQTT Broker port hardcoded #8

Closed wpeterw closed 7 years ago

wpeterw commented 7 years ago

I'm running my mqtt broker on a non-default port. The hue-mqtt-bridge has port 1883 hardcoded. Can this be made configurable ?

dale3h commented 7 years ago

The script passes broker directly from the config file to mqtt.connect() so that it is fully configurable.

I believe you can add the port using their of these formats in config.json:

Option 1:

{
  "broker": {
    "host": "localhost",
    "port": 1883,
    "username": "XXXXXXXX",
    "password": "XXXXXXXX"
  },
  "bridges": [
    ...
  ]
}

Option 2:

{
  "broker": {
    "host": "localhost:1883",
    "username": "XXXXXXXX",
    "password": "XXXXXXXX"
  },
  "bridges": [
    ...
  ]
}
wpeterw commented 7 years ago

Thanks, I figured it out by looking at the MQTT library. I can confirm that Option 1 is the correct way to configure a non-default port. Option 2 is not correct, this results in "localhost:8883:1883" (or whatever port you specify).

dale3h commented 7 years ago

Perfect, thank you for reporting back with the correct solution!