madpilot / hass-amber-electric

Home Assistant Component to pull the latest energy prices from Amber Electric
MIT License
26 stars 1 forks source link

Prices are coming through incorrectly #23

Closed OmgImAlexis closed 3 years ago

OmgImAlexis commented 3 years ago

I noticed my energy dashboard was showing the wrong price and dug into this a little. Should this not be 0.33 as the value instead of 33.0?

<template TemplateState(<state sensor.home_general_price=33.0; duration=30.0, date=2021-09-07, per_kwh=33, nem_date=2021-09-07T21:00:00+10:00, spot_per_kwh=13, start_time=2021-09-07T10:30:01+00:00, end_time=2021-09-07T11:00:00+00:00, renewables=13, estimate=True, spike_status=none, channel_type=general, attribution=Data provided by the Amber Electric pricing API, unit_of_measurement=¢/kWh, friendly_name=Home - General  Price, icon=mdi:transmission-tower @ 2021-09-07T20:15:38.135353+09:30>)>

I believe this section is responsible. https://github.com/madpilot/hass-amber-electric/blob/11d5352a6602ba454f4e7fcf61cea959fc91dbb9/custom_components/amberelectric/sensor.py#L131-L136

OmgImAlexis commented 3 years ago

I'm guessing maybe I'm meant to use the _energy_price instead? Issue with that is it throws an error when adding it.

The following entities do not have the expected units of measurement 'AUD/kWh' or 'AUD/Wh':

madpilot commented 3 years ago

Correct - that _energy_price sensor is specifically for the Energy dashboard.

HASS expects $/kWh, Amber works in c/kWh.

See https://github.com/madpilot/hass-amber-electric/pull/19

madpilot commented 3 years ago

This is a documentation issue - I'll make a note of it when I do the docs for the mainline component.

OmgImAlexis commented 3 years ago

I'm confused, adding the _price gives me the wrong value and adding _energy_price gives me an error and doesn't work.

Which one am I meant to pick? 😕

madpilot commented 3 years ago

These are the sensors I have:

For Grid consumption:

image

For return to grid:

image

What error are you getting?

OmgImAlexis commented 3 years ago

image

OmgImAlexis commented 3 years ago

Are you on the latest version of Home Assistant? 2021.9.4?

madpilot commented 3 years ago

No - 2021.8.3. I'll update now and see what happens.

madpilot commented 3 years ago

If that is the case, that is annoying. They explicitly called it the units out to be AUD.

madpilot commented 3 years ago

Where are you getting that error? I just upgraded and I don't see the error anywhere?

OmgImAlexis commented 3 years ago

Remove the energy consumption and re-add it. It shows on the energy settings page.

madpilot commented 3 years ago

Fixed. I think - my Eagle decided to drop its connection with my meter, so I can't re-add it right now, but that error about the units is gone.

madpilot commented 3 years ago

(Yeah, it's fixed)