core
core copied to clipboard
Risco partitions (local integration) doesn't work after update core 2024.3.3 to 2024.5.2
The problem
In my security system I have three partitions where I can arm or disarm (local integration LightSYS(50) firmware 06.07.01) . I have noted after upgrade the homeassistant core to 2024.5.2 one of three partition working fine other it is disabled. I have tried to restart the integration but the issue persist. In the identity the partitions are avaliable but are disabled/unavaliable. I have restored the backup to 2024.3.3 where the integration Risco working fine.
Il is the same #114830
thanks for your work
What version of Home Assistant Core has the issue?
2024.5.2
What was the last working version of Home Assistant Core?
2004.3.3
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Risco
Link to integration documentation on our website
No response
Diagnostics information
I have tested but the issue on the Security Zone persist, now with the latest version of HA 2024.5.2 if i change cuncurrency from 4 to 1 and now the integration start correctly but I will se only one zone avaliable. With 2024.3.3 all works fine.
Error in Risco library Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pyrisco/local/risco_local.py", line 221, in _listen self._partition_status(int(command[4:]), result) File "/usr/local/lib/python3.12/site-packages/pyrisco/local/risco_local.py", line 181, in _partition_status p = self._partitions[partition_id]
Error in Risco library Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pyrisco/local/risco_socket.py", line 65, in _listen cmd_id, command, crc = await self._read_command() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyrisco/local/risco_socket.py", line 123, in _read_command return self._crypt.decode(buffer) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyrisco/local/risco_crypt.py", line 47, in decode decrypted = decrypted_chars.decode(self._encoding)
Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for return await fut ^^^^^^^^^ asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/pyrisco/local/risco_socket.py", line 108, in send_command
return await asyncio.wait_for(future, 10)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in aexit
raise TimeoutError from exc_val
TimeoutError
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
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)
Going over the changes, the only one that I can see potentially having such effect is querying the system status before getting all partitions. Do you have a way to fire up a python console and test pyrisco directly? If so, can you test pyrisco 0.5.10 vs 0.6.0 and see if anything changes?
I have installed visualstudio and with the pip command pyrisco pip install pyrisco==0.5.10
Now you can help me to debug pyrisco comunication?
You can install aioconsole, and then apython, and follow the pyrisco readme. Note that you'll need to disable the integration before the experiments, since Risco won't allow additional connections.
I am connected with pyrisco=0.5.10 and I tryed to arm and disarm a Security Partition and work fine. I cant see the status of Partitions Do you suggest a commands I will share the output.
Regards
The RiscoLocal object has a partitions
attribute
Command with pyrisco==latest
All command with partition attribute presents this error:
print(r.partitions[2].name) Traceback (most recent call last): File "c:\users\xxxxx\appdata\local\programs\python\python39\lib\site-packages\aioconsole\execute.py", line 147, in aexec result, new_local = await coro File "
", line 2, in __corofn KeyError: 2
Other commands work fine
print(r.zones[1].name) Ir rooms
print(r.partitions[1].armed) Traceback (most recent call last): File "c:\users\xxxxx\appdata\local\programs\python\python39\lib\site-packages\aioconsole\execute.py", line 147, in aexec result, new_local = await coro File "
", line 2, in __corofn KeyError: 1
print(r.partitions[1].name) Traceback (most recent call last): File "c:\users\xxxxx\appdata\local\programs\python\python39\lib\site-packages\aioconsole\execute.py", line 147, in aexec result, new_local = await coro File "
", line 2, in __corofn KeyError: 1
--------------Command with pyrisco==0.5.10 working fine see the output
print(r.partitions[1].armed) False print(r.partitions[2].armed) True print(r.partitions[3].armed) False
The name of the partitions will be dispyed correctly print(r.partitions[1].name) First print(r.partitions[2].name) Second print(r.partitions[3].name) .....
Thanks for your working
OK, that's good progress!
Next step is with the latest version, delete or comment out this line and see if it's working. If it is, add the line again but two lines down, so it's after querying the partitions and zones. Make sure you see all partitions, and all zones (you can use len(r.zones)
to see how many were detected.
Also, please let me know what's the output of:
await r._rs.send_result_command("PNLCNF")
await r._rs.send_result_command("PNLCNF") 'RP432'
with 0.5.10 and 0.6.1 it is the same len(r.zones) 19
What were the results of changing the code as I instructed?
with 0.5.10 and 0.6.1 it is the same len(r.zones) 19
I meant you should test this with the code changes to ensure that you see all partitions and all zones :)
Sorry....
I have deleted this line from a file self._system = await self._init_system()
len(r.zones) = it is the same - "19" print(r.partitions[1].name) = working fine print(r.partitions[1].armed) = working fine
If it is possible I want update HA and edit the line and complete check if it is working or not. do you agree?
Regards
Before you do that, can you try adding it back, but two lines down, so it's after the zones and partitions?
I have edit the file in this mode and working fine!
self._id = await self._rs.send_result_command("PNLSERD")
self._zones = await self._init_zones()
self._partitions = await self._init_partitions()
self._system = await self._init_system()
self._listen_task = asyncio.create_task(self._listen(self._rs.queue))
OK. great. I'll release a new version of pyrisco with this change later today, and then you can create a custom Risco component that uses the new version and test it. If everything works fine, I'll bump the dependency in HA.
https://pypi.org/project/pyrisco/0.6.2/
do you have suggestions to thest this version on HA? should I use HACS? I'm sorry but I have never activated a custom component on HA
Regards
You shouldn't use HACS. Your HA configuration folder has a custom_components
subfolder. Copy the Risco integration there (you can take the relevant folder from github), and modify the manifest file as follows:
- Change the
pyrisco
version to0.6.2
- Add a
version
field (you can set it to anything you want)
Restart HA, and you should see an icon in the Risco integration in the integrations screen, to note that it's a custom component.
I have installed new HA for test and I copied folder risco from git in custom_components folder, changed manifest as suggested
- I have custom integration with my version
- I cant see the text of the integration (see the attach)
- at the first startup working fine I have rebooted HA and the integration go to loop in initialize.....
- You probably didn't copy the relevant translation file
- Logs?
I have moved concurrency options from 4 to 3 and working fine after 5/6 reboot
IT WORKS!!! now you can add me as beta tester of pyrisco ;)