This would be a big benefit for me and would happily rejig automations - alas I don’t have the skills to contribute. Currently reading through some ideas on using this data to communicate with inverters to stop generation when negative prices are being seen.
Hi all,
Just to let you know I’ve just pushed some changes into the main branch on Github. The new sensor has the following:
- As detailed above, the Solar FiT will no be reflected in a negative value. When you are being charged to feed energy into the grid, this value will return positive.
- A 3rd sensor has now been added which reflects the current cost of controlled load.
Please let me know your feedback, and any ideas for additional enhancements.
Thanks!
Hey Lewis,
Thanks for your work on this component! Makes it super easy for everyone in the house to check the power price before turning on big appliances.
Does anyone have any thoughts on how I can chart the JSON price forecast data on mini-graph-card?
Cheers!
Good stuff, thanks Lewis. Question - is there anywhere I can add logic or a change to then negative the negative - e.g. when i am getting a FIT, positive, when I am being charged, negative?
Hi Lewis and all.
I have another addition if anyone knows how to make it happen.
Tonight the Amber server went FUBAR but the HA plugin still reads the last known price.
This is an issue for automations as they will act according to that incorrect price.
Is there a way to make a failure to download the data show up as such?
Thanks to all who have contributed
Helping myself if I ever have to revisit this. Constant is within sensor.py and is on line 17. When checking version I have is set to 5 minute intervals already.
Hi All, great component!
I’m relatively new to coding and HA. I know how to do past tense charting, more or less, but I wouldn’t know where to start to chart the forecast prices. Would any of you know where to start with this?
Also, for those that are interested:
I’ve taken a couple examples from this forum, plus some other data to produce these templates if anyone’s interested.
Light Power - see this link for a template i’ve put together for a Philips Hue LTW001, one for each globe: Manually calculating power consumption of lights - #25 by cloak
- platform: template
sensors:
living_room_big_lamp_power:
friendly_name: Living Room Big Lamp Power
icon_template: mdi:lightning-bolt
device_class: power
unit_of_measurement: "W"
value_template: >
{% if is_state('light.living_room_big_lamp','on') %}
{% set mired = state_attr("light.living_room_big_lamp","color_temp") %}
{% set brightness = ((state_attr("light.living_room_big_lamp","brightness") - 3) * (100 - 1)) / (254 - 3) + 1 %}
{% set m153 = (0.000435254 * (brightness**2) + (0.002105929 * brightness) + 1.500175321) %}
{% set m203 = (0.00057964 * (brightness**2) + 0.001134825 * brightness + 1.527090668) %}
{% set m253 = (0.000785198 * (brightness**2) - 0.002785236 * brightness + 1.57216088) %}
{% set m303 = (0.000733083 * (brightness**2) - 0.002574077 * brightness + 1.573079888) %}
{% set m353 = (0.000668279 * (brightness**2) - 0.001853391 * brightness + 1.561981489) %}
{% set m403 = (0.000570268 * (brightness**2) + 0.0000671178176666897 * brightness + 1.527920206) %}
{% set m454 = (0.000487813 * (brightness**2) - 0.000161527 * brightness + 1.518884275) %}
{% if mired >= 153 and mired < 203 %}
{{ ((((mired - 153) * (m203 - m153)) / (203 - 153)) + m153)|round(2) }}
{% elif mired >= 203 and mired < 253 %}
{{ ((((mired - 203) * (m253 - m203)) / (253 - 203)) + m203)|round(2) }}
{% elif mired >= 253 and mired < 303 %}
{{ ((((mired - 253) * (m303 - m253)) / (303 - 253)) + m253)|round(2) }}
{% elif mired >= 303 and mired < 353 %}
{{ ((((mired - 303) * (m353 - m303)) / (353 - 303)) + m303)|round(2) }}
{% elif mired >= 353 and mired < 403 %}
{{ ((((mired - 353) * (m403 - m353)) / (403 - 353)) + m353)|round(2) }}
{% elif mired >= 403 and mired < 454 %}
{{ ((((mired - 403) * (m454 - 403)) / (454 - 403)) + m403)|round(2) }}
{% elif mired == 454 %}
{{ m454|round(2) }}
{% endif %}
{% else %}
{{ 0.00 }}
{% endif %}
Customise Glob - change device class to power where applicable so next template sums all
"sensor.*_outlet_power":
device_class: power
Sum all power for device class 'power’
- platform: template
sensors:
sum_power_consumption:
friendly_name: "Power"
unit_of_measurement: 'W'
icon_template: mdi:power-plug
value_template: >
{{ states.sensor
| selectattr('attributes.device_class', '==', 'power')
| map(attribute='state') | map('float') | sum }}
Existing prediction templates from Github, new averages, and cost predictions
- platform: template
sensors:
amber_peak_predicted_2h:
friendly_name: "Amber 2 hour peak predicted"
unit_of_measurement: "¢/kWh"
value_template: >-
{% set forecast = states.sensor.amber_general_usage_price.attributes['price_forcecast'] %}
{% set highest = forecast[0:4] | sort(reverse=true, attribute='price') | first() %}
{{highest['price']}}
amber_peak_predicted_4h:
friendly_name: "Amber 4 hour peak predicted"
unit_of_measurement: "¢/kWh"
value_template: >-
{% set forecast = states.sensor.amber_general_usage_price.attributes['price_forcecast'] %}
{% set highest = forecast[0:8] | sort(reverse=true, attribute='price') | first() %}
{{highest['price']}}
amber_peak_predicted_12h:
friendly_name: "Amber 12 hour peak predicted"
unit_of_measurement: "¢/kWh"
value_template: >-
{% set forecast = states.sensor.amber_general_usage_price.attributes['price_forcecast'] %}
{% set highest = forecast[0:24] | sort(reverse=true, attribute='price') | first() %}
{{highest['price']}}
amber_average_predicted_2h:
friendly_name: "Amber 2 hour average predicted"
unit_of_measurement: "¢/kWh"
value_template: >-
{% set forecast = states.sensor.amber_general_usage_price.attributes['price_forcecast'] %}
{{ ((forecast[0:4] | map(attribute='price') | map('float') | sum) / 2) | round(2) }}
amber_average_predicted_4h:
friendly_name: "Amber 4 hour average predicted"
unit_of_measurement: "¢/kWh"
value_template: >-
{% set forecast = states.sensor.amber_general_usage_price.attributes['price_forcecast'] %}
{{ ((forecast[0:8] | map(attribute='price') | map('float') | sum) / 4) | round(2) }}
amber_average_predicted_12h:
friendly_name: "Amber 12 hour average predicted"
unit_of_measurement: "¢/kWh"
value_template: >-
{% set forecast = states.sensor.amber_general_usage_price.attributes['price_forcecast'] %}
{{ ((forecast[0:24] | map(attribute='price') | map('float') | sum) / 12) | round(2) }}
amber_electricity_cost_per_hour:
friendly_name: "Amber Electricity Cost Per Hour"
unit_of_measurement: '¢/hr'
icon_template: mdi:power-plug
value_template: "{{ (((states('sensor.amber_general_usage_price') | float) * (states('sensor.sum_power_consumption')) | float) / 1000) | round(2) }}"
amber_electricity_cost_predicted_2h:
friendly_name: "Amber 2h Electricity Cost Predicted"
# unit_of_measurement: '$'
icon_template: mdi:power-plug
value_template: "{{ '${:,.2f}'.format((((states('sensor.amber_average_predicted_2h') | float) * 2 * (states('sensor.sum_power_consumption')) | float) / 1000 / 100) | round(2)) }}"
amber_electricity_cost_predicted_4h:
friendly_name: "Amber 4h Electricity Cost Predicted"
# unit_of_measurement: '$'
icon_template: mdi:power-plug
value_template: "{{ '${:,.2f}'.format((((states('sensor.amber_average_predicted_4h') | float) * 4 * (states('sensor.sum_power_consumption')) | float) / 1000 / 100) | round(2)) }}"
amber_electricity_cost_predicted_12h:
friendly_name: "Amber 12h Electricity Cost Predicted"
# unit_of_measurement: '$'
icon_template: mdi:power-plug
value_template: "{{ '${:,.2f}'.format((((states('sensor.amber_average_predicted_12h') | float) * 12 * (states('sensor.sum_power_consumption')) | float) / 1000 / 100) | round(2)) }}"
Forgot to add the screenshots - prices are high! My normal 24h cost is less than $1.
Hi again Lewis, I just noticed in my logs this line:
No ‘version’ key in the manifest file for custom integration ‘amberelectric’. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of ‘amberelectric’
I’m currently on the not current 2021.5.4 and have 2021.6.2 pending.
Is this an issue of I upgrade my system, and do I have the latest Amber component, or has this since been addressed?
Cheers
Few outstanding things on this integration.
I have forked it, and corrected the main issues here: davewatson91/hass-amber-electric
And some comments on the fact that this integration is soon to be deprecated here: lewisbenge/hass-amber-electric/issues/25
Nice one @davewatson91 - hopefully can keep going. Definately experiencing pricing mismatches at the moment, painfully obvious with the erratic nature of pricing in the network at the moment.
Hi All,
There is now a new amber API, is anyone looking at how we integrate this with home assistant?
Hey, I’m a one of the devs at Amber, and am in charge of the new API project. I’m also a big Home Assistant user.
I’ve started a new custom component here: GitHub - madpilot/hass-amber-electric: Home Assistant Component to pull the latest energy prices from Amber Electric
Once it’s all thoroughly unit tested, and the rough edges are cleaned up, I want to try merge it to core.
Feel free to play with it in the mean time, there are a bunch of people already using it.
You can see the mega thread about this all in the old repo’s GitHub: ** ATTENTION ** · Issue #25 · lewisbenge/hass-amber-electric · GitHub
Cool. One to keep an eye on. May even switch over to amber if it works well.
Looks great, I’ll give it a go!
Hi! Downloaded & installed up until i try to add the API key. After clicking submit, nothing happens. Anything I’m missing? Can it be manually added?
With the previous api I could set it up without an account. Can I do that with the new api so I can see for myself the prices changing so I can make an informed decision to move my home to Amber. I have solar so I can see my usage and compare to the prices.
You can’t - the new API requires a login.
We are working on demo accounts, but they won’t be done in the short term.
If you email [email protected] with your NMI or address, we can generate a CSV with historic data, which will achieve the same goal.