Integrating Anglia water usage for smart meters (UK)

UPDATE (12/02/2024)

Please see new script by @yatik below

Hi all,

Just in case anyone is interested in integrating Anglia water usage from smart meters in Home assistant, I have created a step by step instruction below based on a script kindly shared by @dan12345 (thank you Dan!) on this post. Dan’s script uploads the usage onto InfluxDB but I removed that bit as I only wanted to ingrate it with Energy Dashboard. I have made some adjustments to the script on deprecated functions and also changed to only pull daily readings, although I am sure it can be easily configured to pull hourly readings as per initial script


  1. Create a usage sensor and a utility meter (to allow adding the data on the Energy Dashboard):
  • Usage sensor configuration under configuration.yaml (make sure you restart HA after adding the below)
   - sensor:
       - name: "Water usage"
         unique_id: water_usage_x
         icon: mdi:water
         state: "0.0"
  • Utility meter configuration using Helper option as per below (input sensor is the sensor created above):

As per my configuration on the above snapshot my utility sensor is ‘sensor.water_usage’, and so HA knows the device is a water sensor and assigns the correct unit please add the below to ‘customize.yaml’

  state_class: total_increasing
  device_class: water
  unit_of_measurement: 'L'  
  1. Install Appdaemon Add-on (to run the script) and add the below Options under Configuration:
  - chromium-chromedriver
  - chromium
  - selenium
init_commands: []
  1. Start Appdaemon so it installs all dependencies and creates “appdaemon” folder under “/config”
  2. [Optional] Once the “appdaemon” folder is created you should be able to see the file /config/appdaemon/appdaemon.yaml. Make sure you add thread_duration_warning_threshold: 80 under appdaemon: as per below example:
  latitude: xx.xxxxxx
  longitude: xx.xxxxxx
  elevation: xxx
  time_zone: Europe/London
  thread_duration_warning_threshold: 80
      type: hass

(the script takes about a minute to run and if this option is not added, it will give you a warning on Appdaemon)

  1. Add the below configuration on this file /config/appdaemon/apps/apps.yaml and restart Appdaemon
  module: GetWaterUsage
  class: GetWaterUsage
  1. Create a .py file with this name “” under the folder /config/appdaemon/apps

  2. Copy script by @yatik into the same file (make sure you update the “App configuration” section with your details and usagesensor, in case the usage sensor you created above has a different name):

  3. Once you’ve saved the above configuration, restart Appdaemon and once it’s loaded you should be able to see an entry on the Add-on logs saying INFO WaterUsage: Starting Water Usage App. Then it’s ready to run.


  • This script is set up to run every day at 11am, which is when the full daily usage of the previous day is available. (for some the daily usage might only be available later on the day, adjust runtime = datetime.time(11, 00, 0) accordingly)
  • Just reiterating what I am saying above, the reading you will be getting is from previous day (Anglia Water only provides readings of the previous day)
  • Some may say I don’t need a usage sensor and a meter sensor, one sensor should be enough to provide the readings and being able to link to the Energy Dashboard, but I tried so many configs and non worked as I wanted, so I just gave up and set it up this way. Feel free to adapt and if it works for you, let me know in the comments :wink:
  • You can also adapt the script as per initially set up by @dan12345 to pull the hourly readings, and make it run every hour or so - Not sure if Anglia Water has limits to the frequency of logins per day, so I wouldn’t recommend these changes.
  • The login on Anglia Water website is not very safe as you may know (no 2nd authentication method), so on the eventuality of them updating their website this script may become broken and I most likely won’t be able to fix it but would be happy to collaborate in case someone more savvy is able to.
  • I am far from even considering myself as a beginner on writing python, so you may notice I have over complicated a few commands, feel free to add your input on this.



Thanks this looks brilliant. I’ve spent
Ages the last few days trying to do something with this and getting no where!!

What is the platform for the sensor?

Struggling to get my configuration.yaml to reload.

Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 31).

Ah yes you’re right! Forgot to add that, see below (also updated on my post):

   - sensor:
       - name: "Water usage"
         unique_id: water_usage_x
         icon: mdi:water
         state: "0.0"

I’d just figured that out and was going to post.


Does the sensor need units I order to add to the energy dashboard?

No, the second sensor you need to create (the utility meter) should read from the water usage sensor, as per snapshot with the configuration of the utility meter. Also forgot to include that you should add the below to your customize.yaml (I’ll update the instructions again…) so HA knows it’s a water device and updates the unit of measurement automatically:

    device_class: water

The above sensor is my utility sensor name, make sure you update with yours.

Suffice to say that I should have noted down all of my steps before writing my post :sweat_smile:

So I’ve got data coming through.

Not got it to come up as a water meter yet that I can add to the dashboard. But this is so much further than I’ve got before!

Can I ask why it’s water_usage_x

Great to hear! We might need some fine tuning along the way but yes currently working well for me.

The water_usage_x it’s required for the script to push the data into, and so the utility meter (once you create it) can then pull the information from. I am sure there’s a way to customize the water_usage_x in such a way that you won’t require a utility meter but haven’t been able to find a config that would work for me. “If it’s working don’t change it”.

Bear in mind that you only need to create the utility meter if you want to incorporate it under the energy dashboard, if not it’s not required.

I’ve created the utility meter. But it doesn’t seem to pull the data from the sensor and nothing is currently showing in the options for water meter on the energy dashboard configuration.

When the script runs. A new sensor is created that had the data. So that part is working for me!

Is your data pulling through as litres and showing as litres or m3?

In app deamon you can define attributes. So
I tried that. But no luck so far with that idea

It takes a while for it to cycle but eventually it will read the value from the sensor, you may have noticed that in the meantime. As for not showing on your energy dashboard options, that’s strange, have you added the below customization?

Can you show me the states attributes of that utility meter? Does it look like the below/


The sensor I created to pull the information from Appdaemon doesn’t have any units, only the utility meter. Once I added the above to customize.yaml the utility meter started showing the values in m3, but for the energy dashboard I don’t believe it matters if it’s L or m3.

I may need to change the usage sensor to input number instead as I think things may get messed up when you restart HA. I’ll feedback after some tests.

So I’ve got it working now!!

I think it might have been partly due to the order of installing it all. And every time I retried there were still sensors and bits from the previous failed attempt.

So after removing it all and restarting HA a few times. I started again.

I also removed the x. So it’s just water usage on the template and the python script.

I’ve also changed it to Litres in the customize.yaml settings

The water_usage_2 sensor is the Water meter. Which I also put those customize settings in for.

Great stuff! There’s always room for improvement thou and I will update the instructions as and when.


Just issued a new update as I was having an error where selenium couldn’t find chromedriver path. I have found that a few services were missing, so I have updated the ‘’ and the Appdaemon configuration as per below:

  - chromium-chromedriver
  - chromium
  - selenium
  - >-
    echo "" >
  - >-
    echo "" >>
  - apk update

All of the updates have been included on my initial post.

Note: For the ones that have already installed it, make these changes only if you’re seeing the same error, if not leave as is.

I started seeing this error today.

I’ve edited the app daemon config and I’m
Still getting the error at the moment

And have you copied the new config?

Apologies. Just added the lines in now that changed.

Appears to be working again.

I’m working on a modified version that combines your work with the original and places hourly data into influxdb.

I’ve then got the data into grafana.

Got it working but just working on how the influxdb sensors communicate back to HA

As the data is always between 12-24 hours behind there’s not really a perfect implementation.

So might just build a water dashboard and ignore the energy bit

Great stuff!

As for the below, I did something similar on my initial set up, also using InfluxDB. I tested two options but I can’t remember which one I preferred Both have their quirks but feel free to try out:

Hey @Zeunas - thank you for doing this and I have finally gotten around to following your instructions to get this all going in HA!

Do I have to wait until the following days 11am to get an initial reading?

Glad I could help :wink:

You can either change the runtime = datetime.time(11, 00, 0) under “Starting APP” section to an hour to run today and then change it back to 11am or you can replace the whole “Starting APP” section with the below config and create a Helper switch “input_boolean.water_reading” to force the update. The latter option is great for when you restar your HA at 11am and you miss the pull request timing, then you can flip this switch to force the update (just a recent update I added to my config :slight_smile: ) I will add it to the instructions.

# Starting APP #

  def initialize(self):
    self.log("Starting Water Usage App")
    runtime  = datetime.time(11, 00, 0)
    self.run_daily(self.StartProcess, runtime)
    self.listen_state(self.StartProcessForced,"input_boolean.water_reading", state="on")    

  #Callback Function to Start the process 
  def StartProcess(self, kwargs):
    self.log("starting process")
    usage = self.GetUsage()
    self.log("Usage: " + usage)
      self.set_state(usagesensor, state = usage)
    except Exception as e:
      self.log("Set Sensor State Error: " + str(e))

  #FORCED Callback Function to Start the process 
  def StartProcessForced(self, entity, attribute, old, new, kwargs):
    self.log("starting process")
    usage = self.GetUsage()
    self.log("Usage: " + usage)
      self.set_state(usagesensor, state = usage)
    except Exception as e:
      self.log("Set Sensor State Error: " + str(e))
1 Like