Flume Water Meter

Line 41 in sensor.py is

CONF_CLIENT_SECRET: config.get(CONF_CLIENT_SECRET)

so I suspect your configuration.yaml doesn’t have the client secret properly set up.

This is probably because the access token expired; I haven’t built the refresh mechanism yet. I should be able to push a version that handles this tonight.

This is great. Just got mine hooked up. Does anyone have a good code snippet for a lovelace card with a graph? The best I can do is sticking all the entities on on entities card.

Also, I spoke to Flume support yesterday and they indicated an API endpoint for setting ‘away’ status is coming next month. I’m looking forward to having alarm decoder set flume as away and alert on any water usage when no one is home. @michaeldavie I see a method in there for unread notifications but no matching sensor in HA. Does it only appear if you have notifications?

I’ve started working on it in the API connector library, but I haven’t got it mapped into the sensor component yet. It shouldn’t be too hard, but I haven’t had much time to work on it.

No worries. I appreciate all that you have done so far.

I’ve pushed a new update that handles refreshing the access token. Please give it a try and let me know if you have any trouble.

I did try the new version and it works great now.
I did have to delete the token file - not sure why but after I did this and rebooted HA the sensor started reporting water usage.

Where is the token file located? as I just upgraded and I get an error.

Thanks

it’s located in the same folder as configuration.yaml - file is called flume_tokens

Thanks got it working.

Thanks for making this. Just got a flume, yesterday and everything seems to be working well. So far I really like it, was wanting to get my water usage into HA somehow and Flume seems like the easiest way.

Are the “Last 60min” and “Last 24hr” sensors essentially rolling sum measurements?

I think I prefer just a sum of the last minute if the query is running every minute. Then HA can make all the other sensors using its built in stats sensors and such.

I modified your code to additionally give the 1 minute measurement, i like it because it matches the app better, that and the cumulative sum measurements make more sensor to me vs the last 60min/24hr sensors.

Just my 2 cents fwiw

1 Like

Yes, those queries are sums. The Last 24hr one in particular I tweaked to make sure that it matched the figure shown in the app.

I like your idea of supporting the statistics sensor, so I added a current_min sensor to my version as well. You could also use this to drive a template binary sensor, which I think would approximate what the app is doing for Water Status (Running / Not Running).

Does anyone have any ideas. It was working, but after a restart I get this.

Error while setting up platform flume
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/flume/sensor.py", line 44, in setup_platform
    sensor_list = list(flume.get_usage().keys())
  File "/config/custom_components/flume/flume_homeassistant.py", line 121, in get_usage
    return {k: v[0]['value'] for k, v in values.items()}
  File "/config/custom_components/flume/flume_homeassistant.py", line 121, in <dictcomp>
    return {k: v[0]['value'] for k, v in values.items()}
IndexError: list index out of range

Still can’t figure this out. Removed flume tokens file but no change.

Is there a way to see if the water is running?

Could use a template sensor with
value_template: {{ states('sensor.flume_current_min')|float > 0 }}

I pushed a couple updates to this project:

  • Added rate limiting to the API calls
  • Added support for litres instead of gallons (:canada:):
    • unit_of_measurement: L

If you’re updating, make sure to grab the manifest.json file, as it’s changed as well.

@ender7 Are you still having trouble?

Actually most of the world :slight_smile:

1 Like