Integrating Anglia water usage for smart meters (UK)

Thanks @Zeunas for checking in on my bumpy progress!

Your snapshot was the original helper config I used but the readings never made its way to the Energy Dashboard - in fact, you may recall I also had an error on the dashboard setup page saying “Unexpected State Class”. That is when I added state_class: total increasing to customize.yaml.

I also was reading your exchange with @rodgers86 and I updated the GetWaterUsageHourly.py script to use sensor.water_usage rather than sensor.water_usage_x and I also added the extra sensor.water_usage_meter: code to customize.yaml too.

My daily readings show up fine in a minigraph card from the sensor.water_usage entity but sadly still not in the utility meter.

I was thinking my next step would be to clean out everything and start again… But I am still not sure if I should have sensor.water_usage or sensor.water_usage_x in your GetWaterUsageHourly.py code and also when setting up the utility meter!

I started again completely, probably a couple of
Times before I got it to work. And had to clear bits and restart HA a couple of times to make sure it was completely gone.

For mine I just called the sensor

sensor.water_usage

In the python script it’s

usagesensor = "sensor.water_usage"

The meter is called

sensor.water_usage_meter

And it takes its data from sensor.water_usage

And in configuration.yaml this is what I have.

homeassistant:
    customize:
       sensor.water_usage:
         device_class: water
         unit_of_measurement: L
       sensor.water_usage_meter:
         device_class: water
         unit_of_measurement: L

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

1 Like

Thanks @rodgers86 - this is exactly how mine is setup. I think I probably just need to clear out everything and take another run at it!

Site is now under maintenance lets see if they don’t break the login process…

I’m in the exact same position as you, did you get the energy dashboard part working in the end?

Can you share config and customize please?

Hi @thewillwilson - I’m on holiday at the moment so haven’t taken another run at it yet. In the meantime I do have the information surfaced in a mushroom graph/bar card…

1 Like

Very similar to above, but here it is:

Config file:


homeassistant:
  customize: !include customize.yaml

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

Customise file:

sensor.water_usage:
  device_class: water
  unit_of_measurement: L
sensor.water_usage_meter:
  device_class: water
  unit_of_measurement: L
  state_class: total_increasing

Sensor helper made via the tempalte is called sensor.water_usage_meter

1 Like

Managed to get this to work in the end, I had to go into dev tools then check stats errors, there was one pending so just autofixed it and now it’s all working

Great! thank you for letting me know.

Sorry for just replying now, busy week. Do let me know if you have any more issues.

I’m a very new HA user - but decided to give this a go and finally have it working, thank you for your efforts.
I was convinced it was something I’d done (or not done) causing it to not work, I’m running appdaemon via Docker rather than as an addon (HAOS decided to just not work at all for me unfortunately) and I convinced myself I was missing a package or something as I kept getting compile errors.

It seems there’s a stray indent on line 51 of the script that caused all the fuss.

@thewillwilson / @Zeunas - Back from holiday. It seemed that deleting and reconfiguring the Utility Meter Helper fixed my issue getting the data into the Energy dashboard.

I will push on and try and use @rodgers86 input to get an hourly view too.

Thanks everyone!

I have got this set up and running but my usage is showing on the wrong day in the energy dashboard. It shows yesterdays usage today. How do I fix this? I’m using the scrips from the first post.

Did you set up the Utility meter exactly as the picture in the first post?
I think the “Meter reset offset” of 1 is the bit that shifts the reading back by a day.

As per notes on my instructions this script reads the last available full day from your account, thus the reading your getting is from previous day.
What the script does in Appdaemon is to open a chrome tab, login to your account, select to see usage and takes the usage from the daily consumption, like you would do if you had to do it manually. The initial script from Dan1234 has an extra step which is to select the hourly graph and take the hourly usage which is “live”, by adjusting the script as per Dan’s initial scrip you can have daily consumptions but you’d have to run it more often.

Hope this makes sense.

Hey,

Thanks for working on this and grabbing this data. So I set this up earlier in the month with both the hourly and the script provided (I had been having some issues with the daily script but i think it was my own error, waiting till tomorrow to see if it works now). The hourly script appears it was working for a few days but now I get nothing and no errors. (I had added some extra error checking for InfluxDB as I had some issues getting that connected for the hourly script)

Maybe something has changed slightly format wise. I’ll look into this more but wondering if others have seen this. Cheers

Did you check your Anglia Water accounts to see if there are any new hourly readings at all? I checked the Elements of the Anglia Water website and they are all the same as per initial hourly script, meaning that the script should still work.

Hi, I was still getting the hourly readings in my accounts. I console logged and the JSON I got out of it was valid. So it’s probably InfluxDB. I’ll look into it more later in the week. Cheers though

Is it possible to get hourly data into Home Assistant without using InfluxDB?

Yes, you just need to adapt my script with the initial script from Dan as per my initial post. Basically telling app Daemon to instead of clicking on daily consumption to click on hourly consumption. Let me know if this is clear or if you need any help with modifying my script.