Thanks.
I added the offline.insecure_access option, but there is no difference.
How long did you run the code for?
Below are three tests I did - it lasts for about 20 minutes then no longer responds.
date
Wed Jul 7 08:47:59 PDT 2021
/usr/local/bin/python3 ./hubClient2.py
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.176:17000
DEBUG:urllib3.connectionpool:http://192.168.1.176:17000 "POST /v1/method/hub.offline.insecure_access.enabled.set HTTP/1.1" 400 None
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:websockets.protocol:client - state = CONNECTING
DEBUG:websockets.protocol:client - event = connection_made(<_SelectorSocketTransport fd=8 read=idle write=<idle, bufsize=0>>)
DEBUG:websockets.server:client > GET / HTTP/1.1
DEBUG:websockets.server:client > Headers([('Host', '192.168.1.176:17000'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Key', 'fa8sTLRcdXB2A2/RzOb5jw=='), ('Sec-WebSocket-Version', '13'), ('Sec-WebSocket-Extensions', 'permessage-deflate; client_max_window_bits'), ('User-Agent', 'Python/3.9 websockets/9.1')])
DEBUG:websockets.protocol:client - event = data_received(<129 bytes>)
DEBUG:websockets.server:client < HTTP/1.1 101 Switching Protocols
DEBUG:websockets.server:client < Headers([('Upgrade', 'WebSocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Accept', '7d+r0/EqHLouRUtdetnUDZT0IQE=')])
DEBUG:websockets.protocol:client - state = OPEN
DEBUG:websockets.protocol:client - event = data_received(<2 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=<Opcode.PING: 9>, data=b'', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - received ping, sending pong: [empty]
.
.
.
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=<Opcode.PING: 9>, data=b'', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - received ping, sending pong: [empty]
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=<Opcode.PONG: 10>, data=b'', rsv1=False, rsv2=False, rsv3=False)
**** FROZE HERE
date
Wed Jul 7 09:20:38 PDT 2021
Second Test
date
Wed Jul 7 09:21:10 PDT 2021
/usr/local/bin/python3 ./hubClient2.py
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.176:17000
DEBUG:urllib3.connectionpool:http://192.168.1.176:17000 "POST /v1/method/hub.offline.insecure_access.enabled.set HTTP/1.1" 400 None
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:websockets.protocol:client - state = CONNECTING
DEBUG:websockets.protocol:client - event = connection_made(<_SelectorSocketTransport fd=8 read=idle write=<idle, bufsize=0>>)
DEBUG:websockets.server:client > GET / HTTP/1.1
DEBUG:websockets.server:client > Headers([('Host', '192.168.1.176:17000'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Key', 'NDCSxM2v1BJfctf9gEgPoQ=='), ('Sec-WebSocket-Version', '13'), ('Sec-WebSocket-Extensions', 'permessage-deflate; client_max_window_bits'), ('User-Agent', 'Python/3.9 websockets/9.1')])
DEBUG:websockets.protocol:client - event = data_received(<129 bytes>)
DEBUG:websockets.server:client < HTTP/1.1 101 Switching Protocols
DEBUG:websockets.server:client < Headers([('Upgrade', 'WebSocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Accept', '4mO0uC9Ni62kRq0NYcbP05B9tXw=')])
DEBUG:websockets.protocol:client - state = OPEN
DEBUG:websockets.protocol:client - event = data_received(<2 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=<Opcode.PING: 9>, data=b'', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - received ping, sending pong: [empty]
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=<Opcode.PONG: 10>, data=b'', rsv1=False, rsv2=False, rsv3=False)
.
.
.
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=<Opcode.PING: 9>, data=b'', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - received ping, sending pong: [empty]
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=<Opcode.PONG: 10>, data=b'', rsv1=False, rsv2=False, rsv3=False)
**** FROZE HERE
date
Wed Jul 7 09:40:17 PDT 2021
Third test
date
Wed Jul 7 09:41:07 PDT 2021
dave@Daves-MBP WS Server and Client8 % /usr/local/bin/python3 ./hubClient2.py
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.176:17000
DEBUG:urllib3.connectionpool:http://192.168.1.176:17000 "POST /v1/method/hub.offline.insecure_access.enabled.set HTTP/1.1" 400 None
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:websockets.protocol:client - state = CONNECTING
DEBUG:websockets.protocol:client - event = connection_made(<_SelectorSocketTransport fd=8 read=idle write=<idle, bufsize=0>>)
DEBUG:websockets.server:client > GET / HTTP/1.1
DEBUG:websockets.server:client > Headers([('Host', '192.168.1.176:17000'), ('Upgrade', 'websocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Key', 'Kd93f9ocFWIyqHvZZxcPXA=='), ('Sec-WebSocket-Version', '13'), ('Sec-WebSocket-Extensions', 'permessage-deflate; client_max_window_bits'), ('User-Agent', 'Python/3.9 websockets/9.1')])
DEBUG:websockets.protocol:client - event = data_received(<129 bytes>)
DEBUG:websockets.server:client < HTTP/1.1 101 Switching Protocols
DEBUG:websockets.server:client < Headers([('Upgrade', 'WebSocket'), ('Connection', 'Upgrade'), ('Sec-WebSocket-Accept', 'fgwDz19psM5QIGb+XUapWAuNt6E=')])
DEBUG:websockets.protocol:client - state = OPEN
DEBUG:websockets.protocol:client - event = data_received(<505 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=<Opcode.TEXT: 1>, data=b'{"id":"ui_broadcast","msg_id":"60e5d928077e90401a651ba4","msg_subclass":"hub.item.updated","result":{"_id":"60c697bd077e9017345fa701","deviceArmed":false,"deviceCategory":"security_sensor","deviceId":"60c697bd077e9017345fa6fe","deviceName":"Door/Window Sensor","deviceSubcategory":"door","name":"dw_state","notifications":null,"roomName":"Office","serviceNotification":false,"syncNotification":false,"userNotification":false,"value":"dw_is_opened","valueFormatted":"dw_is_opened","valueType":"token"}}', rsv1=False, rsv2=False, rsv3=False)
Hub says: {"id":"ui_broadcast","msg_id":"60e5d928077e90401a651ba4","msg_subclass":"hub.item.updated","result":{"_id":"60c697bd077e9017345fa701","deviceArmed":false,"deviceCategory":"security_sensor","deviceId":"60c697bd077e9017345fa6fe","deviceName":"Door/Window Sensor","deviceSubcategory":"door","name":"dw_state","notifications":null,"roomName":"Office","serviceNotification":false,"syncNotification":false,"userNotification":false,"value":"dw_is_opened","valueFormatted":"dw_is_opened","valueType":"token"}}
DEBUG:websockets.protocol:client - event = data_received(<493 bytes>)
DEBUG:websockets.protocol:client < Frame(fin=True, opcode=<Opcode.PING: 9>, data=b'', rsv1=False, rsv2=False, rsv3=False)
DEBUG:websockets.protocol:client - received ping, sending pong: [empty]
DEBUG:websockets.protocol:client > Frame(fin=True, opcode=<Opcode.PONG: 10>, data=b'', rsv1=False, rsv2=False, rsv3=False)
.
.
.
date
Wed Jul 7 10:15:39 PDT 2021
I should add that I have done all the following:
"I would recommend trying this approach in a host connected to the same IP segment as the controller. It would be good to check the controller is not losing power or changing its IP address during the process.
Also, make sure the insecure access is enabled on the controller with this call:
{
"method": "hub.offline.insecure_access.enabled.set",
"id": "_ID_",
"params": {
"enabled": true
}
}
"