risco-mqtt-local
risco-mqtt-local copied to clipboard
Restart needed on cloud disconnect
Describe the bug Hi @vanackej , using the addon with cloud proxy method... Yesteday i had a small internet interrupt, but after internet was restored, the addon was not able to connect to cloud anymore, i had to restart the addon to make it functional... It possible on this type of event as in screenshot, that the service can be restarted? I had watchdog enabled, but that doesnt help, since addon keeps on running
Thnx in advance
Configuration
- Environment: Addon
- Version: 0.5.0. beta 2
- Mode: Proxy
- Risco Panel model: Lightsys2
- Risco Panel firmware version: 2.x
Logs
I only have a screenshot:
I am also experiencing the same issue. Experimented with adding the option: "ReconnectDelay: 10000,"
to the json file. Unable to confirm if it fixes it, but I will report my findings in due course.
Ah, that's worth a try, gonna test that also, it's easy to replicate, just unplug the network cable :+)
Today there was a risco cloud upgrade, the addon wasnt able to reconnect, untill a manually restart
Unfortunately, issue still persists.
Hopefully a solution can be devised, such as automatically attempting to reinitiate the cloud connection every 10 seconds until it reconnects, similarly to the way the add-on already does with the panel.
Ah that's a bummer, I didn't test yet...
Shouldnt be to difficult I think?
@vanackej , do you have some time to look at this issue?
Thnx in advance
The add-on does do an automatic reconnect, which is what you're seeing here. The automatic delay is currently set at 5 seconds and is not user-configurable.
No it doesn't always do a reconnect, if I unplug the UTP from the panel, I can simulate the issue... Seems it doesn't reconnect then, not sure why
I wonder if the automatic reconnect is failing. It may be that the interval between disconnecting and reconnecting is too short, although the logs would suggest that the connection is re-established and then dropped. When the connection initialises at startup, do the logs show 'connect' then 'ready'?
Hi , I will do some testing when I'm back home from vacation, thnx in advance..
Are you improving this addon?
I've been doing some development work for a while. Some of this is working well. I'm not a programmer, though, so much is trial and error. I run HA in a docker and don't need the proxy socket, so rely on others to test. I've only just tried to make add-ons.
Ah ok, :-)
Do you have the knowledge to extract the proxy from the addon, so I can just only run proxy in separate addon, and use the official pyrisco integration in HA itself?
This would be a separate project and really needs to be an adaptation of the pyrisco project. Pyrisco is written in python and communicates with the panel directly, including portions of risco-lan-bridge project. The original project is written in typescript and is divided in to two parts: the risco-lan-bridge project communicating with the panel, and the risco-mqtt-local project that publishes to MQTT. I've now had a go at making the cloud reconnection interval user configurable. I've also added a sensor for cloud connection. Hopefully these might work.
Yes, indeed , it's an separate project, is it doable? Would be nice for official risco integration
I thought the proxy inside the docker was just Somekind of code that listen for incoming connection and forwards to risco?
Your description is correct, but the key here is how the different parts of the system communicate with each other. It’s definitely possible though.
Well, let me know if you are interested, maybe we can make a separate topic about it? We can maybe also I clude onFreund, owner of the pyrisco , I "know" him as well
Hi @markxroberts , back on topic, i'm home again, and did a test I started the Addon , around 07:21 i unplugged my UTP cable from risco panel, you see in log, its giving an error at around 07.28 i plug in again the UTP cable, but as you can see, it doesnt reconnect, it stays in the loop To make it work again, i have to restart the addon again ....
So on any internet/router/switch issue, the addon fails everytime, would be great if it can restart or does a reconnect somehow
...
thnx for looking into it!!
logs: risco.log
Thanks. There's no obvious reconnect here. I've made some updates in the latest release. See if those work. The reconnection delay is configurable and there's a cloud connection sensor.
Ok , then I need to install the addon from your repo instead? What do I need to set for the delay?
Is there a new setting in the Json file then?
You might need to experiment with the delay. The default is 5 seconds, but I'd try 10 seconds minimum. The setting in the config.json
file is cloudReconnectionDelay
.
Ok , I test it out asap , I also see you have outputs, that's nice..
What is the function anyway of the cloud reconnect delay? Does it check if there is cloud connection, if not it does somekind of restart?
The reconnect function already exists. The hypothesis is that this doesn't work properly because it doesn't have the time to reset itself before it's asked for a repeat connection. Making the delay user-configurable tests the hypothesis.
ok, quickly installed 2023.7.3 , using same config file as before
I see this in logs:
7/23/2023, 10:57:52 AM [info] Subscribing to Home assistant commands topics
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/partition/1/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/1-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/2-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/3-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/4-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/5-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/6-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/7-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to risco-alarm-panel/alarm/zone/8-bypass/set topic
7/23/2023, 10:57:52 AM [info] Subscribing to panel partitions events
7/23/2023, 10:57:52 AM [info] Subscribing to panel zones events
7/23/2023, 10:57:52 AM [info] Subscribing to panel outputs events
7/23/2023, 10:57:52 AM [info] Subscribing to panel system events
7/23/2023, 10:57:52 AM [info] Subscribing to Home Assistant online status
7/23/2023, 10:57:52 AM [info] Initialization completed
7/23/2023, 10:57:52 AM [info] homeassistant/status was subscribed
7/23/2023, 11:01:08 AM [error] RiscoCloud Socket Timeout.
7/23/2023, 11:05:08 AM [error] RiscoCloud Socket Timeout.
as for sensors, i have a lot of unknown, also myt panel itself is unknown ?
alltough i see this in logs, my panel is unknown:
7/23/2023, 11:09:15 AM [info] [Panel => MQTT][Discovery] Published cloud status sensor, HA name = Cloud connection status
7/23/2023, 11:09:15 AM [info] [Panel => MQTT][Discovery] Published panel status sensor, HA name = Panel connection status
7/23/2023, 11:09:15 AM [info] [Panel => MQTT][Discovery] Published System message sensor, HA name = System message
7/23/2023, 11:09:15 AM [info] [Panel => MQTT][Discovery] Published alarm_control_panel to HA Output label = Pergola Quintens, HA name = risco alarm panelPergola Quintens on partition 1
This is my panel config, allthough the IP is incorrect, its a fictive setting, since i use the proxy method... Maybe i need to remove all IP settings there?
{
"log": "info",
"logColorize": true,
"panel": {
"panelIp": "192.168.1.150",
"panelPort": 1000,
"panelPassword": XXXX,
"panelId": "0001",
"watchDogInterval": 10000,
"cloudConnectionDelay": 10000,
"guessPasswordAndPanelId": false,
"Disable_RiscoCloud": true,
"Enable_RiscoCloud": true,
"autoDiscover": false,
"socketMode": "proxy",
"listeningPort": 33000,
"cloudPort": 33000,
"cloudUrl": "www.riscocloud.com"
},
"mqtt": {
"url": "mqtt://homeassistant:1883",
"username": "XXXX",
"password": "XXXX"
},
"zones": {
"default": {
"off_delay": 0,
"name_prefix": ""
},
"GARAGE": {
"off_delay": 0,
"device_class": "garage_door",
"name": "Garage Door",
"name_prefix": ""
}
}
}
Seems i have 2022.7.3 , but i see you have 2 newer versions avaible? .4 and .5 ? Can you update the config file so i can update the addon? so i can test those ones
thnx
2022.7.4 and .5 won't update this. It's the risco-lan-bridge library that needs updating. I'll take a look as soon as a can. Will take a few days. Something's going wrong at startup.
Ok, np, take your time..
Thnx for looking into it
So, when I refactored this I've included discovery of more devices. I wonder whether this has caused the timeout. The socket timeout was set at 120 seconds, and there's much more than that between the start and the finish of your discovery. I've lengthened this delay. You now have the latest version of the library including group arming. The reason that everything is unknown is that no state has been published. I don't know whether this will fix it, but give it a go.
Ok, I test it tomorrow, thnx in advance