input_number: warmer_outside_difference_trigger: name: Warmer Outside Difference Trigger icon: mdi:sun-snowflake-variant min: 0 max: 20 step: 1 cooler_outside_difference_trigger: name: Cooler Outside Difference Trigger icon: mdi:sun-snowflake-variant min: 0 max: 20 step: 1 template: - binary_sensor: # This is ON when it is warmer outside than it is inside, as defined by input_number.warmer_outside_difference_trigger - name: Warmer Outside unique_id: templatebinarysensor.warmer_outside icon: mdi:sun-snowflake-variant device_class: heat delay_on: seconds: 15 delay_off: seconds: 15 availability: "{{ (states('sensor.upstairs_mean_temperature') not in ['unknown', 'unavailable']) and (states('sensor.outdoor_temperature') not in ['unknown', 'unavailable']) }}" state: "{{ iif(states('sensor.outdoor_temperature') | float(default=0) - states('input_number.warmer_outside_difference_trigger') | float(default=0) > states('sensor.upstairs_mean_temperature') | float(default=0) ) }}" attributes: indoors: "{{ states('sensor.upstairs_mean_temperature') | float(default=0) }}" outdoors: "{{ states('sensor.outdoor_temperature') | float(default=0) }}" trigger: "{{ states('input_number.warmer_outside_difference_trigger') | float(default=0) }}" # This is ON when it is cooler outside than it is inside, as defined by input_number.cooler_outside_difference_trigger - name: Cooler Outside unique_id: templatebinarysensor.cooler_outside icon: mdi:sun-snowflake-variant device_class: cold delay_on: seconds: 15 delay_off: seconds: 15 availability: "{{ (states('sensor.upstairs_mean_temperature') not in ['unknown', 'unavailable']) and (states('sensor.outdoor_temperature') not in ['unknown', 'unavailable']) }}" state: "{{ iif(states('sensor.outdoor_temperature') | float(default=0) + states('input_number.cooler_outside_difference_trigger') | float(default=0) < states('sensor.upstairs_mean_temperature') | float(default=0) ) }}" attributes: indoors: "{{ states('sensor.upstairs_mean_temperature') | float(default=0)}}" outdoors: "{{ states('sensor.outdoor_temperature') | float(default=0)}}" trigger: "{{ states('input_number.cooler_outside_difference_trigger') | float(default=0) }}" # This is ON when the temperature outside is hotter than the temp_high configured as part of the climate platform - name: Too Hot Outside unique_id: templatebinarysensor.too_hot_outside icon: mdi:weather-sunny device_class: heat delay_on: seconds: 15 delay_off: seconds: 15 availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) and (states('sensor.outdoor_temperature') not in ['unknown', 'unavailable']) }}" state: "{{states('sensor.outdoor_temperature') | float(default=0) > states('sensor.hvac_target_temp_high') | float(default=0) - (states('input_number.warmer_outside_difference_trigger') | float(default=0) / 2) }}" attributes: outdoor_temp: "{{ states('sensor.outdoor_temperature') | float(default=0)}}" target_temp_high: "{{ state_attr('climate.thermostat','target_temp_high') | float(default=0)}}" # This is ON when the thermostat is hotter than the temp_high configured as part of the climate platform - name: Too Hot Inside unique_id: templatebinarysensor.too_hot_inside icon: mdi:weather-sunny device_class: heat availability: "{{ (states('sensor.hvac_target_temp_high') not in ['unknown', 'unavailable']) and (states('sensor.upstairs_mean_temperature') not in ['unknown', 'unavailable']) }}" state: "{{states('sensor.upstairs_mean_temperature') | float(default=0) > states('sensor.hvac_target_temp_high') | float(default=(state_attr('climate.thermostat','temperature') |float(default=0))) - 1.0 }}" attributes: upstairs_mean_temp: "{{ states('sensor.upstairs_mean_temperature') | float(default=0)}}" target_temp_high: "{{ states('sensor.hvac_target_temp_high') | float(default=0)}}" target_temperature: "{{ state_attr('climate.thermostat','temperature') |float(default=0) }}" # This is ON when the temperature outside is colder than the temp_low configured as part of the climate platform - name: Too Cold Outside unique_id: templatebinarysensor.too_cold_outside icon: mdi:snowflake device_class: cold delay_on: seconds: 15 delay_off: seconds: 15 availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) and (states('sensor.outdoor_temperature') not in ['unknown', 'unavailable']) }}" state: "{{states('sensor.outdoor_temperature') | float(default=0) < states('sensor.hvac_target_temp_low') | float(default=0) - (states('input_number.cooler_outside_difference_trigger') | float(default=0) ) }}" attributes: outdoor_temp: "{{ states('sensor.outdoor_temperature') | float(default=0)}}" target_temp_low: "{{ state_attr('climate.thermostat','target_temp_low') | float(default=0)}}" # This is ON when the thermostat is hotter than the temp_high configured as part of the climate platform - name: Too Cold Inside unique_id: templatebinarysensor.too_cold_inside icon: mdi:snowflake device_class: cold availability: "{{ (states('sensor.hvac_target_temp_low') not in ['unknown', 'unavailable']) and (states('sensor.upstairs_mean_temperature') not in ['unknown', 'unavailable']) }}" state: "{{states('sensor.upstairs_mean_temperature') | float(default=0) < states('sensor.hvac_target_temp_low') | float(default=(state_attr('climate.thermostat','temperature') |float(default=0))) + 1.0 }}" attributes: upstairs_mean_temp: "{{ states('sensor.upstairs_mean_temperature') | float(default=0)}}" target_temp_low: "{{ states('sensor.hvac_target_temp_low') | float(default=0)}}" target_temperature: "{{ state_attr('climate.thermostat','temperature') |float(default=0) }}" # This is ON when either the garage door or the exterior garage door is open while the inner garage door is open - name: Inner Garage Door Open to Outside unique_id: templatebinarysensor.inner_garage_door_open_to_outside device_class: door availability: "{{ (states('binary_sensor.inner_garage_door_contact') not in ['unknown', 'unavailable']) and (states('binary_sensor.garage_door') not in ['unknown', 'unavailable']) and (states('binary_sensor.outer_garage_door_contact') not in ['unknown', 'unavailable']) }}" state: >- {% if is_state('binary_sensor.inner_garage_door_contact', 'on') %} {% if is_state('binary_sensor.garage_door', 'on') or is_state('binary_sensor.outer_garage_door_contact', 'on') %} {{'true'}} {% else %} {{'false'}} {% endif %} {% else %} {{'false'}} {% endif %} # This is ON when an exterior door or window has been left open for more than 10 minutes - name: Something Open unique_id: templatebinarysensor.something_open icon: mdi:door-open device_class: opening state: "{{ iif(is_state('binary_sensor.patio_door_contact', 'on') or is_state('group.my_exterior_windows', 'on') or is_state('binary_sensor.front_door_contact', 'on') or is_state('binary_sensor.inner_garage_door_open_to_outside', 'on')) }}" - name: Something Open Too Warm or Cold unique_id: templatebinarysensor.something_open_too_warm_or_cold device_class: problem delay_on: minutes: 2 state: >- {% if is_state('binary_sensor.something_open','on') %} {% if is_state('binary_sensor.too_cold_inside','on') and is_state('binary_sensor.cooler_outside', 'on') and is_state('binary_sensor.getting_warmer_outside', 'off') %} {{'true'}} {% elif is_state('binary_sensor.too_hot_inside','on') and is_state('binary_sensor.warmer_outside', 'on') and is_state('binary_sensor.getting_cooler_outside', 'off') %} {{'true'}} {% else %} {{'false'}} {% endif %} {% else %} {{'false'}} {% endif %} attributes: outdoor_temp: "{{ states('sensor.outdoor_temperature') | float(default=0)}}" upstairs_mean_temp: "{{ states('sensor.upstairs_mean_temperature') | float(default=0)}}" target_temp_high: "{{ state_attr('climate.thermostat','target_temp_high') | float(default=0)}}" target_temp_low: "{{ state_attr('climate.thermostat','target_temp_low') | float(default=0)}}" getting_warmer: "{{ states('binary_sensor.getting_warmer_outside') }}" too_hot_inside: "{{ states('binary_sensor.too_hot_inside') }}" warmer_outside: "{{ states('binary_sensor.warmer_outside') }}" too_hot_outside: "{{ states('binary_sensor.too_hot_outside') }}" getting_cooler: "{{ states('binary_sensor.getting_cooler_outside') }}" too_cold_inside: "{{ states('binary_sensor.too_cold_inside') }}" cooler_outside: "{{ states('binary_sensor.cooler_outside') }}" too_cold_outside: "{{ states('binary_sensor.too_cold_outside') }}" - name: Need to Open Something Too Warm or Cold unique_id: templatebinarysensor.need_to_open_something_too_warm_or_cold device_class: problem # delay_on: # minutes: 5 state: >- {% if is_state('binary_sensor.something_open','off') %} {% if is_state('binary_sensor.too_cold_inside','off') and is_state('binary_sensor.too_hot_inside','off') and is_state('binary_sensor.too_cold_outside','off') and is_state('binary_sensor.too_hot_outside','off') %} {{'true'}} {% else %} {{'false'}} {% endif %} {% else %} {{'false'}} {% endif %} attributes: outdoor_temp: "{{ states('sensor.outdoor_temperature') | float(default=0)}}" upstairs_mean_temp: "{{ states('sensor.upstairs_mean_temperature') | float(default=0)}}" target_temp_high: "{{ state_attr('climate.thermostat','target_temp_high') | float(default=0)}}" target_temp_low: "{{ state_attr('climate.thermostat','target_temp_low') | float(default=0)}}" getting_warmer: "{{ states('binary_sensor.getting_warmer_outside') }}" too_hot_inside: "{{ states('binary_sensor.too_hot_inside') }}" warmer_outside: "{{ states('binary_sensor.warmer_outside') }}" too_hot_outside: "{{ states('binary_sensor.too_hot_outside') }}" getting_cooler: "{{ states('binary_sensor.getting_cooler_outside') }}" too_cold_inside: "{{ states('binary_sensor.too_cold_inside') }}" cooler_outside: "{{ states('binary_sensor.cooler_outside') }}" too_cold_outside: "{{ states('binary_sensor.too_cold_outside') }}" - sensor: - name: Outdoor Temperature Gradient unique_id: templatesensor.outdoor_temperature_gradient state: "{{ (state_attr('binary_sensor.getting_warmer_outside','gradient') | float(default=0) * 10000) | round(2)}}" availability: "{{ (states('binary_sensor.getting_warmer_outside') not in ['unavailable']) }}" icon: mdi:sun-thermometer state_class: measurement unit_of_measurement: p attributes: outdoor_temp: "{{ states('sensor.outdoor_temperature') | float(default=0)}}" target_temp_high: "{{ state_attr('climate.thermostat','target_temp_high') | float(default=0)}}" target_temp_low: "{{ state_attr('climate.thermostat','target_temp_low') | float(default=0)}}" getting_warmer: "{{ states('binary_sensor.getting_warmer_outside') }}" warmer_outside: "{{ states('binary_sensor.warmer_outside') }}" too_hot_outside: "{{ states('binary_sensor.too_hot_outside') }}" getting_cooler: "{{ states('binary_sensor.getting_cooler_outside') }}" cooler_outside: "{{ states('binary_sensor.cooler_outside') }}" too_cold_outside: "{{ states('binary_sensor.too_cold_outside') }}" - name: HVAC Target Temp Low unique_id: templatesensor_hvac_target_temp_low state: "{{state_attr('climate.thermostat','target_temp_low')}}" availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) }}" device_class: temperature unit_of_measurement: "°F" attributes: hvac_action: "{{state_attr('climate.thermostat','hvac_action')}}" preset_mode: "{{state_attr('climate.thermostat','preset_mode')}}" climate_mode_mode: "{{state_attr('climate.thermostat','climate_mode')}}" - name: HVAC Target Temp High unique_id: templatesensor_hvac_target_temp_high state: "{{state_attr('climate.thermostat','target_temp_high')}}" availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) }}" device_class: temperature unit_of_measurement: "°F" attributes: hvac_action: "{{state_attr('climate.thermostat','hvac_action')}}" preset_mode: "{{state_attr('climate.thermostat','preset_mode')}}" climate_mode_mode: "{{state_attr('climate.thermostat','climate_mode')}}" - name: HVAC Target Temperature unique_id: templatesensor_hvac_target_temperature state: "{{state_attr('climate.thermostat','temperature')}}" availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) }}" device_class: temperature unit_of_measurement: "°F" attributes: hvac_action: "{{state_attr('climate.thermostat','hvac_action')}}" preset_mode: "{{state_attr('climate.thermostat','preset_mode')}}" climate_mode_mode: "{{state_attr('climate.thermostat','climate_mode')}}" - name: HVAC Current Temperature unique_id: templatesensor_hvac_current_temperature icon: mdi:fan-clock state: "{{state_attr('climate.thermostat','current_temperature')}}" availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) }}" device_class: temperature unit_of_measurement: "°F" attributes: hvac_action: "{{state_attr('climate.thermostat','hvac_action')}}" preset_mode: "{{state_attr('climate.thermostat','preset_mode')}}" climate_mode_mode: "{{state_attr('climate.thermostat','climate_mode')}}" - name: HVAC Fan Min On Time unique_id: templatesensor_hvac_fan_min_on_time state: "{{state_attr('climate.thermostat','fan_min_on_time')}}" availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) }}" device_class: duration unit_of_measurement: min - name: HVAC Preset Mode unique_id: templatesensor_hvac_preset_mode state: "{{state_attr('climate.thermostat','preset_mode')}}" availability: "{{ (states('climate.thermostat') not in ['unknown', 'unavailable']) }}" device_class: enum attributes: options: "{{state_attr('climate.thermostat','preset_modes')}}"