- 积分
- 907
- 金钱
- 841
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
高级会员
- 积分
- 907
- 金钱
- 841
- HASS币
- 0
|
发表于 2023-6-10 21:46:37
|
显示全部楼层
本帖最后由 xiongmx 于 2023-6-10 21:58 编辑
感谢,运行环境都搞好了,开门后自动开灯这些功能都搞定了,但是开锁的python脚本执行出错,而且楼主脚本里面的开锁键是不是做了改造的?
nodered是使用的docker,websocket-client requests也安装好了。
--- request header ---
GET /?access_token=9nWoGdlN6laaqqek4RaNanVEfGWlNRV HTTP/1.1
Upgrade: websocket
Host: wsapi.kiwiot.com
Origin: https://wsapi.kiwiot.com
Sec-WebSocket-Key: LHaR0HvKEIRFaIVqaxizew==
Sec-WebSocket-Version: 13
Connection: Upgrade
-----------------------
--- response header ---
HTTP/1.1 101 Switching Protocols
Server: nginx
Date: Sat, 10 Jun 2023 13:41:01 GMT
Connection: upgrade
Upgrade: websocket
Sec-WebSocket-Accept: erNk1CaJSrr29J5UaJwVDhLu/F4=
-----------------------
Websocket connected
--- request header ---
GET /?access_token=9aWosdlN6laRsqek4Ry6NBnVEfGWlNRV HTTP/1.1
Upgrade: websocket
Host: wsapi.kiwiot.com
Origin: https://wsapi.kiwiot.com
Sec-WebSocket-Key: VyUgAKkmvUBqSsVuBHNhjg==
Sec-WebSocket-Version: 13
Connection: Upgrade
-----------------------
--- response header ---
HTTP/1.1 101 Switching Protocols
Server: nginx
Date: Sat, 10 Jun 2023 13:41:02 GMT
Connection: upgrade
Upgrade: websocket
Sec-WebSocket-Accept: nPhBVyyghCTEGMmNsaHVAWan5zs=
-----------------------
error from callback <function on_open at 0x7f3696a72d40>: 'access_token'
'access_token'
执行中在这里卡住,终端后提示如下
^C
++Sent raw: b'\x88\x82\x81\xed\xec\x8a\x82\x05'
++Sent decoded: fin=1 opcode=8 data=b'\x03\xe8'
error from callback <function on_close at 0x7f3696a72cb0>: on_close() takes 1 positional argument but 3 were given
on_close() takes 1 positional argument but 3 were given
Traceback (most recent call last):
File "/data/优智云家/open.py", line 51, in <module>
ws.run_forever()
File "/usr/src/node-red/.local/lib/python3.10/site-packages/websocket/_app.py", line 487, in run_forever
setSock()
File "/usr/src/node-red/.local/lib/python3.10/site-packages/websocket/_app.py", line 417, in setSock
handleDisconnect(e, reconnecting)
File "/usr/src/node-red/.local/lib/python3.10/site-packages/websocket/_app.py", line 415, in setSock
dispatcher.read(self.sock.sock, read, check)
File "/usr/src/node-red/.local/lib/python3.10/site-packages/websocket/_app.py", line 91, in read
r = self.select()
File "/usr/src/node-red/.local/lib/python3.10/site-packages/websocket/_app.py", line 105, in select
r = sel.select(self.ping_timeout)
File "/usr/lib/python3.10/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
~/.local/bin $
|
|