caphm / tizenws Goto Github PK
View Code? Open in Web Editor NEWSimple websocket client for Samsung Tizen TVs in python using asyncio
License: MIT License
Simple websocket client for Samsung Tizen TVs in python using asyncio
License: MIT License
Hi,
I'm trying to get the currently running app from my TV, but it doesn't want to play ball. If I try to connect like this:
tizenws> connect 192.168.1.242
I get this error:
2022-10-02 22:54:42,111 - asyncio - ERROR - Exception in callback Cmd.reader()
handle: <Handle Cmd.reader()>
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib/python3.10/site-packages/asynccmd/asynccmd.py", line 117, in reader
self._exec_cmd(line)
File "/usr/lib/python3.10/site-packages/asynccmd/asynccmd.py", line 149, in _exec_cmd
return func(arg)
File "//./tizenws.py", line 417, in do_connect
args[1] = "TizenWS Commandline"
IndexError: list assignment index out of range
It seems I'm short an argument... so I added in a random arg, and get this:
tizenws> connect 192.168.1.242 mytv
2022-10-02 22:57:45,718 - __main__ - DEBUG - Opening websocket connections
tizenws> 2022-10-02 22:57:45,718 - __main__ - ERROR - Failed to read storage file: [Errno 2] No such file or directory: 'mytv.token'
2022-10-02 22:57:45,718 - __main__ - DEBUG - remote: Attempting connection to wss://192.168.1.242:8002/api/v2/channels/samsung.remote.control?name=bXl0dg%3D%3D
2022-10-02 22:57:45,751 - __main__ - DEBUG - remote: Connection established
2022-10-02 22:57:45,772 - __main__ - DEBUG - remote: Authorization accepted
2022-10-02 22:57:45,772 - __main__ - DEBUG - Requesting list of installed apps
2022-10-02 22:57:45,773 - __main__ - DEBUG - control: Attempting connection to wss://192.168.1.242:8002/api/v2?name=bXl0dg%3D%3D
2022-10-02 22:57:45,815 - __main__ - DEBUG - Installed apps:
YouTube Kids: 3201611111983
YouTube: 111299991912
(....plus a load mode I've cut off for size...)
I'm not sure why it's trying to read a token form the file system. I can't see any way of saving one from the help text.
Basically, my kids are always leaving the TV on. I've written a shell script which checks if the PlayStation is on, and checks if Kodi is playing a video. If neither is happening, it powers the TV off...
Problem is, if they're watching Netflix, YouTube Kids, etc. It keeps powering off the TV while they're watching it... I was hoping to call your code from a shell script and get it to return the currently running app. Only if no apps are running, will it power the TV off.
Thanks for any help you can give me with this one.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.