Reading Australian smart meter data

I’m trying to work myself through this - one step at a time. Being new to HA doesn’t help :slight_smile: but it looks like the installation is now ok.

Are there any code samples I could adopt to get this data onto my dashboard? Looking at the documentation I believe the template platform is the way to go but given this is the first custom_component I install I’m really tapping in the dark.

I’m using this in lovelace (it could be a lot prettier!) :slight_smile:

type: custom:vertical-stack-in-card
cards:

  - id: energy_rates
    name: Energy Easy
    type: markdown
    content: >
      # ![Image](/local/UE-logo.jpg) Energy Easy

      United Energy’s online data portal to manage electricity usage
      
      https://energyeasy.ue.com.au/electricityView/index

  - id: energy_rates
    name: Energy Rates
    type: horizontal-stack
    cards:
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_supply_charge
        name: Daily Supply Charge
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_single_rate_cost
        name: Rate per kWh
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12

  - id: energy_cost
    name: Energy Cost
    type: horizontal-stack
    cards:
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_yesterday_cost_total
        name: Cost Yesterday
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_this_week_cost_total
        name: Cost this Week
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_this_month_cost_total
        name: Cost this Month
        show: 
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12

  - id: energy_consumption
    name: Energy Consumption
    type: horizontal-stack
    cards:
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_yesterday_consumption
        name: Use Yesterday
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_this_week_consumption
        name: Use this Week
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_this_month_consumption
        name: Use this Month
        show: 
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12

  - id: difference
    name: Difference
    type: horizontal-stack
    cards:
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_yesterday_consumption_difference
        name: Difference
        icon: mdi:plus-minus
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_this_week_consumption_difference
        name: Difference
        icon: mdi:plus-minus
        show:
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
      - type: custom:mini-graph-card
        entities:
        - sensor.energyeasy_this_month_consumption_difference
        name: Difference
        icon: mdi:plus-minus
        show: 
          graph: false
        group: false
        align_icon: right
        align_header: right
        align_state: right
        decimals: 2
        font_size: 60
        font_size_header: 12
1 Like

Finally got around to try this out. After installing the various cards (with HACS) the card you provided saved but it doesn’t display any cards other than the title.

Even if no data was to come in due to say authentication issues I should still see the various cards, right?

Are your sensors named the same?

I don’t get data for consumption (use) and cost at the start of each new week and new month but it does show the heading and ‘NaN’ as the value.

I have used the standard file on GitHub and your config. Had to install a few components such as vertical-stack-in-card and mini-graph-card but after that I could save the integration.

Having examined the log file I found another error: “… integration energyeasy not found”. Thought this error was fixed but apparently not. As advised earlier I have changed the folder structure

from
/custom_components/sensor/energyeasy.py
to:
/custom_components/energyeasy/sensor.py

Could you please provide the corresponding configuration.yaml extract that relates to this integration to eliminate that I have introduced some errors there. txs

Your .yaml for the sensors looks exactly the same as mine, although I’ve commented out the ones I’m not using.

You could try downloading the energyeasy.py file from GitHub again, making sure you have the RAW code
https://github.com/mlevit/HomeAssistant_EnergyEasy/raw/master/energyeasy.py
(and rename it to sensor.py again)

I have a smart meter supplied by Powercor here in Victoria.
I bought an Eagle-200 from http://www.fastnetworks.com.au/new-products/zd34v6n7t2oot1ccyqoyet08jb4y4x-sm5wr
There was a little bit of grief setting it up with Powercor’s portal, but once up and running it was a piece of cake with Home Assistant.

That looks sweet and gives you great insight. Had a quick look at Powercor’s portal which on first sight looks to be similar to United Energy’s portal. Couldn’t you directly get this data from Powercor’s portal rather than directly from the smartmeter which I believe is what you do with the Eagle-200 unless I don’t understand this correctly.

On my end I finally got the integration up. It must have been an issue with the Python script I installed first. Re-installed and it was ok. Didn’t yet make any comparison on the data on Home Assistant vs what I get on the portal but small steps…

I’m not that handy at coding, so I took the easy way out.

It all depends on how detailed you want the data.
Using data from the Powercor website only appears to be in 30 minute increments.
As for accessing my usage via the Eagle, it is real time.
When I turn the kettle on, I see an immediate rise in usage.

Good work with the script - It’s awesome to see people developing smart meter access.
It was that access to data we were promised years ago when they installed them.

I am still getting Integration not found error. Is this custom component still working with latest Hassio version?

Not only that but it’s delayed 24 hours.

nevermind got it working.

What was the fix. I tried this a few months ago, but kept getting Integration not found error. So I gave up…

It was a while back and I was trying all sorts of things but I think it it started working after I added and modified two more files from the original branch that this forked from. https://github.com/mvandersteen/ha-jemenaoutlook, ‘init.py’ and ‘manifest.json’ and rebooted the host not just home assistant.

Thanks for that, adding those 2 files and changing the manifest.json to have energyeasy got it working…

It looks like this doesn’t update the sensors unless you reboot HA… That is annoying… Unless it is just me, Might give it a few days.

Hey guys, sorry for stirring up an old thread.

I just installed the addon with init.py and manifest.json from the jemena rep. I am getting an error in the log:

Error while setting up energyeasy platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 231, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/energyeasy/sensor.py", line 156, in setup_platform
    sensors.append(EnergyEasySensor(energyeasy_data, variable, name))
  File "/config/custom_components/energyeasy/sensor.py", line 180, in __init__
    self._state = round(self.jemenaoutlook_data.data[self.type], 2)
TypeError: type NoneType doesn't define __round__ method

not sure what to make of it. looking at the code, it clearly passes the check (if statement) that checks for noneType:

if self.type in self.energyeasy_data.data is not None:
            if type(self.energyeasy_data.data[self.type]) == type(''):
                self._state = self.energyeasy_data.data[self.type]
            else:
                self._state = round(self.energyeasy_data.data[self.type], 2)

it passes the first condition but fails with noneType on the else statement. I don’t get it, can anyone help?

Found the issue.

On line 164 - “def init(self, energyeasy_data, sensor_type, name):” is indented twice instead of once.
all fixed now.

hmm, do you mind posting that section of the code? Mine doesn’t start as well but I don’t follow your solution when looking at my code. txs

Got into sensor.py, find this line: " def init (self, energyeasy_data, sensor_type, name): " ensure the line is in line with other functions and not indented.

I’d post the code, but it’ll be pointless if you just need to remove one indent level from a line.