`samsung` node remote control flow working - then it doesn't

Sorry folks, little information to give, but if I don't ask the problem won't go away.

I have a flow that uses the samsung node to control my Samsung TV.
At given times it controls the channel.

Alas recently one of them stopped working.

Base line:

I have a few of these events and the channels change at their given time.
Recently one of them have stopped working.
I have 2 others that are also regular and today they worked.

Observations:

I have a similar thing which is more a remote control duplication on ANOTHER machine.
The even happens, nothing happens on the TV.
If I use the other machine to adjust the volume it works.
Then I go back and test the event again and it works.

There are no ERRORS just a message (which sorry I've since deleted).

--

Ok, I will have to try and remember to capture the message that is given next time.
Alas it may be difficult as I have an error handling routine but it doesn't capture anything.
I just see these messages in the debug list (right side of screen).

It just seems strange that it works earlier on that day, but at this specific time / event: it doesn't work.

Yet it used to work daily without any problem.

Update:

Ok after a bit of testing I got the problematic message back.

RangeError: Invalid WebSocket frame: invalid status code 1005

But as said: It works/ed twice today already so the third time it throws this message.
But if I manually do it (now) for testing: It works.

Is this related?

1 Like

Thanks @Bobo.
Of course after my posting the question the problem has kind of started behaving itself.

For the sake of not wasting people's time, I'll accept that and close this thread.

Just a quick question as a kind of follow up:

How can I detect those messages happening?
The catch node doesn't seem to do it as it isn't an error.

Ok, I have a (sort of) active thread on this.

This problem is an intermittent problem with a node. (Samsung)

I have a catch node on this flow but it doesn't catch these messages.

Screen shot:

The error catcher for that flow.
Ok, subflow there. But all messages are queued for edit screen looking.
(Second screen shot)

So as you can see it isn't being seen as an error.

Again: (as I can't really resolve an answer from the other thread) how can I catch those messages and then make things happen.
Ok, the latter part is my problem and I am sure I can deal with that.
But catching that message....

HOW?

Thanks.
(I'm doing it here now as it just happened and is hard to make happen to test it)

The ideal solution is to submit an issue on the node to get it to trigger a catch-able error.
If the node is not supported then maybe you could fork it and fix it yourself.

In the meantime they should appear in the node red log, so potentially you could tail that. On a pi, for example, they should be in /var/log/syslog.

Ok.

Thanks.

I fear that the node is no longer supported. :frowning:

Your next suggestions are above my skills.
So there is no way to catch the message with an existing node?

Ideally I only need to catch one of the messages. Not from all nodes.
As basically the <enter> is pressed at the end of a each sequence and is in them all.

You don't say which node you are actually using... and checking the flows, I can see 7 'samsung' contrib nodes listed.
Have you tried any of the others?

The one I am using is node-red-contrib-samsung-tv-control
You set the attribute of the node to tell it which button to emulate when it gets a signal.

So all the 7 you see are the same just configured to emulate 7 buttons.

Look in syslog when it happens. All the information you need is there to catch the error in a Tail node.

You problem seems to be covered by the issue that @Bobo linked to.

There is a possible fix in that thread, why don't you try that ?

Open .node-red/node_modules/samsung-tv-control/lib/samsung.js with a text editor eg nano etc.

Then find the section below and add this line as shown -
setTimeout(() => ws.close(), 250);

_send(command, done, eventHandle) {
        const ws = new WebSocket(this.WS_URL, { rejectUnauthorized: false });
        this.LOGGER.log('command', command, '_send');
        this.LOGGER.log('wsUrl', this.WS_URL, '_send');
        ws.on('open', () => {
            if (this.PORT === 8001) {
                setTimeout(() => ws.send(JSON.stringify(command)), 1000);
            }
            else {
                ws.send(JSON.stringify(command));
				setTimeout(() => ws.close(), 250); 
            }
        });
1 Like

Sometimes I can't see the wood for the trees.

Applied and shall see what happens now.

1 Like

Will I have to restart Node-Red after I modify the code?
Or is it called when needed?

All node code is loaded at node-red startup, so you will have to start node-red. I don't understand why you bothered to even ask, would it not have been easier just to restart?

I just wanted to check.

Don't underestimate my stupidity. :wink: