Open keesje9 opened 2 years ago
Hi @keesje9 do you mind downgrading the library to 2.5.1? Might be an issue caused related to last change.
hello kakopappa, then i get this message root@revo4k python /media/hdd//tv.py /media/hdd//tv.py:62: DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop() 2022-06-25 16:13:07.351 | ERROR | sinric._sinricpro:connect:64 - As of 3.10, the loop parameter was removed from Lock() since it is no longer necessary root@revo4k
in 2.5.3 it works for a while
root@revo4k:~# python3 /usr/bin/tv.py
/usr/bin/tv.py:62: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
2022-06-25 16:24:54.643 | SUCCESS | sinric._sinricprosocket:connect:46 - Connected :)
2022-06-25 16:26:16.839 | INFO | sinric._sinricprosocket:receiveMessage:62 - Connection with server closed
2022-06-25 16:26:16.841 | ERROR | sinric._sinricprosocket:receiveMessage:63 - no close frame received or sent
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 944, in transfer_data
message = await self.read_message()
│ └ <function WebSocketCommonProtocol.read_message at 0xb6292538>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1013, in read_message
frame = await self.read_data_frame(max_size=self.max_size)
│ │ │ └ 1048576
│ │ └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
│ └ <function WebSocketCommonProtocol.read_data_frame at 0xb6292580>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1089, in read_data_frame
frame = await self.read_frame(max_size)
│ │ └ 1048576
│ └ <function WebSocketCommonProtocol.read_frame at 0xb62925c8>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 1144, in read_frame
frame = await Frame.read(
│ └ <classmethod(<function Frame.read at 0xb6288bb0>)>
└ <class 'websockets.legacy.framing.Frame'>
File "/usr/lib/python3.10/site-packages/websockets/legacy/framing.py", line 70, in read
data = await reader(2)
└ <bound method StreamReader.readexactly of <StreamReader eof limit=32768 transport=<_SelectorSocketTransport closed fd=8>>>
File "/usr/lib/python3.10/asyncio/streams.py", line 706, in readexactly
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/tv.py", line 64, in <module>
loop.run_until_complete(client.connect())
│ │ │ └ <function SinricPro.connect at 0xb5dbc340>
│ │ └ <sinric._sinricpro.SinricPro object at 0xb5db58b0>
│ └ <function BaseEventLoop.run_until_complete at 0xb63d3538>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/python3.10/asyncio/base_events.py", line 633, in run_until_complete
File "/usr/lib/python3.10/asyncio/base_events.py", line 600, in run_forever
File "/usr/lib/python3.10/asyncio/base_events.py", line 1896, in _run_once
File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
> File "/usr/lib/python3.10/site-packages/sinric/_sinricprosocket.py", line 55, in receiveMessage
message = await connection.recv()
│ └ <function WebSocketCommonProtocol.recv at 0xb62922b0>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 552, in recv
await self.ensure_open()
│ └ <function WebSocketCommonProtocol.ensure_open at 0xb62924a8>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
File "/usr/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 920, in ensure_open
raise self.connection_closed_exc()
│ └ <function WebSocketCommonProtocol.connection_closed_exc at 0xb6292460>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5d91a90>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
`
Looks like a Python 3.10 issue. I have tested this only on Python 3.9.7. Will check and get back.
“no close frame received or sent“ looks like connection issue.
went to openatv 7.0 with Python 3.9.7 and the same problem occurs.
`root@revo4k:~# python /media/hdd/google/tv.py
2022-06-26 10:45:12.464 | SUCCESS | sinric._sinricprosocket:connect:46 - Connected :)
2022-06-26 10:46:12.473 | INFO | sinric._sinricprosocket:receiveMessage:62 - Connection with server closed
2022-06-26 10:46:12.475 | ERROR | sinric._sinricprosocket:receiveMessage:63 - no close frame received or sent
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 944, in transfer_data
message = await self.read_message()
│ └ <function WebSocketCommonProtocol.read_message at 0xb645cad8>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1013, in read_message
frame = await self.read_data_frame(max_size=self.max_size)
│ │ │ └ 1048576
│ │ └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
│ └ <function WebSocketCommonProtocol.read_data_frame at 0xb645cb20>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1089, in read_data_frame
frame = await self.read_frame(max_size)
│ │ └ 1048576
│ └ <function WebSocketCommonProtocol.read_frame at 0xb645cb68>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1144, in read_frame
frame = await Frame.read(
│ └ <classmethod object at 0xb6440e50>
└ <class 'websockets.legacy.framing.Frame'>
File "/usr/lib/python3.9/site-packages/websockets/legacy/framing.py", line 70, in read
data = await reader(2)
└ <bound method StreamReader.readexactly of <StreamReader eof limit=32768 transport=<_SelectorSocketTransport clos
ed fd=8>>>
File "/usr/lib/python3.9/asyncio/streams.py", line 721, in readexactly
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/media/hdd/google/tv.py", line 69, in <module>
loop.run_until_complete(client.connect())
│ │ │ └ <function SinricPro.connect at 0xb5fca3d0>
│ │ └ <sinric._sinricpro.SinricPro object at 0xb5fcbb98>
│ └ <function BaseEventLoop.run_until_complete at 0xb65a3e80>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
File "/usr/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
> File "/usr/lib/python3.9/site-packages/sinric/_sinricprosocket.py", line 55, in receiveMessage
message = await connection.recv()
│ └ <function WebSocketCommonProtocol.recv at 0xb645c850>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 552, in recv
await self.ensure_open()
│ └ <function WebSocketCommonProtocol.ensure_open at 0xb645ca48>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 920, in ensure_open
raise self.connection_closed_exc()
│ └ <function WebSocketCommonProtocol.connection_closed_exc at 0xb645ca00>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5eadd60>
websockets.exceptions.ConnectionClosedError: no close frame received or sent`
@keesje9 I have fixed the issue "'NoneType' object is not callable" in the 2.6.2 https://pypi.org/project/sinricpro/2.6.2/
I ran the tv.py for about 10 mins and did not see "no close frame received or sent" error. If you still have issues can you post the complete log using the below code?
Thanks
import logging
logger = logging.getLogger('websockets')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
from sinric import SinricPro
import asyncio
APP_KEY = ''
APP_SECRET = ''
TV_ID = ''
def power_state(device_id, state):
print('state : ', state)
# Do Something
return True, state
def set_volume(device_id, volume):
print('volume : ', volume)
# Do Somethign
return True, volume
def adjust_volume(device_id, volume):
print('volume : ', volume)
# Do something with volume
return True, volume
def media_control(device_id, control):
print('control : ', control)
# Do something with control
return True, control
def select_input(device_id, input):
print('input : ', input)
# Do something with input
return True, input
def change_channel(device_id, channel_name):
print('channel_name : ', channel_name)
# Change Channel
return True, channel_name
def skip_channels(device_id, channel_count):
print('channel_count : ', channel_count)
# Skip them
return True, channel_count
action_callbacks = {
'powerState': power_state,
'setVolume': set_volume,
'adjustVolume': adjust_volume,
'mediaControl': media_control,
'selectInput': select_input,
'changeChannel': change_channel,
'skipChannels': skip_channels
}
if __name__ == '__main__':
loop = asyncio.get_event_loop()
client = SinricPro(APP_KEY, [TV_ID], action_callbacks, enable_log=True, restore_states=False, secretKey=APP_SECRET)
loop.run_until_complete(client.connect())
thank you for your help, but it's not working here yet
root@revo4k:~# python3 /usr/bin/tv.py
= connection is CONNECTING
> GET / HTTP/1.1
> Host: ws.sinric.pro
> Upgrade: websocket
> Connection: Upgrade
> Sec-WebSocket-Key: BlFbQFsci5nsyWSR6R01Cg==
> Sec-WebSocket-Version: 13
> Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
> appkey: c13d7226-92f6-4213-b706-516eb4c6b409
> deviceids: 62b6c0ec0aec232058efbdb6
> platform: python
> sdkversion: 2.6.2
> restoredevicestates: false
> User-Agent: Python/3.9 websockets/10.1
< HTTP/1.1 101 Switching Protocols
< Server: nginx
< Date: Sun, 26 Jun 2022 12:55:08 GMT
< Connection: upgrade
< Upgrade: websocket
< Sec-WebSocket-Accept: nWFYb8nycOGdHwir+EmwDcB3t00=
= connection is OPEN
2022-06-26 14:55:08.112 | SUCCESS | sinric._sinricprosocket:connect:46 - Connected :)
< TEXT '{"timestamp":1656248108}' [24 bytes]
< PING '' [0 bytes]
> PONG '' [0 bytes]
! failing connection with code 1006
= connection is CLOSED
2022-06-26 14:56:16.485 | INFO | sinric._sinricprosocket:receiveMessage:62 - Connection with server closed
2022-06-26 14:56:16.487 | ERROR | sinric._sinricprosocket:receiveMessage:63 - no close frame received or sent
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 944, in transfer_data
message = await self.read_message()
│ └ <function WebSocketCommonProtocol.read_message at 0xb646e9b8>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1013, in read_message
frame = await self.read_data_frame(max_size=self.max_size)
│ │ │ └ 1048576
│ │ └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
│ └ <function WebSocketCommonProtocol.read_data_frame at 0xb646ea00>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1089, in read_data_frame
frame = await self.read_frame(max_size)
│ │ └ 1048576
│ └ <function WebSocketCommonProtocol.read_frame at 0xb646ea48>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1144, in read_frame
frame = await Frame.read(
│ └ <classmethod object at 0xb6454c70>
└ <class 'websockets.legacy.framing.Frame'>
File "/usr/lib/python3.9/site-packages/websockets/legacy/framing.py", line 70, in read
data = await reader(2)
└ <bound method StreamReader.readexactly of <StreamReader eof limit=32768 transport=<_SelectorSocketTransport closed fd=8>>>
File "/usr/lib/python3.9/asyncio/streams.py", line 721, in readexactly
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/tv.py", line 68, in <module>
loop.run_until_complete(client.connect())
│ │ │ └ <function SinricPro.connect at 0xb5fdf100>
│ │ └ <sinric._sinricpro.SinricPro object at 0xb5fdb310>
│ └ <function BaseEventLoop.run_until_complete at 0xb65b5d60>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
File "/usr/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
> File "/usr/lib/python3.9/site-packages/sinric/_sinricprosocket.py", line 55, in receiveMessage
message = await connection.recv()
│ └ <function WebSocketCommonProtocol.recv at 0xb646e730>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 552, in recv
await self.ensure_open()
│ └ <function WebSocketCommonProtocol.ensure_open at 0xb646e928>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 920, in ensure_open
raise self.connection_closed_exc()
│ └ <function WebSocketCommonProtocol.connection_closed_exc at 0xb646e8e0>
└ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
Can you connect via a mobile hotspot and check whether it’s same?
On Sun, 26 Jun 2022 at 7:59 PM keesje9 @.***> wrote:
thank you for your help, but it's not working here yet
@.***:~# python3 /usr/bin/tv.py
= connection is CONNECTING
GET / HTTP/1.1
Host: ws.sinric.pro
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: BlFbQFsci5nsyWSR6R01Cg==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
appkey: c13d7226-92f6-4213-b706-516eb4c6b409
deviceids: 62b6c0ec0aec232058efbdb6
platform: python
sdkversion: 2.6.2
restoredevicestates: false
User-Agent: Python/3.9 websockets/10.1
< HTTP/1.1 101 Switching Protocols
< Server: nginx
< Date: Sun, 26 Jun 2022 12:55:08 GMT
< Connection: upgrade
< Upgrade: websocket
< Sec-WebSocket-Accept: nWFYb8nycOGdHwir+EmwDcB3t00=
= connection is OPEN
2022-06-26 14:55:08.112 | SUCCESS | sinric._sinricprosocket:connect:46 - Connected :)
< TEXT '{"timestamp":1656248108}' [24 bytes]
< PING '' [0 bytes]
PONG '' [0 bytes]
! failing connection with code 1006
= connection is CLOSED
2022-06-26 14:56:16.485 | INFO | sinric._sinricprosocket:receiveMessage:62 - Connection with server closed
2022-06-26 14:56:16.487 | ERROR | sinric._sinricprosocket:receiveMessage:63 - no close frame received or sent
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 944, in transfer_data
message = await self.read_message() │ └ <function WebSocketCommonProtocol.read_message at 0xb646e9b8> └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1013, in read_message
frame = await self.read_data_frame(max_size=self.max_size) │ │ │ └ 1048576 │ │ └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598> │ └ <function WebSocketCommonProtocol.read_data_frame at 0xb646ea00> └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1089, in read_data_frame
frame = await self.read_frame(max_size) │ │ └ 1048576 │ └ <function WebSocketCommonProtocol.read_frame at 0xb646ea48> └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1144, in read_frame
frame = await Frame.read( │ └ <classmethod object at 0xb6454c70> └ <class 'websockets.legacy.framing.Frame'>
File "/usr/lib/python3.9/site-packages/websockets/legacy/framing.py", line 70, in read
data = await reader(2) └ <bound method StreamReader.readexactly of <StreamReader eof limit=32768 transport=<_SelectorSocketTransport closed fd=8>>>
File "/usr/lib/python3.9/asyncio/streams.py", line 721, in readexactly
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/tv.py", line 68, in
loop.run_until_complete(client.connect()) │ │ │ └ <function SinricPro.connect at 0xb5fdf100> │ │ └ <sinric._sinricpro.SinricPro object at 0xb5fdb310> │ └ <function BaseEventLoop.run_until_complete at 0xb65b5d60> └ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
File "/usr/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
File "/usr/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
File "/usr/lib/python3.9/site-packages/sinric/_sinricprosocket.py", line 55, in receiveMessage
message = await connection.recv() │ └ <function WebSocketCommonProtocol.recv at 0xb646e730> └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 552, in recv
await self.ensure_open() │ └ <function WebSocketCommonProtocol.ensure_open at 0xb646e928> └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
File "/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 920, in ensure_open
raise self.connection_closed_exc() │ └ <function WebSocketCommonProtocol.connection_closed_exc at 0xb646e8e0> └ <websockets.legacy.client.WebSocketClientProtocol object at 0xb5f5d598>
websockets.exceptions.ConnectionClosedError: no close frame received or sent
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/python-sdk/issues/41#issuecomment-1166525308, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZW37HI3XS5T6R22OF3VRBH2RANCNFSM5Z2H43UA . You are receiving this because you commented.Message ID: @.***>
yes it works, I use a VPN. i try another ip
and do you know how i can put the script in the background? I already tried it on init.d but then enigma2 won't start.
Try supervisord
On Sun, 26 Jun 2022 at 9:24 PM keesje9 @.***> wrote:
yes it works, I use a VPN. i try another ip
and do you know how i can put the script in the background? I already tried it on init.d but then enigma2 won't start.
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/python-sdk/issues/41#issuecomment-1166548621, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZTYDFAYJ66QC6GQOTDVRBRZ5ANCNFSM5Z2H43UA . You are receiving this because you commented.Message ID: @.***>
Supervisor not working on e2, but why sinricpro does not work with VPN?
For enigma2 you can use the openspa image. We have a plugin made using sinric pro 2.5.3 https://github.com/OpenSPA/SpaOpenPlugins/tree/master/sinriconnect/plugin
I can't connect on my enigma2 revo 4k box. I have taken all the steps and keep getting this message
have used this tool https://jungle-team.com/sinric-pro-conecta-tu-receptor-enigma2-a-alexa-o-google-home/
and your example https://github.com/sinricpro/python-sdk/blob/master/examples/tv.py
how can I solve this? i use openatv with google assistant which i added. oh yeah new flash didn't work