dotsam / homebridge-milight

MiLight/LimitlessLED/Easybulb Plugin for Homebridge
MIT License
63 stars 12 forks source link

Same Hostname, Different Ports Doesn't work #34

Closed GreenTentacle closed 6 years ago

GreenTentacle commented 7 years ago

When I had my config file as this, controlling something like "Bedroom Lamp" actually controlled "Disco Light"-- so device #1 on the second bridge actually controlled device #1 on the first bridge. ("Bedroom Lamp" also controlled itself correctly) The bridge is run by https://github.com/sidoh/esp8266_milight_hub and I've created 2 virtual UDP bridges.

It looks like if I used the same hostname, but 2 different ports, the plugin treated them as the same. My workaround was to give one bridge milight-hub as it's hostname and let it resolve off local DNS, and the other milight-hub.local and have it resolve via Bonjour (both to the same address, if everything goes right).

Thanks !!

   {
        "platform": "MiLight",
        "name": "MiLight",
        "bridges": [
          {
            "ip_address": "milight-hub.local",
            "port": 8899,
            "version": "v5",
            "lights": {
              "rgbw": [
                "Disco Light",
                "Bedroom Strip",
                "Mood light",
                "Computer Light"
              ]
            },
            "repeat": 3,
            "delay": 100
          },
          {
            "ip_address": "milight-hub.local",
            "version": "v5",
            "port": 8898,
            "lights": {
              "rgbw": [
                "Bedroom Lamp",
                "Staircase Light",
                null,
                null
              ]
            },
            "repeat": 3,
            "delay": 100
          }
        ]
      },
/var/homebridge$ sudo npm list -g homebridge-milight
/usr/lib
└── homebridge-milight@1.2.0 
dotsam commented 7 years ago

Yes, it looks like this is a bug, I tack unique bridges based only on IP address, when I should do it on a unique ip/port combo. I'll also turn off node-milight-promise's fullSync feature when I do this so bridges are controlled fully independently.

dotsam commented 6 years ago

Merged @lundberg patch for this in the latest version. Resolved.