Skip to content

Commit

Permalink
Add attribute selection for values for tomorrw (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFes authored Jul 4, 2023
1 parent 56b3ce3 commit 31d4a40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Other optional fields are listed below:
### Source sensor settings
|name|type|default|example|description|
|---|---|---|---|---|
|`attr`|string|`raw_today`|`price_data`|The attribute which has the datetimes and prices used by the macro, defaults to `raw_today`|
|`attr_today`|string|`raw_today`|`prices_today`|The attribute which has the datetimes and prices for today used by the macro, defaults to `raw_today`|
|`attr_tomorrow`|string|`raw_tomorrow`|`prices_tomorrow`|The attribute which has the datetimes and prices for today used by the macro, defaults to `raw_tomorrow`|
|`time_key`|string|`"start"`|`"datetime"`|The key used in the attributes of your integration for the start times of the hours|
|`value_key`|string|`"value"`|`"price"`|The key used in the attributes of your integration for the price values|

Expand Down
6 changes: 3 additions & 3 deletions cheapest_energy_hours.jinja
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{%- macro cheapest_energy_hours(sensor, hours, start, end, attr, time_key, value_key, include_today, include_tomorrow, lowest, mode, look_ahead, time_format, no_weight_points, weight) -%}
{%- macro cheapest_energy_hours(sensor, hours, start, end, attr_today, attr_tomorrow, time_key, value_key, include_today, include_tomorrow, lowest, mode, look_ahead, time_format, no_weight_points, weight) -%}
{# Get data out of the selected entity #}
{%- set today = state_attr(sensor, attr | default('raw_today')) -%}
{%- set tomorrow = state_attr(sensor, 'raw_tomorrow') -%}
{%- set today = state_attr(sensor, attr_today | default('raw_today')) -%}
{%- set tomorrow = state_attr(sensor, attr_tomorrow | default('raw_tomorrow')) -%}
{%- set m = mode | default('start') -%}
{%- set wp = no_weight_points | default(1) | int(1) -%}
{%- set h = hours | default(1) | int(1) -%}
Expand Down

0 comments on commit 31d4a40

Please sign in to comment.