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

Remove set-stolen on alarm trigger #52

Merged
merged 1 commit into from
Oct 30, 2022
Merged

Conversation

basilfx
Copy link
Owner

@basilfx basilfx commented Oct 23, 2022

Marking the device as stolen when the alarm is enabled would mark it as triggered, which might not be the case.

The same 'functionality' can be recreated using automations, so it is up to the end-user to enable this or not.

@basilfx
Copy link
Owner Author

basilfx commented Oct 23, 2022

@vlebourl I checked that I can recreate this feature using automations. Still need to test the alarm implementation in aiobiketrax though ;-)

@@ -72,7 +72,7 @@ def state(self):
"""Return the state of the device."""
return (
STATE_ALARM_TRIGGERED
if self.device.is_alarm_triggered or self.device.is_stolen
if self.device.is_guarded and self.device.is_alarm_triggered
Copy link
Contributor

Choose a reason for hiding this comment

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

can is_alarm_triggered be true if is_guarded is false? If not this is redundant.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think it does not hurt. I could also invert all the if-statements to achieve the same. Just want to prevent any side-effects: I would not expect the alarm to be triggered if it isn't armed.

await self.device.set_stolen(True)
# There is not really a possibility to trigger an alarm, so at
# least enable it.
await self.device.set_guarded(True)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe set_guarded could be a switch or a button attached to the device rather than the trigger command, as you rightfully commented, this doesn't trigger the alarm...

Copy link
Owner Author

Choose a reason for hiding this comment

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

The async_alarm_trigger is only executed when you want to trigger the alarm on command. The closest you can do is to enable the alarm then.

What do you mean with a switch or button?

@basilfx
Copy link
Owner Author

basilfx commented Oct 23, 2022

Did a test tonight, and it seems to work great with an automation. Once the alarm sounds, the state automatically changes to 'stolen', as configured in the automation.

@vlebourl
Copy link
Contributor

I just checked out your branch in my prod HA, I'll let you know how it runs here after a few days!

@basilfx
Copy link
Owner Author

basilfx commented Oct 29, 2022

Did you encounter some issues after testing?

@vlebourl
Copy link
Contributor

Working great!

@basilfx basilfx merged commit 2d09744 into master Oct 30, 2022
@basilfx
Copy link
Owner Author

basilfx commented Oct 30, 2022

Thanks for testing!

@basilfx basilfx deleted the feature/alarm_trigger_state branch October 30, 2022 08:12
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

2 participants