Skip to content

Commit f356c31

Browse files
author
committed
Deployed 0d64015 with MkDocs version: 1.6.1
1 parent 7bb27f9 commit f356c31

9 files changed

+384
-42
lines changed

blueprints/index.html

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,15 @@
552552
</span>
553553
</a>
554554

555+
</li>
556+
557+
<li class="md-nav__item">
558+
<a href="#octopus-energy-and-carbon-intensity" class="md-nav__link">
559+
<span class="md-ellipsis">
560+
Octopus Energy and Carbon Intensity
561+
</span>
562+
</a>
563+
555564
</li>
556565

557566
</ul>
@@ -659,6 +668,15 @@
659668
</span>
660669
</a>
661670

671+
</li>
672+
673+
<li class="md-nav__item">
674+
<a href="#octopus-energy-and-carbon-intensity" class="md-nav__link">
675+
<span class="md-ellipsis">
676+
Octopus Energy and Carbon Intensity
677+
</span>
678+
</a>
679+
662680
</li>
663681

664682
</ul>
@@ -687,13 +705,29 @@
687705
<h1 id="blueprints">Blueprints<a class="headerlink" href="#blueprints" title="Permanent link">#</a></h1>
688706
<p><a href="https://www.home-assistant.io/docs/automation/using_blueprints/">Blueprints</a> are an excellent way to get you up and running with the integration quickly. They can also be used as a guide for setting up new automations which you can tailor to your needs.</p>
689707
<h2 id="data-sources">Data Sources<a class="headerlink" href="#data-sources" title="Permanent link">#</a></h2>
690-
<p>The following blueprints can help you configure data sources provided by other integrations</p>
708+
<p>The following blueprints can help you use data from other integrations as the source of your target timeframes.</p>
691709
<h3 id="carbon-intensity">Carbon Intensity<a class="headerlink" href="#carbon-intensity" title="Permanent link">#</a></h3>
692710
<p><a href="https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fbottlecapdave.github.io%2FHomeAssistant-TargetTimeframes%2Fblueprints%2Ftarget_timeframes_carbon_intensity.yaml">Install blueprint</a> | <a href="target_timeframes_carbon_intensity.yaml">Source</a></p>
693711
<p>This blueprint will provide the data source for the UK Carbon Intensity as provided by the <a href="https://github.com/BottlecapDave/HomeAssistant-CarbonIntensity">Carbon Intensity</a> integration.</p>
712+
<div class="admonition warning">
713+
<p class="admonition-title">Warning</p>
714+
<p>This automation will run when any of the underlying entities update. This make take a while initially. If you want the data available immediately, then you'll need to run the automation manually.</p>
715+
</div>
694716
<h3 id="octopus-energy">Octopus Energy<a class="headerlink" href="#octopus-energy" title="Permanent link">#</a></h3>
695-
<p><a href="https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fbottlecapdave.github.io%2FHomeAssistant-TargetTimeframes%2Fblueprints%2Ftarget_timeframes_octopus_energy.yaml">Install blueprint</a> | <a href="target_timeframes_octopus_energy.yaml">Source</a></p>
717+
<p><a href="https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fbottlecapdave.github.io%2FHomeAssistant-TargetTimeframes%2Fblueprints%2Ftarget_timeframes_octopus_energy.yaml">Install blueprint (No Free Electricity)</a> | <a href="target_timeframes_octopus_energy.yaml">Source</a></p>
718+
<p><a href="https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fbottlecapdave.github.io%2FHomeAssistant-TargetTimeframes%2Fblueprints%2Ftarget_timeframes_octopus_energy.yaml">Install blueprint (Free Electricity Included)</a> | <a href="target_timeframes_octopus_energy.yaml">Source</a></p>
696719
<p>This blueprint will provide the data source for Octopus Energy rates as provided by the <a href="https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy">Octopus Energy</a> integration.</p>
720+
<div class="admonition warning">
721+
<p class="admonition-title">Warning</p>
722+
<p>This automation will run when any of the underlying entities update. This make take a while initially. If you want the data available immediately, then you'll need to run the automation manually.</p>
723+
</div>
724+
<h3 id="octopus-energy-and-carbon-intensity">Octopus Energy and Carbon Intensity<a class="headerlink" href="#octopus-energy-and-carbon-intensity" title="Permanent link">#</a></h3>
725+
<p><a href="https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fbottlecapdave.github.io%2FHomeAssistant-TargetTimeframes%2Fblueprints%2Ftarget_timeframes_octopus_energy_carbon_intensity.yaml">Install blueprint</a> | <a href="target_timeframes_octopus_energy_carbon_intensity.yaml">Source</a></p>
726+
<p>This blueprint will provide the data source for Octopus Energy rates as provided by the <a href="https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy">Octopus Energy</a> integration and UK Carbon Intensity as provided by the <a href="https://github.com/BottlecapDave/HomeAssistant-CarbonIntensity">Carbon Intensity</a> integration. It will multiply the OE rate by the carbon intensity, resulting in target timeframes favouring periods with low rates, and then falling back to carbon intensity where rates are the same.</p>
727+
<div class="admonition warning">
728+
<p class="admonition-title">Warning</p>
729+
<p>This automation will run when any of the underlying entities update. This make take a while initially. If you want the data available immediately, then you'll need to run the automation manually.</p>
730+
</div>
697731

698732

699733

blueprints/target_timeframes_carbon_intensity.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
blueprint:
22
name: Target Timeframes - Carbon Intensity source
3-
description: Configures a targe timeframe data source from Carbon Intensity
3+
description: Configures a target timeframe data source from Carbon Intensity
44
domain: automation
55
author: BottlecapDave
66
input:
@@ -16,7 +16,7 @@ blueprint:
1616
multiple: false
1717
carbon_intensity_current_day_rates:
1818
name: Current day rates
19-
description: The current day rates event sensor supplied by Carbon Intensity
19+
description: The current day rates event sensor supplied by Carbon Intensity. More information can be found at https://bottlecapdave.github.io/HomeAssistant-CarbonIntensity/entities/#current-day-rates.
2020
selector:
2121
entity:
2222
filter:
@@ -26,7 +26,7 @@ blueprint:
2626
multiple: false
2727
carbon_intensity_next_day_rates:
2828
name: Next day rates
29-
description: The next day rates event sensor supplied by Carbon Intensity
29+
description: The next day rates event sensor supplied by Carbon Intensity. More information can be found at https://bottlecapdave.github.io/HomeAssistant-CarbonIntensity/entities/#next-day-rates.
3030
selector:
3131
entity:
3232
filter:
@@ -49,20 +49,20 @@ condition: []
4949
action:
5050
- action: target_timeframes.update_target_timeframe_data_source
5151
data: >
52-
{% set all_rates = [] %}
53-
{% if state_attr(carbon_intensity_current_day_rates, 'rates') != None %}
54-
{% set all_rates = all_rates + state_attr(carbon_intensity_current_day_rates, 'rates') %}
55-
{% endif %}
56-
{% if state_attr(carbon_intensity_next_day_rates, 'rates') != None %}
57-
{% set all_rates = all_rates + state_attr(carbon_intensity_next_day_rates, 'rates') %}
58-
{% endif %}
59-
{% set data = namespace(new_rates=[]) %}
60-
{% for rate in all_rates %}
61-
{% set start = rate["from"] | as_timestamp | timestamp_utc %}
62-
{% set end = rate["to"] | as_timestamp | timestamp_utc %}
63-
{% set value = rate["intensity_forecast"] | float %}
64-
{% set data.new_rates = data.new_rates + [{ 'start': start , 'end': end, 'value': value, 'metadata': { "generation_mix": rate["generation_mix"] } }] %}
65-
{% endfor %}
52+
{%- set all_rates = [] -%}
53+
{%- if state_attr(carbon_intensity_current_day_rates, 'rates') != None -%}
54+
{%- set all_rates = all_rates + state_attr(carbon_intensity_current_day_rates, 'rates') -%}
55+
{%- endif -%}
56+
{%- if state_attr(carbon_intensity_next_day_rates, 'rates') != None -%}
57+
{%- set all_rates = all_rates + state_attr(carbon_intensity_next_day_rates, 'rates') -%}
58+
{%- endif -%}
59+
{%- set data = namespace(new_rates=[]) -%}
60+
{%- for rate in all_rates -%}
61+
{%- set start = rate["from"] | as_timestamp | timestamp_utc -%}
62+
{%- set end = rate["to"] | as_timestamp | timestamp_utc -%}
63+
{%- set value = rate["intensity_forecast"] | float -%}
64+
{%- set data.new_rates = data.new_rates + [{ 'start': start , 'end': end, 'value': value, 'metadata': { "generation_mix": rate["generation_mix"] } }] -%}
65+
{%- endfor -%}
6666
{{ { 'data': data.new_rates } | to_json }}
6767
target:
6868
entity_id: !input target_timeframe_data_source_sensor

blueprints/target_timeframes_octopus_energy.yaml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ blueprint:
1616
multiple: false
1717
octopus_energy_previous_day_rates:
1818
name: Previous day rates
19-
description: The previous day rates event sensor supplied by Octopus Energy
19+
description: The previous day rates event sensor supplied by Octopus Energy. More information can be found at https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/electricity/#previous-day-rates.
2020
selector:
2121
entity:
2222
filter:
@@ -26,7 +26,7 @@ blueprint:
2626
multiple: false
2727
octopus_energy_current_day_rates:
2828
name: Current day rates
29-
description: The current day rates event sensor supplied by Octopus Energy
29+
description: The current day rates event sensor supplied by Octopus Energy. More information can be found at https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/electricity/#current-day-rates.
3030
selector:
3131
entity:
3232
filter:
@@ -36,7 +36,7 @@ blueprint:
3636
multiple: false
3737
octopus_energy_next_day_rates:
3838
name: Next day rates
39-
description: The next day rates event sensor supplied by Octopus Energy
39+
description: The next day rates event sensor supplied by Octopus Energy. More information can be found at https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/electricity/#current-day-rates.
4040
selector:
4141
entity:
4242
filter:
@@ -52,6 +52,8 @@ variables:
5252
mode: queued
5353
max: 4
5454
triggers:
55+
- platform: state
56+
entity_id: !input octopus_energy_previous_day_rates
5557
- platform: state
5658
entity_id: !input octopus_energy_current_day_rates
5759
- platform: state
@@ -60,23 +62,27 @@ condition: []
6062
action:
6163
- action: target_timeframes.update_target_timeframe_data_source
6264
data: >
63-
{% set all_rates = [] %}
64-
{% if state_attr(octopus_energy_previous_day_rates, 'rates') != None %}
65-
{% set all_rates = all_rates + state_attr(octopus_energy_previous_day_rates, 'rates') %}
66-
{% endif %}
67-
{% if state_attr(octopus_energy_current_day_rates, 'rates') != None %}
68-
{% set all_rates = all_rates + state_attr(octopus_energy_current_day_rates, 'rates') %}
69-
{% endif %}
70-
{% if state_attr(octopus_energy_next_day_rates, 'rates') != None %}
71-
{% set all_rates = all_rates + state_attr(octopus_energy_next_day_rates, 'rates') %}
72-
{% endif %}
73-
{% set data = namespace(new_rates=[]) %}
74-
{% for rate in all_rates %}
75-
{% set start = rate["start"] | as_timestamp | timestamp_utc %}
76-
{% set end = rate["end"] | as_timestamp | timestamp_utc %}
77-
{% set value = rate["value_inc_vat"] | float %}
78-
{% set data.new_rates = data.new_rates + [{ 'start': start , 'end': end, 'value': value, 'metadata': { "is_capped": rate["is_capped"] } }] %}
79-
{% endfor %}
65+
{%- set all_rates = [] -%}
66+
{%- if state_attr(octopus_energy_previous_day_rates, 'rates') != None -%}
67+
{%- set all_rates = all_rates + state_attr(octopus_energy_previous_day_rates, 'rates') -%}
68+
{%- endif -%}
69+
{%- if state_attr(octopus_energy_current_day_rates, 'rates') != None -%}
70+
{%- set all_rates = all_rates + state_attr(octopus_energy_current_day_rates, 'rates') -%}
71+
{%- endif -%}
72+
{%- if state_attr(octopus_energy_next_day_rates, 'rates') != None -%}
73+
{%- set all_rates = all_rates + state_attr(octopus_energy_next_day_rates, 'rates') -%}
74+
{%- endif -%}
75+
{%- set data = namespace(new_rates=[]) -%}
76+
{%- for rate in all_rates -%}
77+
{%- set start = rate["start"] | as_timestamp | timestamp_utc -%}
78+
{%- set end = rate["end"] | as_timestamp | timestamp_utc -%}
79+
{%- set value = rate["value_inc_vat"] | float -%}
80+
81+
{%- set metadata = { "is_capped": rate["is_capped"] } -%}
82+
{%- set new_rate = [{ 'start': start , 'end': end, 'value': value, 'metadata': metadata }] -%}
83+
84+
{%- set data.new_rates = data.new_rates + new_rate -%}
85+
{%- endfor -%}
8086
{{ { 'data': data.new_rates } }}
8187
target:
8288
entity_id: !input target_timeframe_data_source_sensor

0 commit comments

Comments
 (0)