-
Notifications
You must be signed in to change notification settings - Fork 20
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
[FEATURE] Work with guest access to secondary homes #32
Comments
Edit: Oops. Hit submit too soon As part of this change, I think we should also update the exception raised at the end of |
If the Hive API beekeeper endpoints are called with an invalid
|
I'm also happy to extend the Hive Home Assistant Integration to expose this new functionality, though I'll need some time to get my head into the codebase. |
@martintoreilly I agree with the overall approach I would probably look at the nodes/all endpoint and reversing the parameters and setting products/devices/actions to false. If that brings a short response back with the users and homes information that could be used to get how many homes there are. |
Thanks @KJonline. I can confirm that calling |
Glad it’s helps what we need if you create a PR I’ll look at merging it in. I have merged your other PR for the .gitignore change |
@martintoreilly did you have any luck with this? |
@KJonline there seem to be two implementations of the API, are they both in use? |
@AWare ye there is a async and a sync one. Home assistant and the session based code use the async version. The sync version offers another use case in the library for people who don’t use home assistant but may still want a hive integration of their own. |
1 similar comment
@AWare ye there is a async and a sync one. Home assistant and the session based code use the async version. The sync version offers another use case in the library for people who don’t use home assistant but may still want a hive integration of their own. |
Hi @AWare. I haven't managed to spend any more time on this. I did some work on setting the schedule (#19) then got a bit bogged down trying to add testing to ensure I wasn't breaking anything. I'd be happy to jump back in on this if it would help? |
I had a decent go at it yesterday, I'll see if I can't raise a draft PR today. |
|
Is your feature request related to a problem? Please describe.
It is possible to add additional accounts with guest access to a Hive Home (at either "Partner" or "Family" levels of access). However, this library currently only supports the primary Hive Home for a Hive account. Therefore I cannot currently use an account with guest access to my Hive Home to control my Hive devices via this library or the Hive Home Assistant integration that uses it.
Describe the solution you'd like
I would like to be able to query for homes an account has access to and control the devices in these guest homes. I think the pieces are in place to do this and I'm happy to make the changes and submit a PR, but I'd like your thoughts on my proposed approach @KJonline.
Pieces in place
getAll()
currently returns a list of homes the account has access to in addition to the devices, products and actions in the default/primary home for the account, via a call to thehttps://beekeeper.hivehome.com/1.0/nodes/all
Hive API endpoint.homeId
query parameter that allows selection of a secondary Hive Home for users with guest permissions. So far I've verified this works for the following endpoints for a user with "Partner" access to my Hive Home and no devices/products in their primary Hive Home:https://beekeeper.hivehome.com/1.0/nodes/all
https://beekeeper.hivehome.com/1.0/devices
https://beekeeper.hivehome.com/1.0/products
Complication
homeId
parameter does not appear to work for thehttps://beekeeper.hivehome.com/1.0/actions
endpoint. I can see two actions when using my Owner account and none using my Partner account, whether or not I add thehomeId
parameter.Proposed approach
hive_api.getHomes()
function that callshive_api.getAll()
and extracts just the list ofhomes
.hive_api.setHome(homeId)
function that updates the value ofself.config.homeID
.hive_api.getAll()
function to take an additional optionalhomeId
parameter and pass it on to the call to the underlyinghttps://beekeeper.hivehome.com/1.0/nodes/all
Hive API endpoint, using the passedhomeId
if provided andself.config.homeID
if not.hive_api.getActions()
function to take an additional optionalhomeId
parameter and change it to callhive_api.getAll()
with thehomeId
parameter and filter for just theactions
list to work around the fact that thehomeId
parameter does not work with thehttps://beekeeper.hivehome.com/1.0/actions
endpoint.hive_api.getDevices()
andhive_api.getProducts()
functions to take an additional optionalhomeId
parameter and pass this on to their underlying calls to their respective Hive API endpoints, using the passedhomeId
if provided andself.config.homeID
if not. For consistency, I'd be inclined to switch these functions from calling their own Hive API endpoints to callinghive_api.getAll()
with thehomeId
parameter and filtering the results to just thedevices
andproducts
lists respectively. However, I'll take your steer on whether this is a good idea @KJonline.hive_api.getAlarms()
function already calls its underlyinghttps://beekeeper.hivehome.com/1.0/security-lite
Hive API endpoint with thehomeId
parameter, passingself.config.homeID
as the value of this parameter. Augment this function to take an additional optionalhomeId
parameter and use this if provided, defaulting toself.config.homeID
if not (as currently).Additional context
I would like this features to provide more restricted access to the Hive Home Assistant integration, by creating a new Hive account for home assistant and adding it to my Hive Home with either "Family" or "Partner" access (whichever gives the minimum access required to control my Hive devices).
Originally raised in the discussion in (closed) issue #18 (see this comment). Moving to its own issue to take forward.
Thoughts @KJonline ?
The text was updated successfully, but these errors were encountered: