A card that display today's electricity prices, as well as tomorrow's, but only when they are available. #110
AkshayRao27
started this conversation in
Show and tell
Replies: 2 comments 5 replies
-
Hello, thank you very much for the detailed instructions! Would it be possible to adjust the color of the bars so that the highest value is red and the lowest value is green all other values should result in a color gradient between red and green? Currently, a separate color is hardcoded for each ct/kWh. I hope you understand what I mean. |
Beta Was this translation helpful? Give feedback.
1 reply
-
what has to be changed in the current code to work with the 3.0.0 update? (€ values instead of cents) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Credit & Disclaimer
The vast majority, no the entire back-bone, of the code that I am using for this card is from @webwude's posts on the Home Assistant Community Thread for this Integration. I have implemented certain details just a tiny bit differently and am using very marginally different labels and a very marginally different card setup.
I'm not a programmer by stretch of the imagination, and this post is a mix of documentation & instruction, so that when I inevitablity forget how any of this works about 2½ weeks from now, future me has something to fall back on. If you need any kind of technical help with any of stuff below, I don't know how much I will be able to contribute ¯\_(ツ)_/¯
What this card does
The Card(s)
12 am to 5 pm:
5 pm to 12 am:
Prerequisites
This card is based on ApexCharts, so if you don't already have that installed, get it via HACS.
For the auto-hide part to work, you need to create a binary sensor that changes state depending on when your provider publishes data for the following day's pricing. You can usually find this information on your provider's website. For example, smartENERGY.at, the provider I am using, say on their API page that they publish data for the following day from 17:00 onwards.
Once you know when the data is available, create a Template Sensor by going to Settings → Devices & Services → Helpers → Create Helper → Template → Template a sensor. Give it a reasonable name (I called mine "Display Tomorrow's Energy Graph (between 17:00 & 00:00)", with the entity name being
sensor.display_tomorrow_s_energy_graph_between_17_00_00_00
). In the State Template field, put inThis code returns the current time as a decimal number, and returns
true
if that number is between 17 & 23. We use this value to ensure that the card with tomorrow's pricing is only displayed between 5 pm and 11 pm.Code
In your dashboard, add a "Vertical Stack", select "Show Code Editor" and paste in:
Assumptions
This code assumes that:
sensor.epex_spot_data_net_price
.entity
is mentioned.entity
actually has the information you are trying to display, and update theentry
in eachdata_generator
accordingly. In my case, the part ofsensor.epex_spot_data_net_price
that displays an attribute calledprice_ct_per_kwh
.Beta Was this translation helpful? Give feedback.
All reactions