Controlling Samsung TV

Hi, I've installed node-red-contrib-samsung-tv-control
I'm trying to get the turn on node to work but doesn't seems to be working
I've put the IP, MAC, and token in, other functions such as changing channel seems to work just not the turn on function.
Anyone got the same issue? Thanks

I had this issue earlier, as my brother just bought their huge 83" TV and often falls asleep watching it, running. I made my own remove via node-red and dashboard for when I can't find the TV remote to turn it off for him, or when I want to mess with the kids.

Here is some notes I made, essentially, you gotta get the ip from your router of the TV. This was easy. Then on your TV you have to enable or allow access to node.js , so when you try to send it signals later, the tv will prompt you to allow or decline.

This didn't seem to full work until I did the steps below, as mentioned in my notes I took regarding getting this node-red ON and OFF switch to work for this TV.

Here you go: Hope it helps as it helped me :slight_smile:

pasting below>

You need to obtain a token for the TV to stop nagging about the Allow Deny permissions for nodejs, which if the token is not set, then the TV keeps asking for permission from the remote connection…. This is a solution that worked for getting the TV’s token from the console, which then worked for the node-red node-red-contrib-samsung-tv-control node.i had troubles to get the token
then i install wscat “npm install -g wscat”
then “wscat -n -c https://TVIP:8002/api/v2/channels/samsung.remote.control?name=aW9Ccm9rZXI=
then i get the Information “< {“data”:{“clients”:[{“attributes”:{“name”:“c3ZlbnJlbW90ZQ==“},“connectTime”:1550138105298,“deviceName”:“c3ZlbnJlbW90ZQ==“,”id”:“e28eb78-6ae-4a16-909c-93f24d2b641c”,“isHost”:false}],“id”:“e28eb78-6ae-4a16-909c-93f24d2b641c”,“token”:“16347308"},“event”:“”}”
so my token is 16347308 and it works with node red

Exciting post as it refers to a whole new interesting world. Is there a descent source of information on Samsung Node-Red control please?

I have made a basic remote control for my Samsung TV.

It isn't prefect, but I can upload it if people want.

Slight "bug". Don't know why but the mute function - as hard as I tried to make it work - is always opposite to what it is.

thanks @mrSidX, I've used this and it seems to have given me 8 digits token from my TV

so the normal commands when the TV is on works, i just can't turn the TV on using this node


will this the wscat give a different token?

Anyway, I got nodered running inside docker
I then went in with sudo bash shell so that I could run and install wscat and got this error

since that command is to install palette, can't I just install it via the web UI? what's the palette called within nodered flow UI?

What does this do with your normal account user using sudo?

ie. sudo npm install -g wscat

I don't have any docker implementations, so not sure if your root is required for it. I try to run NR on a non root user when possible.

Not sure if the wscat give the same token as that node or not...

If that node does, then it's something I've overlooked, as I though I tried all until I had to do the wscat token retrieval method.

thanks @mrSidX, I will try to install nodered on RPi and try again.
but just out of curiosity, if you use wscat to get the token, do you actually get the same number all the time?
if I use the node to get the token, I seems to be getting different token everytime it ran.

Hi @mrSidX, I just built node red within PI as is (without docker implementation). I managed to install wscat and ran the command.
As I thought that the token, keeps changing as you run that everytime and the token generated from here also didn't work for switching TV on.
I hope if anyone else reading this, please share the way to turn Samsung TV on using node-red. Thanks


Hey, Here is my flow that worked with my brothers TV.

[{"id":"58ba9882.718fe8","type":"ui_switch","z":"2ee26e1e.958ae2","name":"","label":"Big TV","tooltip":"","group":"67365e98.aacf3","order":9,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":730,"y":40,"wires":[["da1c393d.f23878"]]},{"id":"54335120.fd63a","type":"ui_button","z":"2ee26e1e.958ae2","name":"","group":"67365e98.aacf3","order":11,"width":0,"height":0,"passthru":false,"label":"Bit TV OFF!","tooltip":"","color":"","bgcolor":"","icon":"","payload":"off","payloadType":"str","topic":"","x":870,"y":20,"wires":[["da1c393d.f23878"]]},{"id":"da1c393d.f23878","type":"function","z":"2ee26e1e.958ae2","name":"","func":"if(msg.payload == \"on\"){\n return [ msg,null];\n}\n\nif(msg.payload == \"off\"){\n return [null, msg];\n}\n","outputs":2,"noerr":0,"x":1010,"y":80,"wires":[["c47174b1.6aafb8"],["fd9629ce.9331c8"]]},{"id":"72e2bf78.32c2f","type":"inject","z":"2ee26e1e.958ae2","name":"TV OFF","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1050,"y":20,"wires":[["da1c393d.f23878"]]},{"id":"fd9629ce.9331c8","type":"samsung-tv-isaliveping","z":"2ee26e1e.958ae2","device":"2d55eaf2.8cdad6","name":"","x":1260,"y":140,"wires":[["45eb0366.be43dc"],[]]},{"id":"c47174b1.6aafb8","type":"samsung-tv-turnon","z":"2ee26e1e.958ae2","device":"2d55eaf2.8cdad6","name":"","x":1320,"y":20,"wires":[[]]},{"id":"45eb0366.be43dc","type":"samsung-tv-send","z":"2ee26e1e.958ae2","device":"2d55eaf2.8cdad6","name":"","key":"KEY_POWER","x":1400,"y":180,"wires":[[]]},{"id":"31b4cbf9.213984","type":"inject","z":"2ee26e1e.958ae2","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1180,"y":180,"wires":[["fd9629ce.9331c8"]]},{"id":"67365e98.aacf3","type":"ui_group","z":"","name":"TV Remote","tab":"42f15bd.59322a4","disp":true,"width":"8","collapse":true},{"id":"2d55eaf2.8cdad6","type":"samsung-tv","z":"","name":"","model":"8002","ip":"","mac":"8C:79:F5:8C:38:7D","token":"57565658"},{"id":"42f15bd.59322a4","type":"ui_tab","z":"","name":"TV Remote","icon":"fa-tv","disabled":false,"hidden":false}]

Install that node-red-contrib-samsung-tv node. I think you have already,
Then you will need to Add one of those green Samsung TV nodes to your flows, and click on one,
you will see an Add TV in a drop down selector to select your TV for that node,
Choose "Add TV". option and you will have more info to give it.

This is where you get that Token you just got from wscat, copy just that token key.

You will need to find the MAC address of your TV, and it's IP address, you can get via your network's router. usually to access on the browser.
Login and see connected Devices and look for your Samsung TV there. You can more than likely get info from the TV Networks settings as well.

Enter all that fancy data into Node-red Samsung TV node.

There are other Samsung TV nodes that do different things like issue certain keypress emulations as if it were a remote controller on the network...

The issue I've had was with the Power button, as to definitively check if it was on, you user the "Is Alive" node to check it TV is on, then if so go ahead and toggle off (if you send an off command) else your just going to toggle the TV on and off... Hope that makes sense. You can simply add a Dashboard or inject "button" that toggles it on and off.

I really hope that helps.Screen Shot 2020-03-22 at 1.38.23 PM

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.