Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risco partitions (local integration) doesn't work after update core 2024.3.3 to 2024.5.2 #117137

Closed
liberomic opened this issue May 9, 2024 · 20 comments · Fixed by #117682
Closed

Comments

@liberomic
Copy link

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
328441401-566cb399-2a4b-422d-b139-bd65b7051fba

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@liberomic liberomic changed the title Risco partition (local integration) doesn't work after update core 2004.3.3 to 2024.5.2 Risco partitions (local integration) doesn't work after update core 2004.3.3 to 2024.5.2 May 9, 2024
@home-assistant
Copy link

home-assistant bot commented May 9, 2024

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)

@liberomic liberomic changed the title Risco partitions (local integration) doesn't work after update core 2004.3.3 to 2024.5.2 Risco partitions (local integration) doesn't work after update core 2024.3.3 to 2024.5.2 May 9, 2024
@OnFreund
Copy link
Contributor

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?

@liberomic
Copy link
Author

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?

@OnFreund
Copy link
Contributor

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.

@liberomic
Copy link
Author

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

@OnFreund
Copy link
Contributor

The RiscoLocal object has a partitions attribute

@liberomic
Copy link
Author

liberomic commented May 14, 2024

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

@OnFreund
Copy link
Contributor

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")

@liberomic
Copy link
Author

await r._rs.send_result_command("PNLCNF")
'RP432'

with 0.5.10 and 0.6.1 it is the same
len(r.zones)
19

@OnFreund
Copy link
Contributor

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 :)

@liberomic
Copy link
Author

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

@OnFreund
Copy link
Contributor

Before you do that, can you try adding it back, but two lines down, so it's after the zones and partitions?

@liberomic
Copy link
Author

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))

@OnFreund
Copy link
Contributor

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.

@OnFreund
Copy link
Contributor

@liberomic
Copy link
Author

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

@OnFreund
Copy link
Contributor

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:

  1. Change the pyrisco version to 0.6.2
  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.

@liberomic
Copy link
Author

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
  1. I cant see the text of the integration (see the attach)
  2. at the first startup working fine I have rebooted HA and the integration go to loop in initialize.....
risco

@OnFreund
Copy link
Contributor

  1. You probably didn't copy the relevant translation file
  2. Logs?

@liberomic
Copy link
Author

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 ;)

@OnFreund OnFreund mentioned this issue May 18, 2024
20 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants