MariusRumpf / node-lifx

Node.js implementation of the LIFX LAN protocol :bulb:
MIT License
144 stars 28 forks source link

Not working in Windows when running Docker #67

Open Sawtaytoes opened 6 years ago

Sawtaytoes commented 6 years ago

For whatever reason, this isn't working for me in Windows. There's no issue or error, I just don't see any clients showing up.

const fs = require('fs')
const LifxClient = require('node-lifx').Client

const client = new LifxClient()

client.on(
  'light-new',
  light => (
    light
    .getLabel(
      (_, label) => (
        console.log(
          light.address,
          '\t',
          label
        )
      )
    )
  )
)

client.init()

I'm LAN-networked, so that might have something to do with it. The LIFX Universal Windows app sees lights and will use that port so I don't think it's something in Windows itself.

Did something change or do I need to enable some setting to get this working properly in Windows?

ristomatti commented 6 years ago

It's probably firewall blocking the Node process. You'll need certain UDP port range to be open for incoming packages. I don't remember it just now but try disabling the firewall for a moment to verify the cause if it's possible for you to do so.

MariusRumpf commented 6 years ago

The UDP port used for the discovery is 56700. See https://github.com/LIFX/lifx-protocol-docs/blob/master/workflows.md

Sawtaytoes commented 6 years ago

I noticed this in my console when running with debug: true on init:

DEBUG - 24000034d84a563100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 240000346ea6b48a00000000000000000000000000000022000000000000000002000000 from 10.1.0.5
DEBUG - 24000034d84a563100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 240000346ea6b48a00000000000000000000000000000022000000000000000002000000 from 10.1.0.5
DEBUG - 24000034d84a563100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
DEBUG - 240000346ea6b48a00000000000000000000000000000022000000000000000002000000 from 10.1.0.5
DEBUG - 24000034d84a563100000000000000000000000000000000000000000000000002000000 to 255.255.255.255
...

That IP is the Raspberry Pi I have running this library. After shutting it down, those logs are removed, I only get the DEBUG ... to 255.255.255.255 lines afterward.

Looks like it's sending out the packets, but getting no responses right?

Sawtaytoes commented 6 years ago

I figured it out! It's something to do with Docker.

To fix the issue, I had to uninstall Docker. Something about the Ethernet adapter it installs or something else related to it are causing problems. I wonder if it has an internal subnet it designates to itself that is incompatible with my home subnet and prevents multicasting from node-lifx because of that.

Do you know what might be the issue now since we can narrow it down to Docker?