I have described that horribly.
But…I want to use one sensor’s value:
- estimated time to heat pool to temperature (hours)
- name: "Pool Estimate Heat Time"
unit_of_measurement: "Hours"
state: >
{% set pooltemprise = states('sensor.last_pool_temp_average_rise_rate') | float(none) %}
{% set poolsettemp = states('sensor.pool1_heaters0_settemp') | float(none) %}
{% set poolcurrenttemp = states('sensor.pool1_temperature') | float(none) %}
{{ (((poolsettemp) - (poolcurrenttemp)) / pooltemprise) | round(1, default=none) }}
To modify either
a) which binary sensor is called (based on sorting the 1/2hourly forecast electricity prices of Amber, and then counting up to get the highest value (thus identifying X hours are forecast to be <= the computed value.
- binary_sensor:
- name: "Amber Cheapest 2 Hours Trigger"
state: "{{ states('sensor.amber_general_price')|float(0) <= (state_attr('sensor.amber_general_forecast', 'forecasts') | map(attribute='per_kwh')|list|sort).4}}"
- name: "Amber Cheapest 3 Hours Trigger"
state: "{{ states('sensor.amber_general_price')|float(0) <= (state_attr('sensor.amber_general_forecast', 'forecasts') | map(attribute='per_kwh')|list|sort).6}}"
- name: "Amber Cheapest 4 Hours Trigger"
state: "{{ states('sensor.amber_general_price')|float(0) <= (state_attr('sensor.durst_home_general_forecast', 'forecasts') | map(attribute='per_kwh')|list|sort).8}}"
or b) dynamically have the binary sensor fed by a time estimation sensor
( think multiplied by 0.2 and rounded to a single decimal (assuming less than 4.5 hours and 2 decimals if 5 or more hours)…where X is generated by the heating time estimation sensor.
- binary_sensor:
- name: "Amber Cheapest X Hours Trigger"
state: "{{ states('sensor.amber_general_price')|float(0) <= (state_attr('sensor.amber_general_forecast', 'forecasts') | map(attribute='per_kwh')|list|sort)X}}"
with something like
- name: "Pool Estimate Heat Time"
unit_of_measurement: "Hours"
state: >
{% set pooltemprise = states('sensor.last_pool_temp_average_rise_rate') | float(none) %}
{% set poolsettemp = states('sensor.pool1_heaters0_settemp') | float(none) %}
{% set poolcurrenttemp = states('sensor.pool1_temperature') | float(none) %}
{{ (pooltemprise * ((poolsettemp) - (poolcurrenttemp)))*0.2 | round(1) }}
Of course this doesn’t work as i’ve laid it out