- binary_sensor: - name: "DHW: Use Boiler Aux Heater" unique_id: "dhw_config_use_boiler_aux_heater" state: > {% set manual_on = states('input_boolean.dhw_aux_heater_manual_override') == 'on' %} {% set hp_aux_off = states('sensor.heat_pump_auxiliary_heater') != 'on' %} {% set boiler_aux_allowed = states('input_boolean.dhw_allow_aux_heater_usage') == 'on' %} {% set boiler_temp_ok = states('sensor.boiler_temp')|float < states('input_number.dhw_aux_heater_cut_off_temperature_threshold')|float %} {# allowed checks if the resistance is permitted to run, mostly to check we're not running both boiler and HP resistance at the same time #} {% set allowed = hp_aux_off and boiler_aux_allowed and boiler_temp_ok %} {# here go various other conditions that influence the decision to run the boiler auxiliary heater #} {# PV Excess to boiler - now using shadow thermostat #} {% set pv_excess = states('input_boolean.dhw_use_excess_pv_for_aux_heater') == 'on' and state_attr('climate.dhw_pv_excess_heating', 'hvac_action') == 'heating' %} {% set thermostat_activity_boost = state_attr('climate.boiler_temperature','preset_mode') == 'activity' and state_attr('climate.boiler_temperature','hvac_action') == 'heating'%} {% set thermostat_normal_boost = states('input_boolean.dhw_allow_aux_heater_in_all_modes') == 'on' and state_attr('climate.boiler_temperature','hvac_action') == 'heating'%} {{ manual_on or (allowed and ( pv_excess or thermostat_activity_boost or thermostat_normal_boost )) }} - name: "DHW: PV Power Enough for Aux Heater " unique_id: "dhw_pv_power_enough_for_aux_heater" state: > {% set phase_buffer = states('input_number.dhw_pv_excess_usage_buffer')|float / 3 %} {% set phase_heater_power= states('input_number.dhw_aux_heater_power')|float /3 %} {% set turn_on_threshold = -1*(phase_buffer+phase_heater_power) %} {% if is_state('switch.boiler_heater_relay_switch_0', 'on') %} {{ states('sensor.deye_12_external_ct1_power')|float <= 0 and states('sensor.deye_12_external_ct2_power')|float <= 0 and states('sensor.deye_12_external_ct3_power')|float <= 0 }} {% else %} {{ states('sensor.deye_12_external_ct1_power')|float < turn_on_threshold and states('sensor.deye_12_external_ct2_power')|float < turn_on_threshold and states('sensor.deye_12_external_ct3_power')|float < turn_on_threshold }} {% endif %} device_class: power