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

Panel type and options discovery #9

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vanackej
Copy link
Contributor

@vanackej vanackej commented Nov 5, 2021

Implement Panel type and options discovery.

I also introduced some methods on TcpSocket in order to avoid code duplication for command results management

Copy link
Owner

@TJForc TJForc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit " fix #7 Panel Type auto-discovery " and "Update examples"

This functionality will deserve its own development and will not be accepted as is.
Some changes deserve to be discussed before application such as:

  • Removal of the function for assigning the SupportPirCam variable,
  • Deletion of current exports

These changes incompatible with backward compatibility with plugins already using this library and require automatic mode as a standard, which is too early in terms of the development of this project given that communication with all types of control panel is not validated. .
This imposition of automatic mode and the deletion of the equipment classes prevents the addition of functions or other variables which may be necessary to adapt the communication in the case of different behavior of a central unit.

A depreciation period should also be applied to prepare for such large changes.

The manual and documentation will also need to be updated.

It is preferable that this feature has its own pull requests and that each modification is reviewed together.

Copy link
Owner

@TJForc TJForc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit "Introduce GetResult and GetIntResult functions in order to avoid code… "

Why create 2 different functions?

Why not test if the result is a number and return the result as a string or a number depending on this test?

This would avoid cascading function calls.

The comments of the functions also contain an error, you do not return Promise but either a string or a number.

Otherwise in principle, the idea suits me.

Copy link
Owner

@TJForc TJForc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit "Make watchdog interval configurable "

Ok in principle.

On the other hand, the definition of the variable seems to me misplaced and I don't like this syntax because it gave me problems when the variable is undefined.
For me, the definition should be placed higher in the class builder.
Then, the watchdog call will be made with this variable.

The idea is to define / assign the variables of the class in the same block of code.

@vanackej
Copy link
Contributor Author

Hi @TJForc
Thanks for the review.

Maybe I missed something about the SupportPirCam function, but given my comprehension, it's not used for now (as the computed result is always false). I also took care to keep the condtional tests and logs in order to keep the current behavior, even if not yet used. The function was necessary because instanciated before panel connection was initialized, but now that the PIR support is checked after panel connection, we have all the neccessary informations to check if PIR camera are supported (panel type, firmware versions, ...)

Why create 2 different functions?

Why not test if the result is a number and return the result as a string or a number depending on this test?

The command result is always a string, that have to be parsed as a number depending on the command. Sometimes a digits only number must be interpreted as a string (imagine a serial number with leading zeros for exemple). And it would also involve systematic number parsing attempt, even for basic string results. At last, I wanted the caller to be in charge of the expected command result type => The caller have knowledge of the expected result type and can perform results checks efficiently, not depending on how automatic conversation would be done.

This would avoid cascading function calls.

I can avoid function cascading by duplicating some code, as you prefer. I personnaly prefer avoiding duplication than a simple cascade, but I don't really mind both options

The comments of the functions also contain an error, you do not return Promise but either a string or a number.

Yes I can fix the comments

Otherwise in principle, the idea suits me.

@vanackej
Copy link
Contributor Author

vanackej commented Nov 16, 2021

About the removal of current imports and backward compatibility : Just adding the RiscoPanel subclasses back would keep code backward compatibility for third party libraries. It would allow them for progressive migration to the discovery mecanism.

At the end of the day, I really think they will be happy with panel type auto discovery. Having to do code like this does not help easy third party library integration : https://github.com/gawindx/homebridge-risco-local-platform/blob/53348523013561068e23b3506f81f966ad4318db/app.js#L108

@vanackej vanackej mentioned this pull request Nov 18, 2021
@vanackej
Copy link
Contributor Author

@TJForc
I made an update, trying to take into account most of your feedbacks.
Let me know if it looks better for you or what I could do next. In the meantime, I will publish my own version of this library in order to allow further home assistant integration and get feedbacks from the community. My intent is not to fork the library, but I want to move forward either way.

@vanackej
Copy link
Contributor Author

Hi

I've worked a lot on this library to improve stability and fix bugs. I migrated the codebase to typescript. At this occasion I've catched many typos / typing issues / async issues. Most of them are fixed now in my codebase.

But I struggle with the proxy mode, and would really appreciate having a discussion with you regarding this point.
I'd also like to discuss how/if you want to maintain the library and if you want us to share the responsibility for this.
Would you be available for a little chat any day soon ? If not that's ok, I will just maintain a fork on my own, without the proxy mode as I can't test it

@pergolafabio
Copy link

Keep me posted , really want to use proxy method... For now I stopped using the addon because of the proxy issues :-(

@robertboccia
Copy link

robertboccia commented Dec 28, 2021 via email

@vanackej
Copy link
Contributor Author

@pergolafabio I implemented proxy mode yesterday. Tryied it locally, works with my setup
However, I would strongly advise against using it. If Risco cloud or your internet connection is down, the library won't be able to start and you won't be able to control your panel using home assistant.
Also, my risco cloud cloud access will expire on 01/01/2022, so I won't be able to test anything past this date. Maintenance will be in best effort mode.

@TJForc feel free to close/reject this PR. Again, I let you come back to me anytime if you want to talk about library maintenance and the fork I initiated.

@pergolafabio
Copy link

Hey, thnx in advance, but have you also had it running for more then about 30 hours? Seems when there is Somekind of interrupt somewhere, it crashes the container... I also created 2 issues on this GitHub page for it..
Do you think it will be resolved now with your new updates in typescript?

@vanackej
Copy link
Contributor Author

vanackej commented Dec 29, 2021 via email

@pergolafabio
Copy link

Ok, will do next week, thnx for all updates!!

@pergolafabio
Copy link

@vanackej , are you also planning to put it on HACS, maybe on a custom repository for now? easier to track updates if you maka new release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants