I've asked on
github but it is 1 year 4 months out of service.
It may not be supported any more.
I have run into a weird question/situation:
Until now NR and the TV were on the same network.
They are not going to be much longer.
Initial tests imply that they won't talk to one another if on different networks.
I say this because I had the TV on the other network and then realised that NR wouldn't talk to it. (NR remained where it was/is)
I believe NR was restarted! (Dramatic music!)
I say this because other tabs on the machine were wiped.
Can anyone help me confirm this is true?
If not, how did you get it working? I'm not having any luck.
What do you mean by different networks? How are the two networks connected? If you have computers on both networks can they ping each other?
It is possible to have more than 1 network at home.
So the TV will be on Network 1 and the PC will be on Network 2.
Those two networks meet at a router.
So for instance:
I can ping between networks.
That's what is getting to me.
Though I admit I am not an expert on networks.
But if that can't/couldn't happen: the internet as we know it couldn't work either.
Or so I am being told by people who claim to know more about networks than me.
Yes, of course.
Can you ping the TV when it is on the same network? If so can you ping it when it is on the other network?
When you moved the tv to the other network did you remember to change the network settings in the tv so that it has an IP address on the other network?
I can ping it on either network.
Again: That is what is throwing me.
And that NR is either reset or restarted if I try to use the node is also worrying.
(Only if on the other network.)
It works fine if both on the same network.
I know that's dangerous.
How do I get into the workings of the node and see if I can see anything that may be problematic?
(Yeah, me find a problem with the code written by someone head and shoulders above my skill set.)
I have looked at the spec of the node and see that you also give it the MAC address of the TV. That suggests that it does something other than use TCPIP. Possibly it broadcasts direct to the MAC address. If so then that is the cause of the problem. Broadcast messages do not normally pass from one network to another.
If you have a machine on the TV network running node red then I suggest that you run the node there, and if you need to access it from the dashboard on the first network then connect that dashboard to the second machine via MQTT to transfer the commands.
Thanks @Colin ...
Yeah, so MAC addresses are level 2 (network) stuff - yes?
But if that is true how do other apps work to control the TV?
Sorry, probably a dumb question.
Do/would they use a different protocol? (or port?) (or something?)
Well, that works, as that is what I have now.
But then I would need ANOTHER RasPi (or machine) running NR and they could talk via MQTT.
But that may be a push.
And ..... another machine. I't trying to rationalise how many machines I have.
Which is what I kind of did. Just the re-structure of the network puts the TV on another network.
(Argh! I nearly repeated what you said. Brain failure. sorry.)
It costs me a lot of money.
But I may as well spend money of stuff that interests me.
That is just the start. There are going to be a lot of networks.
I think 5 at last count.
Why? Added complexity just causes problems, as you have found out.
I suggest rationalising back to one network.
Alas my curiosity sometimes just wants to push the limits.
It keeps me (or makes me start) thinking.
As I see it, once I have one extra network working, I can go mad and have a few.
Then I can learn about network security which is a whole new world unto itself.
It would be interesting, but I kind of hope I don't go too far down that rabbit hole.
But for now that's the future.
The code is in your node_modules folder, or in the node's github repository which is referenced in the nodes page on the node-red flows site.
I dug around and found it. Most - if not all - is way above my head.
How did you get that it was talking to the TV's MAC address?
I know it gets it (or is I have to enter it)? I know I have to give the IP address.
Is that just the start for the node to then get the MAC address?
I couldn't find/see the bit that does the protocol.
All I could find were all the different function definitions.
It was an assumption on my part. Why else would it require you to enter it?
That's fair enough. No problems.
That node CAN talk to different networks. (Brain failure on my part)
THIS computer has been moved to it's new network and can talk to the TV.
Now I need to dig into what types of devices it goes through.
This is what I see happening in/on Node-Red when I try to access the TV via the node via different networks.
TV is off or unavailable
16 Nov 17:26:26 - [red] Uncaught Exception:
16 Nov 17:26:26 - [error] Error: Error send Key
at WebSocket.<anonymous> (/home/pi/.node-red/node_modules/samsung-tv-control/lib/samsung.js:289:17)
at WebSocket.emit (events.js:314:20)
at emitErrorAndClose (/home/pi/.node-red/node_modules/samsung-tv-control/node_modules/ws/lib/websocket.js:895:13)
at ClientRequest.<anonymous> (/home/pi/.node-red/node_modules/samsung-tv-control/node_modules/ws/lib/websocket.js:752:5)
at ClientRequest.emit (events.js:314:20)
at TLSSocket.socketErrorListener (_http_client.js:427:9)
at TLSSocket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.
So you can see that NR restarted at the end.
But that is what happens if I request a TOKEN from the TV.
You have multiple routers in your home network ? Talking about complexity....
One of the core functions of a router is to separate networks, ie broadcast domains.
To make the separate networks to talk, you need to tell the router what to do with the traffic (ie, routing).
Your TV has a network configuration, 1 element is the default gateway (ie often the router) that is where it send its traffic if it doesnt know how to talk to the network it wants to reach. The router looks at the packet and hopefully knows how to get to the other network. Now if you have 2 routers, this becomes complex. You will have to configure them both and verify the routing tables.
To separate LANs/networks (read: broadcast domains) in a homenetwork, it is easier to use VLANs instead. But both concepts most likely require configuration changes and network knowledge.
Thanks for the reply.
I know I am probably making my life more difficult than it needs to be.
At this point I am trying to migrate things from one network to the other.
The second one is inside the first for now as that way I can leave any firewall stuff off for now as it is sterile behind the existing router.
I've migrated this machine to the new network and I can control the TV on the older network.
So it has disproved that the node can't handle different networks. Sorry that got through originally. Brain failure.
the second router is a smarter/better one that allows multi-networks and VLANs on different ethernet ports.
To save cables I've got a managed switch and the new networks are via VLAN to the switch.
THOUGH there is an UNTAGGED network (the main one) going from the Router to the switch.
So things go bad if I move the TV to one of the new VLAN networks on the switch.
I set up a flow to send a request to the TV to get a token so I can talk to it and.... node-red restarts. (As per the latest post above) I got an old machine, installed the samsung node and tested it.
Then I stopped and started NR via the CLI and saw the error happen.
I'm curious to what is going on and what is causing it.
Ok, the new SWITCH isn't like the old DUMB switch and is a MANAGED one.
But as I haven't really set up any rules: I thought (hoped?) that all traffic would go between the VLANs.
The SWITCH is only that. NO DHCP, DNS, etc. It ONLY has VLANs.
All the DHCP (etc) is done in the new router.
But! That side SEEMS to be working as I can get from this machine to the TV and it works.
(Trip path: This machine --> Smart (managed) Switch --> New router --> Existing router --> dumb swtich --> TV)
So it sort of implies that it can be done.
Now the trick is finding out if it is the new Router or the Managed switch causing the problem.
Oh, and I can PING the TV from this machine, no problems.
Seems I've got a very steep learning curve ahead of me.
Requiring the mac is just a (low level) security feature. They use the mac as kind of password in the protocol.