Flume Water Meter

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

@michaeldavie, yes. I reboot HA regularly as I am working on some configs. The flume plugin will throw this error and not get results after 80-90% of the HA restarts. Eventually, if I restart enough, it will eventually work, but then error again on next reboot. Iā€™m just using it stock. No changes. Deleting flume tokens doesnā€™t have any effect. It seems to be getting data in that list it doesnā€™t expect.

@ender7 I think Iā€™ve fixed this. It had to do with the API limit, which I think Iā€™ve accounted for correctly in the latest version. Please give the latest files a try and let me know if itā€™s working correctly for you or not.

For those interested in a running water binary sensor, I think this should do the trick:

binary_sensor:
  - platform: template
    sensors:
      water_running:
        device_class: moisture
        value_template: "{{ states('sensor.current_min') | float > 0 }}"

Thanks. Will do. In the process of porting my vmā€™s and docker containers to a new server, but will give this a try and report back as soon as they are back up and running.

Iā€™m still having the IndexError: list index out of range on the newest version.

I also have problems with the latest release.
Here is portion of my log file.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 249, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 419, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  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 91, in update
    self.flume.update_usage()
  File "/config/custom_components/flume/flume_homeassistant.py", line 16, in res
    return fun(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/ratelimit/decorators.py", line 80, in wrapper
    return func(*args, **kargs)
  File "/config/custom_components/flume/flume_homeassistant.py", line 139, in update_usage
    values = response.json()['data'][0]
IndexError: list index out of range
2019-08-18 10:26:02 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.last_24_hrs fails

This is great work. I am getting the Flume and looking forward to using it. I was wondering if anyone in this thread also has Smartthings? I noticed there was a way to connect Smartthings to Home Assistant, so I figured I would ask in here. So far, I am not aware of any integration between Flume and Smartthings, but it would be great to be able to see the data and create actions based on water flow (e.g., shutting off an automatic water valve after certain parameters are met).

Why would you need smart things for that if the flume is available as a home assistant integration?

I donā€™t have Home Assistant, at least not yet. There might also be things that can be learned in the integration here that might help users on other platforms, such as Smartthings and Hubitat. I do know some people have multiple platforms.

That is fine, but this forum is about home assistant.

Iā€™m having the index error as well after a restart. Any way to tell if it is hitting the API limits? I suspect that might be the cause.

just installed flume and set this up on 0.99.3 and got the following error:

flume: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 441, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  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 92, in update
    gallons = round(self.flume.usage.get(self.sensor_type), 2)
TypeError: type NoneType doesn't define __round__ method

Pretty sure at this point most everyone is getting this same error - I donā€™t think the custom component works at all anymore (at least it hasnā€™t for me). Iā€™m hoping that at some point the custom component dev or someone else with sufficient expertise can create a reliable update for this!

Sorry, I havenā€™t been paying attention to thisā€¦let me take a look.

2 Likes

Iā€™m receiving the same errors too. Hopefully @michaeldavie will be able to fix it when he can. With Hacktoberfest in full swing, there is another effort to get Flume integrated into HA.