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

channelId parameter should be omitted when not needed #10

Open
Strixx76 opened this issue May 11, 2024 · 4 comments
Open

channelId parameter should be omitted when not needed #10

Strixx76 opened this issue May 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Strixx76
Copy link

If channelId parameter is omitted in getDeviceCameraStatus and setDeviceCameraStatus when for enableType with scope device.
This will fix issues reported in user2684/imou_life#82

Strixx76 added a commit to Strixx76/imouapi that referenced this issue May 11, 2024
@user2684 user2684 added the bug Something isn't working label May 12, 2024
@user2684
Copy link
Owner

Good point, channelId usage has never be clear from the API documentation. I wonder if the fact that it applies to some cameras but not to others may be related to the fact that some cameras have multiple channels, most of the cameras only have channel 0. If we find the correlation we can conditionally use channelid without the user's prompt

@Strixx76
Copy link
Author

What I have found in the API documentation about channelId is something about NVR. But could it also be that devises with two lenses/cameras uses the channelId?

Any way I have now sorted out the mess in my form. If you would like to see a suggestion to solve it you can find it here:
master...Strixx76:imouapi:remove-channelid

If you think that is a good solution I can make a pull request.

@user2684
Copy link
Owner

user2684 commented Jun 2, 2024

@Strixx76 I like your approach. let me see if I can refactor it together with another couple of changes I need to do in the short term and I'll come back to you. Many thanks!

@user2684 user2684 moved this from Backlog to High Priority in Imou Life Development Jun 2, 2024
@Strixx76
Copy link
Author

Strixx76 commented Jun 4, 2024

Could I also the suggest that you change so that the "sensors" gets updated asynchronous?

If you change the for-loop in ImouDevice.async_get_data to use asyncio.gather() you will speed up things. That will also do that the sensors not failing will be updated. Now the loop breaks when one of the sensor fails to update. You could of course instead simply catch all exceptions here and log them like I did to be able to find out what was casing the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: High Priority
Development

Successfully merging a pull request may close this issue.

2 participants