-
Notifications
You must be signed in to change notification settings - Fork 6
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
Multiple queries / sensors #4
Comments
I am interested in this, as well, and can assist in sniffing traffic, architecture, etc. if needed! |
@michaeldavie I'd recommend using the statistics or utility meter sensor to aggregate the queries. @bdraco curious at what your thoughts are to this as you have been contributing heavily to this project. |
The flume api is pretty sluggish sometimes so if you can minimize the load of multiple queries on their systems I think it would be better for everyone. https://flumetech.readme.io/reference#query-a-user-device The api does support sending multiple queries at once so ideally any changes will coalesce the queries into a single call. |
Disregard this message, this doesn't work. Will be updating the HASS integration to support these requests. Using the utility meter the following settings worked for me. Although, it's only from the date configured forward. I've only had it running for a couple of hours but the hourly sensor appears to match the Flume website.
|
I take that back, Utility meter and the flume sensor are fairly inaccurate. |
I did some research today and want to post my findings (as well as my thoughts for what improvements could be made to help this create a top-tier Home Assistant integration, assuming that's the intended use case). I'll probably duplicate knowledge that @michaeldavie has already thought about via his custom component or what everyone here might already know; apologies. 😄 In my testing, I did not experience the API sluggishness that @bdraco mentions; each request/response took a max of 2-ish seconds. I think this is reasonable. If more speed were desired, you could look at using API ResearchI see 7 primary API calls (many of which are already somewhat present here):
Implementation ThoughtsI see a variety of things that this library could do in support of a Home Assistant integration (beyond that already-great work being done): Translate Flume notifications into Home Assistant events.In this scenario, the Add
|
I didn't know about the utility meter sensor, but that seems like a really good option. If we were to go that route, maybe it would make sense to have the Flume sensor simply return the meter's all-time consumption, like a traditional meter, rather than the consumption for the last X minutes. Then the user could use the utility meter to build whatever sensors they wanted. Do you think that would work? |
In order to get this library to work with the utility meter sensor, I think we would need to add a Flume sensor that functions as an accumulator, i.e. it only goes up and never resets. The current sensor seems to function as a sliding window with a width of the scan interval. If that makes sense I could take a crack at it. |
It turns out that an "all-time" query that will only go up isn't possible due to API limitations, so I reverted to my original plan of supporting a wider set of queries. On the Home Assistant side, these can be turned into separate sensors. |
Hi Michael I can't say that I'm an expert in either Flume, Home Assistant or Utility Meter. |
From what I've seen, I think what you're describing would require at least three sensors chained together:
This seems like a lot to rely on a user to configure for fairly basic functionality. Take a look at my pull request linked above and see what you think of the queries I've added, which can be created directly as sensors. |
Module updates completed and update in PyPi.
Can someone peer-review when we get the chance? |
Any updates on this? It looked pretty close to being finished in May :) |
@skynet01. A pull request has been open with HA. Here's a screenshot of the updated sensor. |
There's been some discussion around supporting multiple sensors that cover different periods, e.g. month-to-date, last 24 hours, etc. I had built these into my original custom component, and I'd like to discuss how to extend your library / component to do the same.
The approach I took was to code a few queries into the library, and then create a sensor for each query returned on the Home Assistant side. The set of queries I used was largely based on what is available in the Flume iOS app. I think we could adapt your library to do the same, while retaining the existing
scan_interval
minutes-to-now for compatibility.Let me know what you think, and where I might be able to help.
The text was updated successfully, but these errors were encountered: