Custom Component: (Australia) OpenNEM

I’ve created a series of sensors that retrieves data from OpenNEM regarding the National Electricity Market

5 Likes

It should be available in HACS soonish (you can add it as a custom repository now)

OK this is pretty cool… but I need to use some kind of template to edit the name…
image
Would be nice to be able to configure the friendly name to remove OpenNEM nsw1: from the card.
I am using auto-entities and fold-entity-row to display:

          - type: entities
            title: Open National Electricity Market
            show_header_toggle: false
            entities: 
              - type: custom:auto-entities
                card:
                  type: custom:fold-entity-row
                  head:
                    type: section
                    label: OpenNEM
                  open: true
                filter:
                  include:
                    - entity_id: "sensor.opennem_*"
                show_empty: true
                sort:
                  method: name

I know I can customize them…

I’ll add something :slight_smile:

1 Like

also noticed too many decimals for some of the entities:
image

I’ve pushed an update that will allow you to customise the name & fix the decimals

scratch that, somethings gone wrong

1 Like

I think i’ve fixed it - new version available

Just grabbed it.
If I use the name option, can I set that to just a null string?

Name: ''

Also… will it only change the friendly name?

Decimal places seem good now…

Hmm, good question - I dont know if it does.

Is there a method to change the friendly name to be different to the entity name?

There should be. It’s not working anyway. If I use the above it just ignores it. You should be able to set the friendly name in the component.

I’ll do some reading

1 Like

I already set up customise for them anyway. They would need the same prefix otherwise auto-entities won’t work for lovelace.
Great idea for a component anyway. Useful.
Kudos.

1 Like

Cheers - I was talking to a work colleague (another HA user too) the other day about his new energy provider who charges wholesale price* and this developed from a desire to see if we could somehow watch what the current wholesale price was and found the OpenNEM platform.

Its also a little bit depressing to see how little renewables we use in my state (NSW) and that we struggle to meet the energy demand without importing energy

  • its not quite as simple as that as it turns out
1 Like

Yeah I thought it was interesting seeing the renewable vs coal as well… Really interesting info. But hey… we can magically eliminate coal in 10 years right? Lol.

Hey… have you made a nice Lovelac card for this yet? The entity card is pretty ordinary…

No I havent - you’re right that the entities are a bit ordinary though. I’m not sure what I’d want it to be though (I’m not very creative when it comes to this stuff)

Happy to take ideas though!

EDIT: There is a bug/feature where it resets the value to zero if one doesnt exist (its particularly telling on the temperature value) - I probably should fix that too

1 Like

What is the issue with the pricing? I was planning controlling loads based on price.

The wholesale price didnt directly correlate to what the energy provider (Amber) were charging - since I posted that Amber have given me their formula but I’ve done nothing with it yet

Thanks, their ‘pricing’ page fine print does mention a Carbon offset added that is on top of the wholesale. I figure so long as we can get a price signal, that will do for load managment.
… but even better if can factor in the real Amber prices.

So OpenNEM is flooding my logs with errors…

2020-04-09 12:18:20 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.opennem_nsw1_wind fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/opennem/sensor.py", line 156, in update
    self.opennem_data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/opennem/sensor.py", line 194, in update
    _LOGGER.debug("OpenNEM was last updated %s minutes ago, skipping update", (dt_util_utcnow() - self.last_updated))
NameError: name 'dt_util_utcnow' is not defined