TheFes
(The Fes)
October 21, 2023, 5:33pm
21
I’ll update the macro to update the datetimes to local time
For now you can use
{% from 'cheapest_energy_hours.jinja' import cheapest_energy_hours %}
{{ (cheapest_energy_hours('sensor.electricity_price_today', attr_today='Prices', value_key='price', time_key='readingDate', hours=1, lowest='true', mode='time_min') | as_datetime | as_local).strftime('%H:%M') }}
1 Like
complex1
(Frank)
October 21, 2023, 5:51pm
22
Wow, this is an answer at the speed of light.
A small addition and the problem is solved.
If only life were that simple.
Thank you.
TheFes
(The Fes)
October 21, 2023, 6:03pm
23
@complex1 or you update to 3.0.4 which I just released
See this post on how to ask HACS to update the information so you immediately get the update.
1 Like
HAstevo
October 22, 2023, 4:54am
24
Sure, here you go
type: custom:stack-in-card
mode: vertical
title: Tarieven vandaag
cards:
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 33% 66%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
primary: Huidig
secondary: ''
card_mod:
style: |
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: normal;
background: none;
height: 30px !important;
}
- type: custom:mushroom-template-card
primary: >-
{{ states("sensor.steven_current_electricity_market_price") | round(3)
}} om {{ states("sensor.time") }} u.
secondary: null
card_mod:
style: |
mushroom-state-item {
text-align: center;
transform: translateX(0%);
}
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: 400;
height: 30px !important;
}
- type: custom:mushroom-template-card
card_mod:
style: |
ha-card {
margin: -25px 0px 0px 6px;
border-bottom: solid 2px rgba(var(--rgb-disabled), 0.2);
}
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 33% 66%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
primary: Volgend
secondary: ''
card_mod:
style: |
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: normal;
background: none;
height: 30px !important;
}
- type: custom:mushroom-template-card
primary: >-
{{ states("sensor.steven_next_hour_electricity_market_price") |
round(3) }} om 0{{ states("sensor.uur_volgend_tarief") }}.00 u.
secondary: null
card_mod:
style: |
mushroom-state-item {
text-align: center;
transform: translateX(0%);
}
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: 400;
height: 30px !important;
}
- type: custom:mushroom-template-card
card_mod:
style: |
ha-card {
margin: -25px 0px 0px 6px;
border-bottom: solid 2px rgba(var(--rgb-disabled), 0.2);
}
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 33% 66%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
primary: Laagste
secondary: ''
card_mod:
style: |
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: normal;
background: none;
height: 30px !important;
}
- type: custom:mushroom-template-card
primary: '{{ states("sensor.jinja_goedkoopste_uur_vandaag") }} '
secondary: null
card_mod:
style: |
mushroom-state-item {
text-align: center;
transform: translateX(0%);
}
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: 400;
height: 30px !important;
}
- type: custom:mushroom-template-card
card_mod:
style: |
ha-card {
margin: -25px 0px 0px 6px;
border-bottom: solid 2px rgba(var(--rgb-disabled), 0.2);
}
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 33% 66%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
primary: Hoogste
secondary: ''
card_mod:
style: |
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: normal;
background: none;
height: 30px !important;
}
- type: custom:mushroom-template-card
primary: '{{ states("sensor.jinja_duurste_uur_vandaag") }} '
secondary: null
card_mod:
style: |
mushroom-state-item {
text-align: center;
transform: translateX(0%);
}
ha-card {
--ha-card-box-shadow: 0px;
--card-primary-font-size: 16px;
--card-primary-font-weight: 400;
height: 30px !important;
}
- type: custom:mushroom-template-card
card_mod:
style: |
ha-card {
margin: -25px 0px 0px 6px;
border-bottom: solid 2px rgba(var(--rgb-disabled), 0.2);
}
- type: custom:layout-card
layout_type: grid
layout:
grid-template-columns: 74% 26%
grid-gap: 0px;
cards:
- type: custom:mushroom-template-card
primary: Starttijd goedkoopste 2 uur blok
secondary: ''
card_mod:
style: |
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: normal;
background: none;
height: 30px !important;
}
- type: custom:mushroom-template-card
primary: '{{ states("sensor.jinja_start_goedkoopste_2ublok_vandaag") }} u. '
secondary: null
card_mod:
style: |
mushroom-state-item {
text-align: center;
transform: translateX(0%);
}
ha-card {
--card-primary-font-size: 16px;
--card-primary-font-weight: 400;
height: 30px !important;
}
- type: custom:gap-card
height: 20
- square: false
type: grid
columns: 3
cards:
- type: custom:gap-card
height: 20
- show_name: true
name: Lijst Dynamic
show_icon: false
show_state: false
type: button
entity: select.inverter_operation_mode
card_mod:
style: |
ha-card {
background: rgba(150,150,150, 0.1) !important ;
box-shadow: 1px 4px 4px 2px rgba(0,0,0,0.4) !important;
border-radius: 10px !important;
margin-left: auto;
margin-right: auto;
}
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
card_mod:
style:
ha-dialog$: |
div.mdc-dialog__scrim {
backdrop-filter: blur(50px) !important;
-webkit-backdrop-filter: blur(50px) !important;
background: var(--background-image);
background-blend-mode: overlay;
}
title: Aankoop
content:
type: vertical-stack
cards:
- type: vertical-stack
cards:
- type: markdown
content: >-
{%- set prices =
state_attr('sensor.steven_average_electricity_price_today','prices_today')
-%} <table width=80%><td align=left><b><font
size="4">Uur </td><td align=cent><b><font
size="4">Prijs</td></tr> {%- for price in prices -%}
<tr><td align=left>{{as_timestamp(price.time,0)|timestamp_custom('%H:%M')}}</td></td><td align=>{{'%0.3f' % price.price}}</td></tr>
{%- endfor -%} </table>
title: Vandaag
card_mod:
style: |
:host {
--masonry-view-card-margin: -12px 8px 0px 8px;
--ha-card-border-width: 0;
#--ha-card-background: none;
--ha-card-box-shadow: 0;
}
.: |
.card-content {
padding: 0;
}
- type: custom:gap-card
height: 20
- type: custom:gap-card
height: 20
1 Like
HAstevo
October 22, 2023, 5:57pm
26
Hi TheFes,
Update to 3.0.4 gives me
list object has no element 1
Would you like to take a look at this?
Thanks
TheFes
(The Fes)
October 22, 2023, 6:07pm
27
Can you give me the input you used?
HAstevo
October 22, 2023, 6:09pm
28
Here you go
{% from 'cheapest_energy_hours.jinja' import cheapest_energy_hours %}
{{ cheapest_energy_hours('sensor.steven_average_electricity_price_today', attr_today='prices_today', hours=1, value_key='price', time_key='time') }}
HAstevo
October 22, 2023, 6:12pm
29
{% from 'cheapest_energy_hours.jinja' import cheapest_energy_hours %}
{{ cheapest_energy_hours('sensor.steven_average_electricity_price_today', attr_today='prices_today', hours=1, lowest=True, mode='max', value_key='price', time_key='time') }}
gives me
No data within current selection
HAstevo
October 22, 2023, 6:17pm
30
My entsoe is working
{{ states('sensor.steven_average_electricity_price_today')}}
0.06458
TheFes
(The Fes)
October 22, 2023, 6:18pm
31
Are you sure the sensor is working?
HAstevo
October 22, 2023, 6:25pm
32
Before V 3.0.4 the sensors worked. And Entsoe is loaded see result above.
Give me a sec to restart of HA
HAstevo
October 22, 2023, 6:31pm
33
Nope, restart HA gives the same output
No data within current selection
TheFes
(The Fes)
October 22, 2023, 6:31pm
34
can you post the data from developer tools > states for the sensor
I need the yaml data, so first click on the sensor, and then copy the yaml for the attributes.
HAstevo
October 22, 2023, 6:33pm
35
Here you go
state_class: measurement
prices_today:
- time: '2023-10-23 00:00:00+02:00'
price: 0.10768
- time: '2023-10-23 01:00:00+02:00'
price: 0.10069
- time: '2023-10-23 02:00:00+02:00'
price: 0.10128
- time: '2023-10-23 03:00:00+02:00'
price: 0.10019
- time: '2023-10-23 04:00:00+02:00'
price: 0.09888
- time: '2023-10-23 05:00:00+02:00'
price: 0.10583
- time: '2023-10-23 06:00:00+02:00'
price: 0.12126
- time: '2023-10-23 07:00:00+02:00'
price: 0.1643
- time: '2023-10-23 08:00:00+02:00'
price: 0.19144
- time: '2023-10-23 09:00:00+02:00'
price: 0.15178
- time: '2023-10-23 10:00:00+02:00'
price: 0.12807
- time: '2023-10-23 11:00:00+02:00'
price: 0.10903
- time: '2023-10-23 12:00:00+02:00'
price: 0.10226
- time: '2023-10-23 13:00:00+02:00'
price: 0.10322
- time: '2023-10-23 14:00:00+02:00'
price: 0.107
- time: '2023-10-23 15:00:00+02:00'
price: 0.11898
- time: '2023-10-23 16:00:00+02:00'
price: 0.12536
- time: '2023-10-23 17:00:00+02:00'
price: 0.13939
- time: '2023-10-23 18:00:00+02:00'
price: 0.14918
- time: '2023-10-23 19:00:00+02:00'
price: 0.15621
- time: '2023-10-23 20:00:00+02:00'
price: 0.12809
- time: '2023-10-23 21:00:00+02:00'
price: 0.104
- time: '2023-10-23 22:00:00+02:00'
price: 0.10822
- time: '2023-10-23 23:00:00+02:00'
price: 0.09276
prices_tomorrow: []
prices:
- time: '2023-10-22 00:00:00+02:00'
price: 0.03986
- time: '2023-10-22 01:00:00+02:00'
price: 0.03036
- time: '2023-10-22 02:00:00+02:00'
price: 0.01859
- time: '2023-10-22 03:00:00+02:00'
price: 0.01563
- time: '2023-10-22 04:00:00+02:00'
price: 0.01835
- time: '2023-10-22 05:00:00+02:00'
price: 0.03432
- time: '2023-10-22 06:00:00+02:00'
price: 0.03026
- time: '2023-10-22 07:00:00+02:00'
price: 0.0582
- time: '2023-10-22 08:00:00+02:00'
price: 0.05525
- time: '2023-10-22 09:00:00+02:00'
price: 0.06421
- time: '2023-10-22 10:00:00+02:00'
price: 0.05234
- time: '2023-10-22 11:00:00+02:00'
price: 0.0491
- time: '2023-10-22 12:00:00+02:00'
price: 0.04499
- time: '2023-10-22 13:00:00+02:00'
price: 0.02919
- time: '2023-10-22 14:00:00+02:00'
price: 0.03171
- time: '2023-10-22 15:00:00+02:00'
price: 0.05182
- time: '2023-10-22 16:00:00+02:00'
price: 0.07239
- time: '2023-10-22 17:00:00+02:00'
price: 0.12866
- time: '2023-10-22 18:00:00+02:00'
price: 0.1382
- time: '2023-10-22 19:00:00+02:00'
price: 0.14301
- time: '2023-10-22 20:00:00+02:00'
price: 0.13028
- time: '2023-10-22 21:00:00+02:00'
price: 0.11247
- time: '2023-10-22 22:00:00+02:00'
price: 0.10218
- time: '2023-10-22 23:00:00+02:00'
price: 0.09846
- time: '2023-10-23 00:00:00+02:00'
price: 0.10768
- time: '2023-10-23 01:00:00+02:00'
price: 0.10069
- time: '2023-10-23 02:00:00+02:00'
price: 0.10128
- time: '2023-10-23 03:00:00+02:00'
price: 0.10019
- time: '2023-10-23 04:00:00+02:00'
price: 0.09888
- time: '2023-10-23 05:00:00+02:00'
price: 0.10583
- time: '2023-10-23 06:00:00+02:00'
price: 0.12126
- time: '2023-10-23 07:00:00+02:00'
price: 0.1643
- time: '2023-10-23 08:00:00+02:00'
price: 0.19144
- time: '2023-10-23 09:00:00+02:00'
price: 0.15178
- time: '2023-10-23 10:00:00+02:00'
price: 0.12807
- time: '2023-10-23 11:00:00+02:00'
price: 0.10903
- time: '2023-10-23 12:00:00+02:00'
price: 0.10226
- time: '2023-10-23 13:00:00+02:00'
price: 0.10322
- time: '2023-10-23 14:00:00+02:00'
price: 0.107
- time: '2023-10-23 15:00:00+02:00'
price: 0.11898
- time: '2023-10-23 16:00:00+02:00'
price: 0.12536
- time: '2023-10-23 17:00:00+02:00'
price: 0.13939
- time: '2023-10-23 18:00:00+02:00'
price: 0.14918
- time: '2023-10-23 19:00:00+02:00'
price: 0.15621
- time: '2023-10-23 20:00:00+02:00'
price: 0.12809
- time: '2023-10-23 21:00:00+02:00'
price: 0.104
- time: '2023-10-23 22:00:00+02:00'
price: 0.10822
- time: '2023-10-23 23:00:00+02:00'
price: 0.09276
unit_of_measurement: €/kWh
attribution: Data provided by ENTSO-e Transparency Platform
device_class: monetary
icon: mdi:currency-eur
friendly_name: Average electricity price today (steven)
TheFes
(The Fes)
October 22, 2023, 6:43pm
36
what is the time where you are? Is it already the 23rd of October?
Otherwise prices_today
contains tomorrow’s data
HAstevo
October 22, 2023, 6:50pm
37
Still 22rd October here
So, it looks like it is the Entsoe integration that gives the wrong output
TheFes
(The Fes)
October 22, 2023, 6:51pm
38
The prices
attribute still has the data of today, looks like you can use that one
Recreated your sensor (as I don’t have an API key) and I can confirm that it works like this:
{% from 'cheapest_energy_hours.jinja' import cheapest_energy_hours %}
{{ cheapest_energy_hours('sensor.steven_average_electricity_price_today', attr_today='prices', hours=1, lowest=True, mode='max', value_key='price', time_key='time') }}
HAstevo
October 22, 2023, 7:05pm
40
Perfect
{% from 'cheapest_energy_hours.jinja' import cheapest_energy_hours %}
{{ cheapest_energy_hours('sensor.steven_average_electricity_price_today', attr_today='prices', hours=1, lowest=True, mode='max', value_key='price', time_key='time') }}
{{ cheapest_energy_hours("sensor.steven_average_electricity_price_today", attr_today='prices', hours=1, lowest=true, mode='time_min', value_key='price', time_key='time', time_format="time24") }}
0.01563
03:00