colinmacgiolla / esb-smart-meter-reading-automation

Automated Smart Meter readings data collection from ESB Networks Ireland registered account (regardless of your current supply provider)

Home Page:https://myaccount.esbnetworks.ie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESB Networks Smart Meter Data to InfluxDB

I've wanted to get the ESB smart data into my Home Assistant setup ever since the energy dashboard became available. Since the meter reports the kW consumed every 30 mins, you'd think an API would be obvious for the end-users, but apparently not.

Thanks to work by badger707 and others we have a fairly good screen-scraping solution, so this fork is just to clean it up a bit, and document the integration to Home Assistant.

NOTES:

Notes on the source data

  • The call to the ESB portal allows the period to be specified, and the script provides today as the date requested. Unfortunately, this parameter is ignored, so we get all the records available e.g. 20k+ and counting.
  • The data is provided every 30 mins in kW units. Home assistant requries this in kWh so in the sensor definition I multiple the value by 0.5 to adjust.
  • The timestamp in the source data is in Irish Standard Time, so I convert to UNIX EPOCH before inserting into the database.
  • Apparently while the datapoints are every 30mins, the data is only updated on a mostly once daily basis.

Script usage

The script will run on demand, or via cron. The required parameters should be in a .secrets file, in the same directory as the script (sample below).

The script is written in python3, and the requirements.txt file shows the dependancies.

It works off of all the data retrieved, so will become less efficient as time goes on. If there is a matching timestamp already in the database, it will be updated with the new value, otherwise any missing data will be inserted.

The following are the required parameters for the config file.

Config file format

[influx]
HOST=<influx db server hostname/IP> 
USER=<username>
PASSWORD=<password>
DB=<name of database>

[esb]
USER=<email address registered with ESB Networks>
PASSWORD=<password>
MPRN=<MPRN - meter reference number, on your bill>

Home Assistant Sensor Configuration

This is in my sensors.yaml

  - platform: influxdb
    api_version: 1
    host: <host>
    username: <username>
    password: <password>
    database: <database>
    verify_ssl: false
    ssl: false
    scan_interval: 1800
    queries:
      - name: ESB Power
        unit_of_measurement: kWh
        value_template: "{{ value | multiply(0.5) }}"
        group_function: last
        measurement: '"meter_reading"'
        field: value
        where: '"MPRN" = ''<MPRN>'''

but we also need to adjust customize.yaml to ensure that we set the type correctly

---
customize:
  sensor.esb_power:
    device_class: energy
    state_class: total

Change Notes

  • Tested 03/01/2024 - working

Tested with

  • Python 3.10.6
  • Home Assistant 2023.12.4
  • InfluxDB 1.8.10

References

About

Automated Smart Meter readings data collection from ESB Networks Ireland registered account (regardless of your current supply provider)

https://myaccount.esbnetworks.ie


Languages

Language:Python 100.0%