home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.39k stars 30.29k forks source link

Issues after Risco Local Integration #114049

Closed 03397 closed 6 months ago

03397 commented 6 months ago

The problem

With the recent updates, I've successfully integrated my Risco Agility Alarm with Home Assistant locally. However, I've noticed that upon restarting Home Assistant, the Risco Integration takes an extended amount of time to load, causing delays in the completion of Home Assistant startup.

Additionally, numerous unused zones (labeled Zone07 to Zone32) have been imported into Home Assistant. These zones are unconfigured and cannot be deleted from my alarm system, hence they are imported as entities in Home Assistant.

The presence of these unused zones results in a significant number of invalid entities being imported into Home Assistant, totaling 33 devices and 129 entities. This likely contributes to the prolonged loading time of the Risco Integration.

Moreover, during restarts, I intermittently encounter various errors. Below is an example of one such error that occurred during the restart process.

zones_risco

entities_risco

risco_failed

What version of Home Assistant Core has the issue?

2023.3.3

What was the last working version of Home Assistant Core?

Never

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Risco

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.risco
Source: components/risco/__init__.py:97
integration: Risco (documentation, issues)
First occurred: 7:21:18 AM (1 occurrences)
Last logged: 7:21:18 AM

Error in Risco library: invalid state

Additional information

No response

03397 commented 6 months ago

Another error after restart

Error in Risco library: invalid state Error in Risco library: Timeout in command: CLOCK

home-assistant[bot] commented 6 months ago

Hey there @onfreund, mind taking a look at this issue as it has been labeled with an integration (risco) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `risco` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign risco` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


risco documentation risco source (message by IssueLinks)

OnFreund commented 6 months ago

Regarding taking extended time to load - this is because it has to get all the zones. 2024.4 is going to optimize HA boot and it won't hold up the event loop. In the mean time, you can disable the integration before restarting HA, and enable it again after everything is up.

Regarding the extra zones - unfortunately that's what your panel is reporting. You can try to play around directly with pyrisco and see if there are any indications that these zones aren't real. This is where zone information is being obtained and unused zones are discarded.

03397 commented 6 months ago

Thanks for the reply @OnFreund. I have found out that the alarm from the panel had only 7 zones. After using my configuration software and logon to the panel I have found out that there were 32 zones. I have made those not used and after that only 7 zones were imported in Home Assistant.

However this does not solved the issue. I have removed the integration from the beginning and I have reinstall it. Until the risco integration conneced successfully and bring all the devices/entities I am getting failed setup and in order for this to conclude I needed to restart Home Assistant.

After everything is imported successfully after restart it is the initializing that takes a long time.

In addition, sometimes I am getting the error Error in Risco library: invalid state Error in Risco library: Timeout in command: CLOCK even when the integration tries to find the status of the alarm.

03397 commented 6 months ago

risco_integraton1 risco_integraton2 risco_integraton3

OnFreund commented 6 months ago

Regarding taking extended time to load - this is because it has to get all the zones. 2024.4 is going to optimize HA boot and it won't hold up the event loop. In the mean time, you can disable the integration before restarting HA, and enable it again after everything is up.

I think you're going to have to wait about 10 days

03397 commented 6 months ago

Regarding taking extended time to load - this is because it has to get all the zones. 2024.4 is going to optimize HA boot and it won't hold up the event loop. In the mean time, you can disable the integration before restarting HA, and enable it again after everything is up.

I think you're going to have to wait about 10 days

Let's wait and see @OnFreund. Thanks

03397 commented 6 months ago

I am getting this error randomly though out the day. Isn't this related with the way the integration polls the alarm?

Logger: homeassistant.components.risco Source: components/risco/init.py:97 integration: Risco (documentation, issues) First occurred: 3:06:06 PM (4 occurrences) Last logged: 3:40:00 PM

Error in Risco library: Risco error: N04 Error in Risco library: Timeout in command: CLOCK

OnFreund commented 6 months ago

Those are benign. They happen every now and then, but as long as it's once every few hours you're fine.

jakob1911 commented 6 months ago

Hello OnFreund, hello 03397,

@03397 Glad to hear you where able to get your panel connected !

@OnFreund I will test the startup and my "max concurrency" behavior with the new release 2024.4. Maybe my problem will be already solved then. Otherwise i will create an issue here - so that you can keep track as you mentioned.

Regards Jakob

OnFreund commented 6 months ago

@jakob1911 2024.4 is not expected to resolve your max concurrency issue (if anything, it could make it worse). I just have to find the time to add support for configuring it. Probably won't be in time for 2024.4 but hopefully for 2024.5, or even a 2024.4 patch release.

03397 commented 6 months ago

After upgrade to 2024.4.x I keep having issues after the restart of home assistant and the Risco local Integration. The problem existed in 2024.3.x but more rarely. Now, I have even trouble in connecting. Risck Integration most of the time refuses to initialize getting the following image

The thing is that I am not getting any error in my logs. @OnFreund Any thoughts? I have this issues after you did some changes and I have managed to successfully integrate despite this error.

03397 commented 6 months ago

Reverted back to 2024.3.3 and Risco local integration conneced successfully. So, something changed in 2024.4.1 which makes risco not to be able to connect without giving any error.

OnFreund commented 6 months ago

The most likely culprit is the addition of system sensors - perhaps your panel doesn't support them. We should have seen an error log though. Before we go down the road investigating that, maybe it's just a timing issue - those have been haunting the Risco integration in the last few HA version, and while 2024.4 seemed to have resolved it for me, maybe it made it worse for you. Can you try to disable the integration, restart home assistant and wait for everything to load, and only then enable it?

03397 commented 6 months ago

The most likely culprit is the addition of system sensors - perhaps your panel doesn't support them. We should have seen an error log though. Before we go down the road investigating that, maybe it's just a timing issue - those have been haunting the Risco integration in the last few HA version, and while 2024.4 seemed to have resolved it for me, maybe it made it worse for you. Can you try to disable the integration, restart home assistant and wait for everything to load, and only then enable it?

I have the Agility 3 panel if this helps. I do not think is the addition of the sensors but if you tell me which sensors I might know if they are supported or not, The timing issue that you are referring might be the issue and I do not know if we can correlate this with the error messages I have sent before(see below) which I get several a day. Aren't those time out relevant? Now, as per you suggestion I have already done that. Disabled integration, restarted Home Assistant and after that I enabled the integration. It does not help.

Error in Risco library: Risco error: N04 Error in Risco library: Timeout in command: CLOCK

OnFreund commented 6 months ago

As I mentioned above, those clock errors are benign.

It actually does sound like the system sensors. @jakob1911 are you also on Agility 3? Can you try upgrading the pyrisco dependency in your custom integration to 0.6.0 and see if this also causes an error?

03397 commented 6 months ago

Just a correction my panel is Agility 4 which is the latest. This is what my panel is returning after using risqo-mqtt-local Panel info: Agility 4/RW032:618VGMI, FW N/A

jakob1911 commented 6 months ago

I‘m at Agility 3 and i have an old Single/mono socket board which only excepts one Connection a time. @03397 i was testing risco-mqtt-local as well and got the same respons that i have a Agility 4, which is defenitley not the case. But anyway this doesn‘t borther me. @OnFreund i‘m facing exactly the same issues as @03397 since updating to 2024.4.1 - but it has nothing to do with your changes „add system sensors“, its the problem with „Max concurrency“ which made it even worser as you mentioned above.

i will create a new issue for this today and i think this will resolve also your Problems @03397.

03397 commented 6 months ago

I‘m at Agility 3 and i have an old Single/mono socket board which only excepts one Connection a time. @03397 i was testing risco-mqtt-local as well and got the same respons that i have a Agility 4, which is defenitley not the case. But anyway this doesn‘t borther me. @OnFreund i‘m facing exactly the same issues as @03397 since updating to 2024.4.1 - but it has nothing to do with your changes „add system sensors“, its the problem with „Max concurrency“ which made it even worser as you mentioned above.

i will create a new issue for this today and i think this will resolve also your Problems @03397.

@jakob1911 Thanks for the info. I just wanted to let you know that mine is a multi socket.

jakob1911 commented 6 months ago

issue created, with providing additional information for resolving timing problems

115118

linked to this issue, it's similar behavoir.