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

ring: fix location mode subscriptions #646

Merged
merged 3 commits into from
Mar 20, 2023
Merged

Conversation

leedsalex
Copy link
Contributor

@leedsalex leedsalex commented Mar 20, 2023

the fix for probing the devices on startup is in this pr too.


// if the location has a base station, updates when arming/disarming are not sent to the `onLocationMode` subscription
// instead we subscribe to the security panel, which is updated during arming actions
this.location.getSecurityPanel().then(panel => {
panel.onData.subscribe(_ => {
this.location.getLocationMode().then(response => {
this.updateLocationMode(response.mode);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

updateLocationMode call no needed, as it's subscribed to on the line above

Comment on lines -182 to -184
if (!this.securitySystemState) {
this.updateLocationMode('disabled');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

couldn't find a case when this was needed, if the idea is to initialize the securitySystemState I can add that before all the subscription logic

this.location = location;

this.location.onLocationMode.subscribe(this.updateLocationMode);
this.location.onLocationMode.subscribe(mode => this.updateLocationMode(mode));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was causing an actual error, I guess function passing doesn't work as I expected in typescript

@koush koush merged commit 8ddf91d into koush:main Mar 20, 2023
@leedsalex leedsalex deleted the ring-mode-fixes branch March 22, 2023 15:31
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.

2 participants