Comments (12)
I had a few issues on my network when trying to write this as I have multiple VLANs and pretty complex firewall in place. When debugging my issues I used my firewall to capture the traffic and analyse it to see where things were not traversing as expected/intended.
This of course is not particularly simple stuff to work through when it does not work. There are some utilities and tools that you can use also on PC, Linux and MacOS that reveal what mDNS traffic and responses are present on your network like mDNS
in MacOS for instance.
Is your client and bridge on the same network? If there might be some segregation, turning on things like Avahi (or mDNS discover option) on the router can help.
from node-hue-api.
Yes client and bridge are on the same network. Router is pretty old and has no such options ;). I will try again with firewalls disabled. Otherwise its probably my old routers fault.
from node-hue-api.
Do you have any recommendations on running an app with this lib inside a container? The multicast will only try the availables interfaces.
And the docker container does not have my LAN interface, it only has its private network stack.
I'd also like to avoid using network mode host.
The mDNS discovery uses the 'bonjour' library which uses the 'multicast-dns' library.
We can customize the options like this
But even then, I'm not sure how to proceed from a container.
from node-hue-api.
Seeing the same issue as @steffenu using beta 15 and node 19.6
Bridge, router, machine (Mac OS Ventura 13.3 (22E252)) all on the same network. No subnets, VLANs whatsoever...
node discoverBridgeViaMDNS.js
[]
node discoverBridgeViaNupnp.js
[
{
"ipaddress": "XXX.XXX.X.X",
"config": {
"name": "Philips hue 2",
"ipaddress": "XXX.XXX.X.X",
"modelid": "BSB002",
"swversion": "1957113050"
}
}
]
The nupnpSearch
function is marked deprecated
, but I haven't had any success using the mdnsSearch
...
I can see the bridge in thee _hap._tcp.
and the _hue._tcp
section of Discovery (Bonjour), but never got anything using mdnsSearch
(ran right from the examples folder in the current repo).
Any hint or recommendation?
from node-hue-api.
I have swapped out the bonjour
library in favour of node-dns-sd
, but the results are still sometimes returning empty arrays. I think this is just a Node.js issue at it's core in that the implementations are to 100% reliable.
That said, it seems to be a little more robust that the pervious version and if you only have one bridge, rather than wait for the time to expire, you can return on discovery but passing in a timeout (in ms) and the boolean returnOnFirstFound
set to true. At least when it gets a match and you only have one bridge, then you get a faster discovery.
I released this change as 5.0.0-beta.16
, let me know if that improves anything.
from node-hue-api.
Hi Peter,
thanks for taking the time looking into this...
What I did (for now) is, I start the mDNS discovery twice (if it returns an empty array), which sometimes (mostly) works and - if not - I'm starting an UPNP search... Although marked as deprecated
this works fine...
Unfortunately I can't just use beta 16 'as is', because I've got the problem, where imports
don't work as long as the imports don't contain the .js
suffix. (I had to rename all imports manually for now, because I don't know how to create a js
-only build).
from node-hue-api.
@peter-murray I don't know if this is of any help or value, but yesterday I tried to find the bridge using:
https://github.com/agnat/node_mdns
only using default settings - and it seems to always
find the bridge (and finds it pretty fast)...
Although I have to admit, I never worked on this before and likely don't know about potential implications (and there might be good reasons other implementations do some more - time-consuming - filtering/searching). I just wanted to mention that finding the brige using the above mentioned library was quick and reliable...
(I also only tested this on Mac Ventura 13.3.1 (22E261) INTEL...)
from node-hue-api.
I had swapped out the library on this branch for node-dns-sd
here; https://github.com/peter-murray/node-hue-api/tree/esmodule but have not ported things back yet.
from node-hue-api.
That specific library, https://github.com/agnat/node_mdns unfortunately has platform specific bindings, so not something I can adopt with the library.
from node-hue-api.
I had swapped out the library on this branch for node-dns-sd here; https://github.com/peter-murray/node-hue-api/tree/esmodule but have not ported things back yet.
Do you think this will make it into the main branch any time soon?
from node-hue-api.
It is on my backlog.
To support it I have to port all the tests over to typescript which is painful and slow, as well as needing to address the bridge test lookups to mdns.
I am busy with work currently that will not afford me time to get to this until later in the month at best.
from node-hue-api.
Thanks for the reply Peter - looking forward to it
from node-hue-api.
Related Issues (20)
- Request: Honor "timeout" in initial connect() request (and API calls in general?) HOT 4
- Entertainment classes change HOT 1
- getUser and getUserByName do not seem to work at all HOT 1
- Error when using Webpack / Electron HOT 1
- Example typo
- Touchlink activation HOT 1
- Cant get this to work with React.JS HOT 2
- Export as esm module HOT 20
- mDNS Discovery HOT 4
- ApiError: Problems resolving hue bridges, HTTP error status: 429 HOT 15
- Cannot import createLocal using TypeScript HOT 3
- Example doesn't work HOT 2
- api.sensors.updateSensorConfig not working due to un-settable params included in request HOT 3
- Failed to create sensor from bridge model: Error: Unknown type 'zllrelativerotary' to create Bridge Model Object HOT 3
- Implement RGB support for groups HOT 1
- Hue API V2
- ApiError: Problems resolving hue bridges, HTTP error status: 429 HOT 1
- bridge-validation.ts is missing bridgeid
- setLightState sets bri to 1 [esmodules] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-hue-api.