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

[FEATURE] Add thermostat temperature history #34

Open
martintoreilly opened this issue Dec 30, 2021 · 2 comments
Open

[FEATURE] Add thermostat temperature history #34

martintoreilly opened this issue Dec 30, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@martintoreilly
Copy link
Contributor

martintoreilly commented Dec 30, 2021

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

I would like to access my thermostat's temperature history. This is available from the following Hive beekeeper API endpoint :https://beekeeper-uk.hivehome.com/1.0/history/heating/<thermostat_id> with the following parameters.

  • start: Timestamp as milliseconds since unix epoch
  • end: Timestamp as milliseconds since unix epoch
  • timeUnit: YEARS, DAYS, HOURS, MINUTES or SECONDS.
  • rate: Integer value
  • operation: I can only find one valid value AVG, which is the default if this parameter is omitted

I'm happy to make this change and submit a PR. @KJonline Do you have any thoughts about where this best fits in the pyhiveapi API structure?

Additional context

  • I have not seen any records closer than 5 2 minutes apart and its not unusual for adjacent records to be more like 30 minutes apart. No interpolation occurs when the requested granularity is finer than the data supports. In this case the raw records are returned.
  • Data seems to be go back to 00:00:00 GMT on 01 Jan 2019. I was able to query back this far around 5-6am on 30 Dec 2021 and queries with start dates a little before this returned with 00:00:00 on 01 Jan 2019 as the earliest entry. [Edit: this changed to 23:00:00 on 31 Dec 2018 after a few minutes and has stayed there for about 30 minutes]
  • I want to say that if you query outside this range you get a 404 - Not found error, but I think it may be more nuanced than that. I was able to query with some start dates prior to the earliest returned date and setting the end date in the future did not give an error. I also had some dates intermittently give me the 404 error (25, 26, 27 Dec 2020). I can't be sure I was querying with single day resolution when I got those intermittent 404 errors, however I think the 404 error may occur if the query has had to look at more than about a year's worth of data. Perhaps there is some kind of internal timeout that gets translated as "no results" rather than a server error?
@martintoreilly martintoreilly added the enhancement New feature or request label Dec 30, 2021
@martintoreilly
Copy link
Contributor Author

martintoreilly commented Dec 30, 2021

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.

@KJonline
Copy link
Contributor

@martintoreilly as a starter for 10 I would build the api and then we can see how to can be utilised elsewhere. The key with this library is to make sure it’s compatible with 4 use cases

  1. through home assistant
  2. using a pyhiveapi as home assistant does but without home assistant
  3. async raw api
  4. sync raw api

with regards to unasync this only works on the main code not the api code so you do have to code twice as unasync doesn’t work well with sync and async http libraries

@martintoreilly martintoreilly changed the title [FEATURE] [FEATURE] Add thermostat temperature history Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants