@ersinayaz/rn-samsung-tv-remote

1.0.2 • Public • Published

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 @ersinayaz/rn-samsung-tv-remote

or using yarn:

yarn add @ersinayaz/rn-samsung-tv-remote

Usage

import { SamsungRemote, DeviceDiscovery } from '@ersinayaz/rn-samsung-tv-remote';

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.

KEY Description
KEY_POWER Power Off
KEY_MENU Menu
KEY_CONTENTS Smart Hub
KEY_HOME Home
KEY_UP Up
KEY_DOWN Down
KEY_LEFT Left
KEY_RIGHT Right
KEY_VOLUP Volume Up
KEY_VOLDOWN Volume Down
KEY_MUTE Mute
KEY_CHLIST Channel List
KEY_CHUP Channel Up
KEY_CHDOWN Channel Down
KEY_SOURCE Source
KEY_INFO Info
KEY_HELP Help
KEY_TOOLS Tools
KEY_GUIDE Guide
KEY_RETURN Return
KEY_PLAY Play
KEY_PAUSE Pause
KEY_STOP Stop
KEY_REC Record
KEY_0 0
KEY_1 1
KEY_2 2
KEY_3 3
KEY_4 4
KEY_5 5
KEY_6 6
KEY_7 7
KEY_8 8
KEY_9 9

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

License

MIT

Donate

Crypto Wallet
BTC bc1qhq65mvfx4a6pdad386t85lm7ac6c2th535f2u0
ETH 0xf053943DB59c8aE80570EdE12bAD33f26788CE6F
USDT 0xf053943DB59c8aE80570EdE12bAD33f26788CE6F

Bitcoin Donate Button

Package Sidebar

Install

npm i @ersinayaz/rn-samsung-tv-remote

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

925 kB

Total Files

18

Last publish

Collaborators

  • ersinayaz