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

Add feature to retrieve 'Away Mode' from the device API #3

Open
rsocko opened this issue Aug 28, 2023 · 3 comments · May be fixed by #4
Open

Add feature to retrieve 'Away Mode' from the device API #3

rsocko opened this issue Aug 28, 2023 · 3 comments · May be fixed by #4

Comments

@rsocko
Copy link

rsocko commented Aug 28, 2023

Option 1:

  • Add a single new property (bool) to indicate if Away mode is enabled (true) or disabled (false)
  • This will call the API:
    return await self._request("get", f"{API_BASE}/preferences/device/{device_id}/leak_sensitivity_away_mode")

Option 2:

  • Use the preferences API to pull the full dictionary of preference settings (which includes the leak_sensitivity_away_mode)
  • Expose the dictionary / array similar to the get_state method
  • Call this API:
    return await self._request("get", f"{API_BASE}/preferences/device/{device_id}")

For ease of debugging, add an update to the device_dump.py file to also output the data that is gathered either in option 1 or option 2.

It would also be possible to add both (a preferences dictionary + a directly accessible property getter method)

@rsocko
Copy link
Author

rsocko commented Aug 28, 2023

Note I have taken a fork of the project to work on this feature. If there are any preferences (on the above) or process preferred for pull requests, etc. please let me know.

@rsocko
Copy link
Author

rsocko commented Aug 28, 2023

I have completed option 1 - added a new method to return the away_mode value.

This is returned as a dictionary that contains the last updated and set time stamp. Those attributes are exposed by the aiophyn interface as the return value.

@rsocko rsocko linked a pull request Aug 28, 2023 that will close this issue
@rsocko
Copy link
Author

rsocko commented Aug 28, 2023

#4 is the pull request for this feature implemented.

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 a pull request may close this issue.

1 participant