Integration of water/electricity/gaz gce-electronics Eco-device

Hello, I’m new to HA development. I’m still just playing, maybe I’m asking something simple. I’ve took a quick look on documentation, but didn’t find quick answers.

I have device for monitoring water/electricity/gaz [http://gce-electronics.com/fr/carte-relais-ethernet-module-rail-din/409-teleinformation-ethernet-ecodevices.html](http://gce-electronics eco-device).
I have not found any ready integration. It seems to be relatively simple, so I’m thinking of creating one and good one to play with HA.

The only useful thing this device can do regarding integration is to send every x seconds simple Get request with with set of params - something like:

[servername]?Mac=$M&C1=$C1&C2=$C2

Where C1, C2 etc is the current value of the meeter. Request is configurable to the extend of naming parmams. It provides user/password possibility, but I’m not sure it is really working. We can forget about auth tokens.

The question is how (or where to start reading in a doc) to expose some service (if that is matters I’m using HA in docker on Synology NAS). Or what other strategy to use? Ideally make something useful not just for me.
The I’ll need to make this service create instances for each metric (but that is in documentation and in github examples).

Ok, found that this device provides xml status data, so as quick solution added such config:

sensor:
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Water today
    select: 'c0day'
    unit_of_measurement: 'litres'
    scan_interval: 30
    #example for every hour 
    #scan_interval: 3600
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Gaz today
    select: 'c1day'
    unit_of_measurement: 'dm3'
    scan_interval: 30 
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Water flow now
    select: 'meter2'
    unit_of_measurement: 'l/m'
    scan_interval: 3  
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Gaz use now
    select: 'meter3'
    unit_of_measurement: 'dm3/m'
    scan_interval: 3  
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Water total
    select: 'count0'
    unit_of_measurement: 'm3'
    scan_interval: 60  
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Gaz total
    select: 'count1'
    unit_of_measurement: 'm3'
    scan_interval: 60   
    value_template: '{{ value / 1000 }}'
  - platform: scrape
    resource: http://192.168.3.30/status.xml
    name: Gaz total
    select: 'count1'
    unit_of_measurement: 'l/m'
    scan_interval: 60
    value_template: '{{ value / 1000 }}'
  - platform: scrape
    resource: http://192.168.3.30/protect/settings/teleinfo1.xml
    name: Electricity tarif
    select: 'T1_PTEC'
    scan_interval: 60
  - platform: scrape
    resource: http://192.168.3.30/protect/settings/teleinfo1.xml
    name: Power usage mpw
    select: 'T1_PPAP'
    unit_of_measurement: 'VA'
    scan_interval: 3
  - platform: scrape
    resource: http://192.168.3.30/protect/settings/teleinfo1.xml
    name: Electricity compteur value
    select: 'T1_BASE'
    scan_interval: 30
    unit_of_measurement: 'kw/h'
    value_template: '{{ value / 1000 }}'

Downside:

  • Can’t show simple field of dayly electricity
  • Having 2 or 3 pages to parse requesting each separately just to read one value.
  • I’m not sure it is proper use of persistent values (such as total value of meter this way)

All this become possible after finding endpoint specification in this post (in French)

Update. Got myself familiar with rest platform. Cleaner configuration:

sensor:
  - platform: rest
    name: Eco Devices Status
    resource: http://192.168.3.30/status.xml
    json_attributes_path: "$.response"
    scan_interval: 2
    value_template: 'OK'
    json_attributes:
      - "c0day"
      - "c1day"
      - "meter2"
      - "meter3"
      - "count0"
      - "count1"
  - platform: rest
    name: Eco Devices Teleinfo1
    resource: http://192.168.3.30/protect/settings/teleinfo1.xml
    json_attributes_path: "$.response"
    scan_interval: 2
    value_template: 'OK'
    json_attributes:
      - "T1_PTEC"
      - "T1_PPAP"
      - "T1_BASE"    
  - platform: template
    sensors:
       water_today:
        friendly_name: "Water today"
        value_template: '{{ states.sensor.eco_devices_status.attributes["c0day"]}}'
        unit_of_measurement: "Litres"
       gaz_today:
        friendly_name: "Gaz today"
        value_template: '{{ states.sensor.eco_devices_status.attributes["c1day"]}}'
        unit_of_measurement: "dm3"
       water_flow_now:
        friendly_name: "Water flow now"
        value_template: '{{ states.sensor.eco_devices_status.attributes["meter2"]}}'
        unit_of_measurement: "l/m"
       gaz_usage_now:
        friendly_name: "Gaz usage now"
        value_template: '{{ states.sensor.eco_devices_status.attributes["meter3"]}}'
        unit_of_measurement: "dm3/m"
       water_total:
        friendly_name: "Water total"
        value_template: '{{ states.sensor.eco_devices_status.attributes["count0"] | multiply(0.001)}}'
        unit_of_measurement: "m3"
       gaz_total:
        friendly_name: "Gaz total"
        value_template: '{{ states.sensor.eco_devices_status.attributes["count1"] | multiply(0.001)}}'
        unit_of_measurement: "m3"
       electricity_tarfi:
        friendly_name: "Electricity tarif"
        value_template: '{{ states.sensor.eco_devices_teleinfo1.attributes["T1_PTEC"] }}'
       power_usage_now:
        friendly_name: "Power usage now"
        value_template: '{{ states.sensor.eco_devices_teleinfo1.attributes["T1_PPAP"] }}'
        unit_of_measurement: "VA"
      electricity_total:
        friendly_name: "Electricity total"
        value_template: '{{ states.sensor.eco_devices_teleinfo1.attributes["T1_BASE"] | multiply(0.001) | round(0.001)}}'
        device_class: "power"
        unit_of_measurement: "kw/h" 

now only two problem stays:

  • Can’t show simple field of daily electricity
  • I’m not sure it is proper use of persistent values (such as total value of meter this way). For electricity I’ve put device_class: “power”. But I don’t see device class for water or gaz in the docs.
1 Like

Hi, so good job. I think you found the best way to explore ecodevice. xml of this material isn’t so good, but there are possibilities.
On the last line, you used T1_BASE for your calcul, but after many researches, and on my own ecodevice, this valor is many many time at “0”. T1_PPAP is better for more calcul.
I found other man who created automation for shelly detector: https://www.canaletto.fr/post/home-assistant-and-energie
I think it’s the way to calculate for 1h / 1day /1week / 1 month the consumption. But i haven’t enought competence to do them.
Hope it will help you for your futur upgrade :slight_smile:

Had no problems, but will take a look. But the principle stays the same.