Attribute extraction does not work with suez_water_client

Hello
I am desperate to succeed in extracting an attribute from the suez_water_client sensor.
The entity gives this:
2020-03-08 10_21_25-Window

I want to be able to graph day after day. So I tried to extract this_month_consumption but impossible.

I tried everything but nothing works.

  - platform: template
    sensors:
      consomation_eau:
        friendly_name: "consomation_eau"
        value_template: "{{ state.attr('sensor.suez_water' , 'attribution' , 'this_month_consumption' ) }}"

If someone has an idea.

thank you

value_template: "{{ state.attr('sensor.suez_water', 'this_month_consumption' ) }}"

Thank you for your answer. I tested several solutions. Your solution returns me “unavailable”

Should be state_attr.

Yes I have already read this page and I tried different configuration but rine does not. I already made a template to extract the temperature and humidity without problem but I block it.

Hi, how did you get the suez integration work? never succedeed

Logger: homeassistant.components.sensor
Integration: Capteur (documentation, issues)
First occured: 11:56:22 (1 occurences)
Last logged: 11:56:22

suez_water: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 312, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, 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 "/usr/src/homeassistant/homeassistant/components/suez_water/sensor.py", line 124, in update
    self._fetch_data()
  File "/usr/src/homeassistant/homeassistant/components/suez_water/sensor.py", line 88, in _fetch_data
    self.client.update()
  File "/usr/local/lib/python3.7/site-packages/pysuez/client.py", line 234, in update
    self._fetch_data()
  File "/usr/local/lib/python3.7/site-packages/pysuez/client.py", line 112, in _fetch_data
    yesterday_day)-1][1])*1000)
IndexError: list index out of range

I confirm the issue I had was due to a provider change without notice. Suez is not anymore my drinkable water provider. Sorry for the issue raised.

I have the same problem. suez_water sensor give a json list of historical values (this_month_consumption) and I don’t know how to make an historical graph with that.

Hi all. Did you manage to use data from Suez ?

If anyone would like, here’s an example using the HACS add-on ApexCharts. This will give an 8 week graph ending in the current month, and displays the daily consumption.

I’ve tried to make it slightly more useful by finding a rolling 7 day average, but haven’t been successful at getting that up and running in a format that looks nice. But this code below works, if only to display the available data from the sensor integration!

type: custom:apexcharts-card
update_interval: 1 day
graph_span: 8 weeks
span:
  end: month
header:
  show: false
  title: Suez Water Consumption
series:
  - entity: sensor.suez_water_client
    name: Previous month
    type: column
    data_generator: >
      var dates = entity.attributes.previous_month_consumption; return
      Object.keys(dates).map(function(key, index) {
        var rDate = new Date(key.replace( /(\d{2})\/(\d{2})\/(\d{4})/, "$2/$1/$3"));
        return [rDate, dates[key]]
      });
  - entity: sensor.suez_water_client
    name: Current month
    type: column
    data_generator: >
      var dates = entity.attributes.this_month_consumption; return
      Object.keys(dates).map(function(key, index) {
        var rDate = new Date(key.replace( /(\d{2})\/(\d{2})\/(\d{4})/, "$2/$1/$3"));
        return [rDate, dates[key]]
      });

1 Like