i8beef/node-red-contrib-castv2

Connecting / Disconnected when using mDNS for groups

Closed this issue · 6 comments

I'm running node-red on docker in host mode on a different subnet than all of my cast devices. I have avahi set up on pfsense to reflect mDNS across the subnets.

I'm able to see all of my devices and groups when I click the search icon on the castv2-connection node, but when I deploy the flow the castv2-sender nodes go into a connecting/disconnected loop when a group is selected. If I select a single device it connects without any problems.

As a workaround I've been casting to all individual devices on the port the group uses (all fail except the device that is actually hosting the group at that time) - this is working but obviously pretty ugly when you look at the flow 😄

Looking for any suggestions. Thanks!

Well you've got a different setup that I'm not really setup to test on my end right now... The fact that you are seeing the group mDNS advertisement sounds like your reflector is working correctly. The connect logic in question will attempt to discover all of the cast targets, and then extract the host and port to connect to...

Can you connect to the group cast target from say, a phone on the same network as your node-red instance? My gut is saying check your subnet routing rules... remember that the Google Cast target is going to choose some random ports, its not always going to be 8009 that needs allowed through the subnet route...

Yea, it's a strange one. I'm able to cast to the group(s) while my phone is on the same subnet as node-red. I'm also able to manually specify the IP/port of the group (port 32222 in this case), but as you know the IP can change depending on which device is hosting it at any given time. The port for each group seems to never change, so in the meantime I've added a separate connection/sender node for each device in the group on the designated port and that appears to be working for now (all error except for the one that is actually hosting the group). I'm not sure if this adds any latency.

Is there any difference between the discovery logic in the connection node vs the sender node?

LOL, well its a brute force technique, but it might work, though it aint pretty.

No difference in discovery, as its a shared function of both the connection lookup and establishment. If you can connect directly by IP / port from the node, you should be able to connect via the discovery... all it does is find an IP / port from the mDNS discovery instead of taking it from the config.

By chance does your group name have any leading or trailing white space somewhere? I would think the only failure point would be in it failing to find the group by the name specified, and reverting to "0.0.0.0:8009".

Definitely not pretty - I might just create a subflow so I don't have to see it 🤣

The groups don't have any leading/trailing whitespace. Is there any log I can check to see exactly what is going on behind the scene? It seems like the mDNS query is failing, but I'm not familiar enough with node-red to know if there is any sort of additional logging besides what is available in the debug panel.

You can use a "catch" node to a "debug" node to see any errors thrown by nodes on that entire flow... don't know if that'll show anything here or not.

Closing out as stale, if you need more help reopen!