1.0.8 • Published 3 years ago

rn-samsung-remote-control v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

React Native - Samsung TV Remote Control

This project is a proof of concept to remote control Samsung TV which require encrypted communication with the internal web service of the TV.

TOC

Installation

Using npm:

npm i rn-samsung-remote-control

or using yarn:

yarn add rn-samsung-remote-control

Usage

import { SamsungRemote, DeviceDiscovery } from 'rn-samsung-remote-control';

Find Lan Devices:

// ...
const devices = await DeviceDiscovery.discover("urn:samsung.com:device:RemoteControlReceiver:1");

devices:

[{"info": {"address": "192.168.1.xxx", "family": "IPv4", "port": 38092, "size": 347}, "target": "urn:samsung.com:device:RemoteControlReceiver:1"}]

Initialize

const tv = new SamsungRemote({ ip: device[0].info.address });
tv.init();

or

const tv = new SamsungRemote({ ip: device[0].info.address });
// identity = await tv.confirmPin("xxxx")
tv.init(identity);

Request PIN

tv.requestPin();

Confirm PIN

const identity = await tv.confirmPin("xxxx")

Connect

await tv.connect()

Send Key

tv.sendKey("KEY_MUTE");

onConnected Event

// It must be defined before the tv.connect() command.
tv.onConnected(()=>{
    alert("Connected")
});

Key Codes

The list of accepted keys may vary depending on the TV model, but the following list has some common key codes and their descriptions.

KEYDescription
KEY_POWERPower Off
KEY_MENUMenu
KEY_CONTENTSSmart Hub
KEY_HOMEHome
KEY_UPUp
KEY_DOWNDown
KEY_LEFTLeft
KEY_RIGHTRight
KEY_VOLUPVolume Up
KEY_VOLDOWNVolume Down
KEY_MUTEMute
KEY_CHLISTChannel List
KEY_CHUPChannel Up
KEY_CHDOWNChannel Down
KEY_SOURCESource
KEY_INFOInfo
KEY_HELPHelp
KEY_TOOLSTools
KEY_GUIDEGuide
KEY_RETURNReturn
KEY_PLAYPlay
KEY_PAUSEPause
KEY_STOPStop
KEY_RECRecord
KEY_00
KEY_11
KEY_22
KEY_33
KEY_44
KEY_55
KEY_66
KEY_77
KEY_88
KEY_99

Click for other keys: (https://github.com/ersinayaz/rn-samsung-remote-control/blob/main/Keys.md)

License

MIT

Donate

CryptoWallet
BTCbc1qhq65mvfx4a6pdad386t85lm7ac6c2th535f2u0
ETH0xf053943DB59c8aE80570EdE12bAD33f26788CE6F
USDT0xf053943DB59c8aE80570EdE12bAD33f26788CE6F

Bitcoin Donate Button

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.1

3 years ago