Skip to content

Instantly share code, notes, and snippets.

@Blackshome
Last active November 1, 2024 11:13
Show Gist options
  • Save Blackshome/8e09a8213b834f1be4ab49ba880abed8 to your computer and use it in GitHub Desktop.
Save Blackshome/8e09a8213b834f1be4ab49ba880abed8 to your computer and use it in GitHub Desktop.
bathroom-humidity-exhaust-fan.yaml
blueprint:
name: Bathroom Humidity Exhaust Fan
description: >
# 🚿 Bathroom Humidity Exhaust Fan
**Version: 2.5**
Step into the future of freshness - customize it your way and experience the convenience of automated humidity control! 🌿🚿
**If you like my blueprints, and would like to show your support or just say thank you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8) 🙂
<details>
<summary><b>The Automation Process:</b> 👈</summary>
- **Auto Trigger:**
- When the derivative percentage rises above a set value, the fan turns ON
- When the derivative percentage falls below a set value, the automation waits for a time delay and then turns the fan OFF.
- Optional - Set a maximum humidity percentage to trigger the fan ON. This is useful when having back-to-back showers.
**Note:** You must have a humidity sensor in the bathroom and set up a 'Derivative Helper' for this automation to work.
- **Manual Trigger Option:**
- This feature allows you to manually trigger the automation.
- **Multi-Speed Fan Control Option:**
- You have the option to use fan speeds to control the staging of your fan.
- You can choose to stage your fan in your preferred configuration, such as High/Off, High/Low, High/Low/Off, High/Med/Low, etc.
- **Winter Mode Option:**
- You have the option to use 'Winter Mode.' This mode allows for different settings to be applied, accommodating the typically higher humidity levels experienced in winter compared to summer.
- **Light Control Option:**
- Use the "Light Control" option to turn ON lights, adjusting brightness levels, colour temperatures, and transition times.
- This feature is commonly utilized with LED lights in a shower niche.
- For expanded lighting options, consider integrating my 💡[Sensor Light](https://community.home-assistant.io/t/481048) blueprint, which utilizes the automation link feature.
- **Manual Control Option:**
- Use a manual fan switch to toggle the fan ON/OFF.
- Opt to use the auto-OFF option for timer-like functionality.
- This is particularly useful for removing unwanted fumes from deodorant, hairspray, or the toilet.
- **Automation Link Option:**
- This feature simplifies the process of automatically disabling your other automations by providing an automation linking mechanism.
- **Bypass Functionality Option:**
- This allows you to bypass the automation, offering manual control and additional customization capabilities.
- **Safety Measures:**
- Set a maximum runtime safeguard for the fan to prevent continuous operation.
- Benefit from built-in safeguards to ensure smooth operation and reliability, even if Home Assistant restarts.
- **Blueprint Add-On Integration:**
- Sensor Light: Control your lights in the bathroom. [Click Here](https://community.home-assistant.io/t/509992/240) to learn more.
- Toilet Exhaust Fan: Integrate with a toilet in the bathroom. [Click Here](https://community.home-assistant.io/t/509992/387) to learn more.
</details>
Need help?
- FAQ: [Click Here](https://community.home-assistant.io/t/509992/2?u=blacky)
- Community Support Including Updates: [Click Here](https://community.home-assistant.io/t/509992)
Required = *
domain: automation
input:
trigger_settings:
name: "Auto Triggers *"
icon: mdi:cog-outline
description: ⚠️ To use an auto trigger, you need to configure a humidity derivative sensor. *
collapsed: true
input:
trigger:
name: Trigger - Humidity Derivative Sensor *
description: Select your humidity derivative sensor.
This is the main key trigger for this automation.
To ensure the auto trigger functions correctly, you need to create a derivative helper and select it here.
For more information on how to set up a humidity derivative sensor [Click Here](https://community.home-assistant.io/t/509992/3)
default: []
selector:
entity:
filter:
domain:
- sensor
bathroom_humidity_sensor:
name: Bathroom Humidity Sensor (Optional)
description: You will have the option to use 'The Maximum Humidity Option' below in 'Default - Summer Mode' and in 'Winter Mode'.
This will be the reference humidity sensor used in both options if selected.
However, you will still need to create a humidity derivative sensor and enter it above for this blueprint to work
default: []
selector:
entity:
filter:
domain:
- sensor
manual_settings:
name: "Manual Trigger"
icon: mdi:gesture-tap-button
collapsed: true
input:
include_manual_trigger:
name: Use The Manual Trigger Option (Optional)
description: This feature allows you to manually trigger the automation.
It replaces the humidity derivative settings in either 'Default - Summer Mode' or 'Winter Mode,' configurations.
Turning it ON initiates the automation process, and turning it OFF starts the time delay.
Note that auto triggers can and will override the manual trigger option if triggered.
If you choose option 1, the 'Safeguard - Maximum Run Time' will be active in 'Default - Summer Mode' or 'Winter Mode' and will turn OFF the manual trigger if you forget to do so.
Alternatively, option 2 allows you to customize different auto OFF time delays for both 'Default - Summer Mode' and 'Winter Mode' settings.
If using the winter mode, ensure it is enabled below in the 'Winter Mode' section.
This feature can operate with or without a humidity sensor, which is particularly useful if the humidity sensor malfunctions, allowing time for repairs and reducing stress levels.
Additionally, it can initiate the fan to turn ON before a shower, aiding in humidity removal before the auto triggers take over.
It is designed with good spouse approval in mind.
For more information on this feature and its capabilities, [click here.](https://community.home-assistant.io/t/509992/483?u=blacky)
default: disable_manual_trigger
selector:
select:
options:
- label: 1 - Enable manual trigger
value: "enable_manual_trigger"
- label: 2 - Enable manual trigger + auto off time delay
value: "enable_manual_trigger_time_delay"
- label: Disable manual trigger
value: "disable_manual_trigger"
manual_trigger:
name: Manual Trigger
description: Enter an entity that will manually trigger the automation.
**NOTE** - The Manual Trigger entity cannot be your actual Fan Switch entity; it must be a completely different entity.
Alternatively, if you prefer to use the same Fan Switch entity for the Manual Trigger function, you can create a trigger-based template binary sensor to ensure the automation functions correctly.
To learn how to create a trigger-based template binary sensor [Click here](https://community.home-assistant.io/t/509992/496).
default: []
selector:
entity:
multiple: true
filter:
domain:
- switch
- binary_sensor
- input_boolean
manual_trigger_default_time_delay:
name: Default - Auto Off Time Delay
description: If you've selected option 2 in the 'Manual Trigger Option' above, please set the auto OFF time delay.
This will determine the time delay used in 'Default - Summer Mode' to automatically turn OFF the manual trigger after it has been turned ON.
default: 15
selector:
number:
min: 0
max: 40
step: 0.5
unit_of_measurement: minutes
manual_trigger_winter_time_delay:
name: Winter - Auto Off Time Delay
description: If you've selected option 2 in the 'Manual Trigger Option' above, please set the auto OFF time delay.
This will determine the time delay used in 'Winter Mode' to automatically turn OFF the manual trigger after it has been turned ON.
default: 15
selector:
number:
min: 0
max: 40
step: 0.5
unit_of_measurement: minutes
fan_settings:
name: "Fan *"
icon: mdi:fan
collapsed: true
input:
fan_switch:
name: Fan Switch *
description: Select the fan you would like to turn ON. Fans, switches, scripts & input boolean are allowed.
If you'd like to turn on lights, please refer to the 'Lights' section below.
**NOTE** - If you are only selecting a script, it is recommended to create a dummy toggle helper and then select it here to ensure the automation functions correctly.
For more information if you are only selecting a script [Click Here](https://community.home-assistant.io/t/509992/239?u=blacky).
default: []
selector:
target:
entity:
domain:
- fan
- switch
- script
- input_boolean
fan_speed_low:
name: Fan Speed - Low Speed Switch (Optional)
description: You will have the option to use 'The Fan Speed Options' below in 'Default - Summer Mode' and 'Winter Mode'.
This reference entity will turn the fan ON to low speed in both options if selected.
Please DO NOT select the same entities that are chosen above in 'Fan Switch' or below in 'Fan Speed - Switch Off', as the automation will not work.
**NOTE** - If you are only selecting a script, it is recommended to create a dummy toggle helper and then select it here to ensure the automation functions correctly.
For more information if you are only selecting a script [Click Here](https://community.home-assistant.io/t/509992/239?u=blacky).
default: []
selector:
entity:
multiple: true
filter:
domain:
- fan
- switch
- script
- input_boolean
fan_speed_off:
name: Fan Speed - Switch Off (Optional)
description: You will have the option to use 'The Fan Speed Options' below in 'Default - Summer Mode' and 'Winter Mode'.
This reference entity will turn the fan OFF in both options if selected.
Please DO NOT select the same entities that are chosen above in 'Fan Switch' or 'Fan Speed - Low Speed Switch', as the automation will not work.
**Note** - If you'd like the fan to run continuously at a low speed 24/7, you can select that speed here.
default: []
selector:
entity:
multiple: true
filter:
domain:
- fan
- switch
- script
- input_boolean
default_settings:
name: "Default - Summer Mode"
icon: mdi:weather-sunny
collapsed: true
input:
rising_humidity:
name: Rising Humidity Derivative
description: Specify the percentage increase that the derivative sensor must exceed to indicate a shower has started, thus activating the fan.
The derivative sensor percentage must transition from below to above this setpoint to trigger the automation.
default: 1
selector:
number:
min: 0
max: 5
step: 0.1
unit_of_measurement: '%'
falling_humidity:
name: Falling Humidity Derivative
description: Specify the percentage decrease that the derivative sensor must fall below to indicate the shower has completed, thus activating the time delay.
The derivative sensor percentage must transition from above to below this setpoint to trigger the automation.
default: -1
selector:
number:
min: -5
max: 0
step: 0.1
unit_of_measurement: '%'
time_delay:
name: Time Delay
description: After the falling humidity derivative percentage has been achieved or the set safeguard time has elapsed, this time delay will determine how long the fan will run before turning OFF.
Alternatively, if you've selected option 1 in the 'Fan Speed Options' below, the fan will transition to low speed after this time delay.
default: 10
selector:
number:
min: 0
max: 20
step: 0.5
unit_of_measurement: minutes
time_out:
name: Safeguard - Maximum Run Time
description: Specify the maximum run time for the safeguard.
If the automation turns the fan ON and the falling humidity derivative condition fails to execute within this time frame, the safeguard will bypass the falling humidity derivative condition and proceed to the time delay.
default: 20
selector:
number:
min: 5
max: 60
step: 0.5
unit_of_measurement: minutes
include_max_humidity:
name: Use The Maximum Humidity Option (Optional)
description: Sometimes after a shower, humidity levels may take longer to return to normal.
As a result, the humidity may not rise significantly when taking another shower before returning to its normal level, thus not triggering the automation.
Enabling this option allows the fan to be turned ON when the humidity rises above the set value, regardless of the rate of increase in rising humidity derivative percentage.
**NOTE** - Please ensure that you input your 'Bathroom Humidity Sensor' above in the 'Triggers' section for this option to work correctly.
default: maximum_humidity_disabled
selector:
select:
options:
- label: Enable the maximum humidity option
value: "maximum_humidity_enabled"
- label: Disable the maximum humidity option
value: "maximum_humidity_disabled"
max_humidity:
name: Maximum Humidity
description: If you have enabled the maximum humidity option above, please set the maximum humidity percentage.
When using this option, it's recommended to set this value as high as possible to minimize false triggers.
default: 100
selector:
number:
min: 80
max: 100
step: 0.5
unit_of_measurement: '%'
include_fan_speed:
name: Use The Fan Speed Options (Optional)
description: If you're using a multi-speed fan, you can choose one of the following options to determine how the fan will be staged when turning OFF.
**NOTE** - Please ensure that you input your 'Fan Speeds' entities above in the 'Fan' section for this option to work properly.
default: fan_speed_disabled
selector:
select:
options:
- label: 1 - Enable the fan speed - Switch to low speed then turn off option
value: "fan_low_speed_enabled"
- label: 2 - Enable the fan speed - Turn off option
value: "fan_speed_off_enabled"
- label: Disable the fan speed options
value: "fan_speed_disabled"
time_delay_low_speed:
name: Fan Speed - Low Speed Time Delay
description: If you've selected option 1 in the 'Fan Speed Options' above, please set the low speed time delay.
This additional delay allows the fan to run at low speed before turning OFF.
default: 5
selector:
number:
min: 0
max: 20
step: 0.5
unit_of_measurement: minutes
winter_settings:
name: "Winter Mode"
icon: mdi:snowflake
collapsed: true
input:
include_winter_mode:
name: Use The Winter Mode Option (Optional)
description: Enabling this option will automatically apply a 'Winter Mode' to the months you select below, allowing you to apply different settings for the colder months of the year.
default: winter_mode_disabled
selector:
select:
options:
- label: Enable winter mode option
value: "winter_mode_enabled"
- label: Disable winter mode option
value: "winter_mode_disabled"
month_winter_mode:
name: Months For Winter Mode
description: Choose the months during which you want the winter mode settings to be applied.
default: []
selector:
select:
multiple: true
mode: list
options:
- label: January
value: "1"
- label: February
value: "2"
- label: March
value: "3"
- label: April
value: "4"
- label: May
value: "5"
- label: June
value: "6"
- label: July
value: "7"
- label: August
value: "8"
- label: September
value: "9"
- label: October
value: "10"
- label: November
value: "11"
- label: December
value: "12"
winter_rising_humidity:
name: Winter Rising Humidity Derivative
description: Specify the percentage increase that the derivative sensor must exceed to indicate a shower has started, thus activating the fan.
The derivative sensor percentage must transition from below to above this setpoint to trigger the automation.
default: 1
selector:
number:
min: 0
max: 5
step: 0.1
unit_of_measurement: '%'
winter_falling_humidity:
name: Winter Falling Humidity Derivative
description: Specify the percentage decrease that the derivative sensor must fall below to indicate the shower has completed, thus activating the time delay.
The derivative sensor percentage must transition from above to below this setpoint to trigger the automation.
default: -1
selector:
number:
min: -5
max: 0
step: 0.1
unit_of_measurement: '%'
winter_time_delay:
name: Winter Time Delay
description: After the falling humidity derivative percentage has been achieved or the set safeguard time has elapsed, this time delay will determine how long the fan will run before turning OFF.
Alternatively, if you've selected option 1 in the 'Fan Speed Options' below, the fan will transition to low speed after this time delay.
default: 10
selector:
number:
min: 0
max: 20
step: 0.5
unit_of_measurement: minutes
winter_time_out:
name: Winter Safeguard - Maximum Run Time
description: Specify the maximum run time for the safeguard.
If the automation turns the fan ON and the falling humidity derivative condition fails to execute within this time frame, the safeguard will bypass the falling humidity derivative condition and proceed to the time delay.
default: 20
selector:
number:
min: 5
max: 60
step: 0.5
unit_of_measurement: minutes
winter_include_max_humidity:
name: Winter - Use The Maximum Humidity Option (Optional)
description: In colder months, after a shower, humidity levels may take longer to return to normal.
As a result, the humidity may not rise significantly when taking another shower before returning to its normal level, thus not triggering the automation.
Enabling this option allows the fan to be turned ON when the humidity rises above the set value, regardless of the rate of increase in rising humidity derivative percentage.
**NOTE** - Please ensure that you input your 'Bathroom Humidity Sensor' above in the 'Triggers' section for this option to work correctly.
default: maximum_humidity_disabled
selector:
select:
options:
- label: Enable the maximum humidity option
value: "maximum_humidity_enabled"
- label: Disable the maximum humidity option
value: "maximum_humidity_disabled"
winter_max_humidity:
name: Winter Maximum Humidity
description: If you have enabled the maximum humidity option above, please set the maximum humidity percentage.
When using this option, it's recommended to set this value as high as possible to minimize false triggers.
default: 100
selector:
number:
min: 80
max: 100
step: 0.5
unit_of_measurement: '%'
winter_include_fan_speed:
name: Winter - Use The Fan Speed Options (Optional)
description: If you're using a multi-speed fan, you can choose one of the following options to determine how the fan will be staged when turning OFF.
**NOTE** - Please ensure that you input your 'Fan Speeds' entities above in the 'Fan' section for this option to work properly.
default: fan_speed_disabled
selector:
select:
options:
- label: 1 - Enable the fan speed - Switch to low speed then turn off option
value: "fan_low_speed_enabled"
- label: 2 - Enable the fan speed - Turn off option
value: "fan_speed_off_enabled"
- label: Disable the fan speed options
value: "fan_speed_disabled"
winter_time_delay_low_speed:
name: Winter Fan Speed - Low Speed Time Delay
description: If you've selected option 1 in the 'Fan Speed Options' above, please set the low speed time delay.
This additional delay allows the fan to run at low speed before turning OFF.
default: 5
selector:
number:
min: 0
max: 20
step: 0.5
unit_of_measurement: minutes
lights_settings:
name: "Lights"
icon: mdi:lightbulb-on-outline
collapsed: true
input:
include_lights:
name: Use The Lights Options (Optional)
description: This option is handy for activating various lights while showering, especially if you have LED lights in a shower niche.
If you're looking to enhance your bathroom lighting further, check out my 💡[Sensor Light](https://community.home-assistant.io/t/481048) blueprint.
When used together, the automation link ensures the lights stay on while showering.
You can find the automation link section below.
default: lights_disabled
selector:
select:
options:
- label: Enable the lights options
value: "lights_enabled"
- label: Disable the lights options
value: "lights_disabled"
light_switch:
name: Lights
description: Select the lights that will be turned on by the trigger sensor.
**NOTE** - You can only use entities. Areas, devices and labels are not supported.
default: {}
selector:
target:
entity:
domain:
- light
light_time_delay:
name: Lights - Time Delay
description: After the falling humidity derivative percentage has been achieved or the set safeguard time has elapsed, this time delay will determine how long the lights will remain ON before turning OFF.
default: 10
selector:
number:
min: 0
max: 40
step: 0.5
unit_of_measurement: minutes
include_light_control:
name: Use The Light Control Options (Optional)
description: Select any option you would like to use. It will only control a 'light' entity that supports each option you select.
The settings are below for each option.
default: []
selector:
select:
multiple: true
options:
- label: Use brightness
value: "use_brightness"
- label: Use colour temperature
value: "use_colour_temperature"
- label: Use transition
value: "use_transition"
light_brightness:
name: Brightness
description: The brightness setting for the lights when they are turned ON.
default: 100
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: '%'
light_colour_temperature:
name: Colour Temperature
description: The colour temperature setting for the lights when they are turned ON.
default: 5000
selector:
number:
min: 2000
max: 8000
mode: slider
step: 100
unit_of_measurement: 'kelvin'
light_transition_on:
name: Transition - ON
description: The transition setting for the lights when they are turned ON.
default: 1
selector:
number:
min: 0
max: 5
mode: slider
step: 0.5
unit_of_measurement: seconds
light_transition_off:
name: Transition - OFF
description: The transition setting for the lights when they are turned OFF.
default: 1
selector:
number:
min: 0
max: 30
mode: slider
step: 1
unit_of_measurement: seconds
manual_switch_settings:
name: "Manual Fan Switch"
icon: mdi:toggle-switch-outline
collapsed: true
input:
include_manual_fan_switch:
name: Use The Manual Fan Switch Option (Optional)
description: This feature allows you to manually switch the fan ON and OFF while still enabling the automation to take control when needed.
It's particularly useful for removing unwanted fumes from deodorant, hairspray, or the toilet.
Option 2's auto-off time delay ensures you never forget to turn the fan OFF.
default: disable_manual_fan_switch
selector:
select:
options:
- label: 1 - Enable manual fan switch option
value: "enable_manual_fan_switch"
- label: 2 - Enable manual fan switch + auto off option
value: "enable_manual_fan_switch_auto_off"
- label: Disable manual fan switch
value: "disable_manual_fan_switch"
manual_fan_switch:
name: Manual Fan Switch
description: Enter a switch that will toggle the fan ON/OFF. When the switch turns the fan OFF, it will also deactivate the automation link and any lights, if the option is enabled.
**NOTE** - The Manual Fan Switch cannot be your actual Fan Switch entity; it must be a completely different entity.
Alternatively, if you prefer to use the same Fan Switch entity for the Manual Fan Switch function, you can create a trigger-based template binary sensor to ensure the automation functions correctly.
To learn how to create a trigger-based template binary sensor [Click here](https://community.home-assistant.io/t/509992/496).
default: []
selector:
entity:
multiple: true
filter:
domain:
- switch
- binary_sensor
- input_boolean
manual_fan_switch_time_delay:
name: Manual Fan Switch Auto OFF - Time Delay
description: If you've enabled option 2 above, please set the auto OFF time delay.
default: 10
selector:
number:
min: 0
max: 40
step: 0.5
unit_of_measurement: minutes
automation_link_settings:
name: "Automation Link"
icon: mdi:link-variant
collapsed: true
input:
include_automation_link:
name: Use The Automation Link Option (Optional)
description: This feature simplifies the process of automatically disabling your other automations by providing an automation linking mechanism.
It's particularly useful if you're using my 💡[Sensor Light](https://community.home-assistant.io/t/481048) blueprint in your bathroom and want to disable it when this automation is ON.
This ensures that your bathroom lights stay ON even when your motion sensor is unable to detect motion while you're in the shower.
For more information on how to set up the Automation Link Option [Click Here](https://community.home-assistant.io/t/509992/240?u=blacky)
default: disable_automation_link
selector:
select:
options:
- label: Enable automation link
value: "enable_automation_link"
- label: Disable automation link
value: "disable_automation_link"
automation_link:
name: Automation Link - Bypass Control
description: Please enter the bypass entity of the other automations you would like to turn ON, thereby disabling it when this automation is ON.
**Note** -Your other automations must include a bypass switch that you enter here.
default: []
selector:
entity:
multiple: true
filter:
domain:
- input_boolean
automation_link_time_delay:
name: Automation Link - Time Delay
description: After the falling humidity derivative percentage has been achieved or the set safeguard time has elapsed, this time delay will determine how long the automation link entities will remain ON before turning OFF.
default: 10
selector:
number:
min: 0
max: 40
step: 0.5
unit_of_measurement: minutes
bypass_settings:
name: "Bypass"
icon: mdi:cog-pause-outline
collapsed: true
input:
include_bypass:
name: Use The Trigger Sensor Bypass Option (Optional)
description: All the bypass options will allow manual control of your fan.
Each option determines what should happen when you turn the bypass ON.
Choose the action that you would like to activate.
**Note** - If the lights or automation link options are enabled, they will be included in the action.
default: bypass_disabled
selector:
select:
options:
- label: 1 - Enable the bypass - Turn the fan, lights & automation link ON
value: "bypass_enabled_turn_on"
- label: 2 - Enable the bypass - Turn the fan, lights & automation link OFF
value: "bypass_enabled"
- label: 3 - Enable the bypass - Keep the current fan, lights & automation link state
value: "bypass_enabled_stop"
- label: Disable the bypass option
value: "bypass_disabled"
by_pass:
name: Bypass Switch
description: Select a switch that will bypass the humidity derivative sensor and enable manual control of your fan.
**Note** - Ensure that the chosen entity is not included in the 'Fan' selection, as it will cause the automation to malfunction.
default: []
selector:
entity:
bypass_options:
name: Bypass - Extra Option
description: Please indicate whether you would like to use this option.
default: []
selector:
select:
multiple: true
options:
- label: When you turn the bypass off - Turn the fan, lights & automation link OFF and do not run the automation.
value: "bypass_turn_fan_off"
include_bypass_auto_off:
name: Use The Bypass Auto OFF Option (Optional)
description: Select this option if you want the bypass to automatically turn OFF after a set time delay.
It can also function as a timer to turn the fan ON and then OFF if you've chosen option 1 'Enable the bypass - Turn the fan, lights & automation link ON' above.
default: bypass_auto_off_disabled
selector:
select:
options:
- label: Enable the bypass auto off option
value: "bypass_auto_off_enabled"
- label: Disable the bypass auto off option
value: "bypass_auto_off_disabled"
bypass_auto_off_delay:
name: Bypass Auto OFF - Time Delay
description: Please set the auto OFF time delay for the bypass.
default: 60
selector:
number:
min: 1
max: 240
step: 1
unit_of_measurement: minutes
mode: restart
max_exceeded: silent
variables:
trigger: !input trigger
bathroom_humidity_sensor: !input bathroom_humidity_sensor
include_manual_trigger: !input include_manual_trigger
manual_trigger: !input manual_trigger
manual_trigger_default_time_delay: !input manual_trigger_default_time_delay
manual_trigger_winter_time_delay: !input manual_trigger_winter_time_delay
fan_switch: !input fan_switch
fan_speed_low: !input fan_speed_low
fan_speed_off: !input fan_speed_off
rising_humidity: !input rising_humidity
falling_humidity: !input falling_humidity
time_delay: !input time_delay
time_out: !input time_out
include_max_humidity: !input include_max_humidity
max_humidity: !input max_humidity
include_fan_speed: !input include_fan_speed
time_delay_low_speed: !input time_delay_low_speed
include_winter_mode: !input include_winter_mode
month_winter_mode: !input month_winter_mode
winter_rising_humidity: !input winter_rising_humidity
winter_falling_humidity: !input winter_falling_humidity
winter_time_delay: !input winter_time_delay
winter_time_out: !input winter_time_out
winter_include_max_humidity: !input winter_include_max_humidity
winter_max_humidity: !input winter_max_humidity
winter_include_fan_speed: !input winter_include_fan_speed
winter_time_delay_low_speed: !input winter_time_delay_low_speed
include_lights: !input include_lights
light_switch: !input light_switch
light_time_delay: !input light_time_delay
include_light_control: !input include_light_control
light_brightness: !input light_brightness
brightness_value: "{{ iif ('use_brightness' in include_light_control , light_brightness, ) }}"
light_colour_temperature: !input light_colour_temperature
temperature_value: "{{ iif ('use_colour_temperature' in include_light_control , light_colour_temperature, [] ) }}"
light_transition_on: !input light_transition_on
light_transition_off: !input light_transition_off
transition_on_value: "{{ iif ('use_transition' in include_light_control, light_transition_on, ) }}"
transition_off_value: "{{ iif ('use_transition' in include_light_control, light_transition_off, ) }}"
include_manual_fan_switch: !input include_manual_fan_switch
manual_fan_switch: !input manual_fan_switch
manual_fan_switch_time_delay: !input manual_fan_switch_time_delay
include_automation_link: !input include_automation_link
automation_link: !input automation_link
automation_link_time_delay: !input automation_link_time_delay
include_bypass: !input include_bypass
by_pass: !input by_pass
bypass_options: !input bypass_options
include_bypass_auto_off: !input include_bypass_auto_off
bypass_auto_off_delay: !input bypass_auto_off_delay
# Split domains for light switch targets
light_entities: >-
{% set a = light_switch and light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
trigger:
- platform: numeric_state
id: "t0"
entity_id: !input trigger
above: !input winter_rising_humidity
below: "100"
- platform: numeric_state
id: "t1"
entity_id: !input bathroom_humidity_sensor
above: !input winter_max_humidity
below: "100"
- platform: homeassistant
id: "t2"
event: start
- platform: numeric_state
id: "t3"
entity_id: !input trigger
above: !input rising_humidity
below: "100"
- platform: numeric_state
id: "t4"
entity_id: !input bathroom_humidity_sensor
above: !input max_humidity
below: "100"
- platform: state
id: "t5"
entity_id: !input by_pass
from: "off"
to: "on"
- platform: state
id: "t6"
entity_id: !input by_pass
from: "on"
to: "off"
- platform: state
id: "t7"
entity_id: !input manual_fan_switch
from: "off"
to: "on"
- platform: state
id: "t8"
entity_id: !input manual_trigger
from: "off"
to: "on"
# All Conditions
condition:
# Trigger conditions
- condition: or
conditions:
- condition: and # trigger for winter mode
conditions:
- "{{ include_winter_mode == 'winter_mode_enabled' }}"
- condition: template
value_template: "{{ (now().month | string in month_winter_mode ) }}"
- condition: trigger
id: 't0'
- condition: and # trigger for winter mode and max humidity
conditions:
- "{{ (include_winter_mode == 'winter_mode_enabled') and (winter_include_max_humidity == 'maximum_humidity_enabled') }}"
- condition: template
value_template: "{{ (now().month | string in month_winter_mode ) }}"
- condition: trigger
id: 't1'
- condition: and # trigger by HA restart - fan or low speed fan is on
conditions:
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or ((include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) or ((winter_include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- condition: trigger
id: 't2'
- condition: and # trigger by HA restart - above rising humidity - winter mode disabled
conditions:
- condition: trigger
id:
- 't2'
- "{{ 'winter_mode_disabled' in include_winter_mode }}"
- condition: numeric_state
entity_id: !input trigger
above: !input rising_humidity
below: "100"
- condition: and # trigger by HA restart - above rising humidity - winter mode enabled - not in winter month
conditions:
- condition: trigger
id:
- 't2'
- "{{ 'winter_mode_enabled' in include_winter_mode }}"
- condition: template
value_template: "{{ (now().month | string not in month_winter_mode ) }}"
- condition: numeric_state
entity_id: !input trigger
above: !input rising_humidity
below: "100"
- condition: and # trigger by HA restart - above rising humidity - winter mode enabled - in winter month
conditions:
- condition: trigger
id:
- 't2'
- "{{ 'winter_mode_enabled' in include_winter_mode }}"
- condition: template
value_template: "{{ (now().month | string in month_winter_mode ) }}"
- condition: numeric_state
entity_id: !input trigger
above: !input winter_rising_humidity
below: "100"
- condition: and # trigger by HA restart - maximum humidity enabled & above maximum humidity - winter mode disabled
conditions:
- condition: trigger
id:
- 't2'
- "{{ 'winter_mode_disabled' in include_winter_mode }}"
- "{{ 'maximum_humidity_enabled' in include_max_humidity }}"
- condition: numeric_state
entity_id: !input bathroom_humidity_sensor
above: !input max_humidity
below: "100"
- condition: and # trigger by HA restart - maximum humidity enabled & above maximum humidity - winter mode enabled - not in winter month
conditions:
- condition: trigger
id:
- 't2'
- "{{ 'winter_mode_enabled' in include_winter_mode }}"
- "{{ 'maximum_humidity_enabled' in include_max_humidity }}"
- condition: template
value_template: "{{ (now().month | string not in month_winter_mode ) }}"
- condition: numeric_state
entity_id: !input bathroom_humidity_sensor
above: !input max_humidity
below: "100"
- condition: and # trigger by HA restart - maximum humidity enabled & above maximum humidity - winter mode enabled - in winter month
conditions:
- condition: trigger
id:
- 't2'
- "{{ 'winter_mode_enabled' in include_winter_mode }}"
- "{{ 'maximum_humidity_enabled' in winter_include_max_humidity }}"
- condition: template
value_template: "{{ (now().month | string in month_winter_mode ) }}"
- condition: numeric_state
entity_id: !input bathroom_humidity_sensor
above: !input winter_max_humidity
below: "100"
- condition: and # trigger for default
conditions:
- condition: template
value_template: "{{ (include_winter_mode == 'winter_mode_disabled') or ((include_winter_mode == 'winter_mode_enabled') and not (now().month | string in month_winter_mode )) }}"
- condition: trigger
id: 't3'
- condition: and # trigger for default and max humidity
conditions:
- condition: template
value_template: "{{ ((include_winter_mode == 'winter_mode_disabled') and (include_max_humidity == 'maximum_humidity_enabled')) or ((include_winter_mode == 'winter_mode_enabled') and (include_max_humidity == 'maximum_humidity_enabled') and not (now().month | string in month_winter_mode )) }}"
- condition: trigger
id: 't4'
- condition: and # trigger by by-pass turning on
conditions:
- condition: trigger
id: 't5'
- "{{ (include_bypass == 'bypass_enabled_turn_on') or (include_bypass == 'bypass_enabled') or (include_bypass == 'bypass_enabled_stop') }}"
- condition: and # trigger by by-pass turning off
conditions:
- condition: trigger
id: 't6'
- "{{ (include_bypass != 'bypass_disabled') }}"
- "{{ (include_bypass == 'bypass_enabled') or (include_bypass == 'bypass_enabled_stop') or (include_bypass == 'bypass_enabled_turn_on') }}"
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0 ) or ((include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) or ((winter_include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') and (expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- condition: and # trigger by by-pass turning off - trigger above rising humidity - winter mode disabled - fans & lights off
conditions:
- condition: trigger
id:
- 't6'
- "{{ (include_bypass != 'bypass_disabled') }}"
- "{{ 'winter_mode_disabled' in include_winter_mode }}"
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 ) or ((include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0))}}"
- condition: numeric_state
entity_id: !input trigger
above: !input rising_humidity
below: "100"
- condition: and # trigger by by-pass turning off - trigger above rising humidity - winter mode enabled - not in winter month - fans & lights off
conditions:
- condition: trigger
id:
- 't6'
- "{{ (include_bypass != 'bypass_disabled') }}"
- "{{ 'winter_mode_enabled' in include_winter_mode }}"
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 ) or ((include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- condition: template
value_template: "{{ (now().month | string not in month_winter_mode ) }}"
- condition: numeric_state
entity_id: !input trigger
above: !input rising_humidity
below: "100"
- condition: and # trigger by by-pass turning off - trigger above rising humidity - winter mode enabled - in winter month - fans & lights off
conditions:
- condition: trigger
id:
- 't6'
- "{{ (include_bypass != 'bypass_disabled') }}"
- "{{ 'winter_mode_enabled' in include_winter_mode }}"
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 ) or ((winter_include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- condition: template
value_template: "{{ (now().month | string in month_winter_mode ) }}"
- condition: numeric_state
entity_id: !input trigger
above: !input winter_rising_humidity
below: "100"
- condition: and # trigger by manual fan switch option
conditions:
- condition: state
entity_id: !input manual_fan_switch
match: any
state: 'on'
- condition: trigger
id:
- 't7'
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- condition: and # trigger by manual trigger option
conditions:
- condition: state
entity_id: !input manual_trigger
match: any
state: 'on'
- condition: trigger
id:
- 't8'
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
# Check Humidity Derivative Sensor By-pass
- condition: or
conditions:
- "{{ include_bypass == 'bypass_disabled' }}"
- "{{ by_pass == [] }}"
- "{{ (include_bypass == 'bypass_enabled_turn_on') and (states[by_pass].state == 'off') }}"
- "{{ (include_bypass == 'bypass_enabled') and (states[by_pass].state == 'off') }}"
- "{{ (include_bypass == 'bypass_enabled_stop') and (states[by_pass].state == 'off') }}"
- "{{ (include_bypass_auto_off == 'bypass_auto_off_enabled') and (states[by_pass].state == 'off') }}"
- "{{ (include_bypass_auto_off == 'bypass_auto_off_enabled') and (states[by_pass].state == 'on') and (trigger.id == 't2') }}"
- condition: trigger
id: 't5'
action:
- choose:
- alias: "For winter mode when enabled and within the set winter months"
conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id:
- 't0'
- 't1'
- condition: and
conditions:
- "{{ include_winter_mode == 'winter_mode_enabled' }}"
- condition: template
value_template: "{{ (now().month | string in month_winter_mode ) }}"
- condition: trigger
id:
- 't2'
- 't5'
- 't6'
- 't7'
- 't8'
sequence:
- choose:
- alias: "By-pass is turned on & check by-pass option - turn fan off"
conditions:
- condition: trigger
id: 't5'
- condition: template
value_template: "{{ include_bypass == 'bypass_enabled' }}"
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- alias: "Check by-pass settings and preform the correct action"
if:
- alias: "Check if the by-pass auto off is enabled"
condition: template
value_template: "{{ include_bypass_auto_off == 'bypass_auto_off_enabled' }}"
then:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
- alias: "By-pass is turned on & check by-pass option - keep the current fan state"
conditions:
- condition: trigger
id: 't5'
- condition: template
value_template: "{{ include_bypass == 'bypass_enabled_stop' }}"
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- alias: "Check by-pass settings and preform the correct action"
if:
- alias: "Check if the by-pass auto off is enabled"
condition: template
value_template: "{{ include_bypass_auto_off == 'bypass_auto_off_enabled' }}"
then:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
else:
- stop: "Stop the automation"
- choose:
- alias: "By-pass is turned off & preform the correct action"
conditions:
- condition: trigger
id: 't6'
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check by-pass options - turn fan off is enabled"
conditions:
- condition: template
value_template: "{{ 'bypass_turn_fan_off' in bypass_options }}"
sequence:
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Check if the sensor is below falling humidity & by-pass options - turn fan off is disabled"
conditions:
- alias: "Check sensor is below falling"
condition: numeric_state
entity_id: !input trigger
below: !input winter_falling_humidity
- condition: not
conditions:
- condition: template
value_template: "{{ 'bypass_turn_fan_off' in bypass_options }}"
sequence:
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input winter_time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input winter_time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Check if the sensor is above winter rising humidity & by-pass options - turn fan off is disabled"
conditions:
- alias: "Check sensor is above rising"
condition: numeric_state
entity_id: !input trigger
above: !input winter_rising_humidity
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 ) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'off') | list | count > 0)) }}"
- condition: not
conditions:
- condition: template
value_template: "{{ 'bypass_turn_fan_off' in bypass_options }}"
sequence:
- alias: "We need something here to continue"
delay:
milliseconds: 10
default: # Run through automation and preform the correct action
- alias: "Wait until Humidity Derivative Sensor drops or it times out"
wait_for_trigger:
- platform: numeric_state
entity_id: !input trigger
below: !input winter_falling_humidity
timeout:
minutes: !input winter_time_out
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input winter_time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input winter_time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- choose:
- alias: "Preform the manual fan switch option"
conditions:
- condition: trigger
id: 't7'
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Low Speed Switch - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ (winter_include_fan_speed == 'fan_low_speed_enabled') or (winter_include_fan_speed == 'fan_speed_off_enabled')}}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Turn on the fan"
service: homeassistant.turn_on
target: !input fan_switch
- choose:
- alias: "Check if manual fan switch auto off is enabled"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch_auto_off' }}"
sequence:
- alias: "Wait until manual fan switch is turned off or the time delay passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
timeout:
minutes: !input manual_fan_switch_time_delay
- alias: "Check if manual fan switch is enabled"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch' }}"
sequence:
- alias: "Wait until manual fan switch is turned off"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
- alias: "Parallel Actions for the fan, lights and automation link"
parallel:
- sequence:
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ (winter_include_fan_speed == 'fan_low_speed_enabled') or (winter_include_fan_speed == 'fan_speed_off_enabled') }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- choose:
- alias: "Check if the run on timer is switch is on"
conditions:
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Preform the manual trigger option"
conditions:
- condition: trigger
id: 't8'
sequence:
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn on the automation link"
service: homeassistant.turn_on
target:
entity_id: !input automation_link
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "Set the transition for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
- alias: "Set the transition and brightness for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
- alias: "Set the transition and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
- alias: "Set the colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the default for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Low Speed Switch - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ (winter_include_fan_speed == 'fan_low_speed_enabled') or (winter_include_fan_speed == 'fan_speed_off_enabled') }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Turn on the fan"
service: homeassistant.turn_on
target: !input fan_switch
- choose:
- alias: "Check manual trigger with safeguard is selected"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger' }}"
sequence:
- alias: "Wait until manual trigger is turned off or the safeguard has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input winter_time_out
- choose:
- alias: "Check if the manual trigger switch is ON and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- alias: "Check manual trigger with time delay is selected"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger_time_delay' }}"
sequence:
- alias: "Wait until manual trigger is turned off or the time delay has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input manual_trigger_winter_time_delay
- choose:
- alias: "Check if the manual trigger switch is ON and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- alias: "Parallel Actions for the fan, lights and automation link"
parallel:
- sequence:
- alias: "Wait until the time delay has passes"
delay:
minutes: !input winter_time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait until the low speed time delay passes"
delay:
minutes: !input winter_time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled and the lights are ON"
conditions:
- "{{ ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- alias: "Wait until the light time delay has passes"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- alias: "Wait until the automation link time delay has passes"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- choose:
- alias: "Safeguard when HA restarts"
conditions:
- condition: trigger
id: 't2'
sequence:
- choose:
- alias: "Check manual trigger with safeguard is selected and manual trigger is ON"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger' }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual trigger is turned off or the safeguard has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input time_out
- choose:
- alias: "Check if the manual trigger switch is on and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- alias: "Check manual trigger with time delay is selected and manual trigger is ON"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger_time_delay' }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual trigger is turned off or the time delay has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input manual_trigger_winter_time_delay
- choose:
- alias: "Check if the manual trigger switch is on and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check manual fan switch is enabled and manual switch is ON"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch' }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual fan switch is turned OFF or safeguard has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
- alias: "Check manual fan switch with time delay is selected and manual switch is ON"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch_auto_off' }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual fan switch is turned off or the time delay has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
timeout:
minutes: !input manual_fan_switch_time_delay
- choose:
- alias: "Check manual fan switch is ON and turn it OFF"
conditions:
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check automation and preform the correct action"
conditions:
- alias: "Check if the winter humidity derivative sensor is below falling humidity set point and fan / lights are on"
condition: numeric_state
entity_id: !input trigger
below: !input winter_falling_humidity
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or ((winter_include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- choose:
- alias: "Check if the by-pass auto off is enabled and by-pass is ON"
conditions:
- condition: template
value_template: "{{ (include_bypass_auto_off == 'bypass_auto_off_enabled') and (states[by_pass].state == 'on') }}"
sequence:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input winter_time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input winter_time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Check automation and preform the correct action"
conditions:
- alias: "Check if the winter humidity derivative sensor is above falling humidity set point and fan / lights are on"
condition: numeric_state
entity_id: !input trigger
above: !input winter_rising_humidity
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or ((winter_include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- "{{ ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) or (include_lights == 'lights_disabled') }}"
- "{{ ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) or (include_automation_link == 'disable_automation_link') }}"
sequence:
- choose:
- alias: "Check if the by-pass auto off is enabled and by-pass is ON"
conditions:
- condition: template
value_template: "{{ (include_bypass_auto_off == 'bypass_auto_off_enabled') and (states[by_pass].state == 'on') }}"
sequence:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
- alias: "Wait until Humidity Derivative Sensor drops or it times out"
wait_for_trigger:
- platform: numeric_state
entity_id: !input trigger
below: !input winter_falling_humidity
timeout:
minutes: !input winter_time_out
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input winter_time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input winter_time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Low Speed Switch - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ (winter_include_fan_speed == 'fan_low_speed_enabled') or (winter_include_fan_speed == 'fan_speed_off_enabled')}}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Turn on the fan"
service: homeassistant.turn_on
target: !input fan_switch
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "Set the transition for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
- alias: "Set the transition and brightness for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
- alias: "Set the transition and colour temperature for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
- alias: "Set the colour temperature for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness and colour temperature for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the default for the winter mode lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn on the automation link"
service: homeassistant.turn_on
target:
entity_id: !input automation_link
- choose:
- alias: "By-pass is enabled & check by-pass option - turn fan on"
conditions:
- condition: trigger
id: 't5'
- condition: template
value_template: "{{ include_bypass == 'bypass_enabled_turn_on' }}"
sequence:
- alias: "Check by-pass settings and preform the correct action"
if:
- alias: "Check if the by-pass auto off is enabled"
condition: template
value_template: "{{ include_bypass_auto_off == 'bypass_auto_off_enabled' }}"
then:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
else:
- stop: "Stop the automation"
- alias: "Wait until Humidity Derivative Sensor drops or it times out"
wait_for_trigger:
- platform: numeric_state
entity_id: !input trigger
below: !input winter_falling_humidity
timeout:
minutes: !input winter_time_out
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input winter_time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input winter_time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ winter_include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
default:
- alias: "Check if the triggers"
condition: trigger
id:
- 't2'
- 't3'
- 't4'
- 't5'
- 't6'
- 't7'
- 't8'
- choose:
- alias: "By-pass is turned on & check by-pass option - turn fan off"
conditions:
- condition: trigger
id: 't5'
- condition: template
value_template: "{{ include_bypass == 'bypass_enabled' }}"
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- alias: "Check by-pass settings and preform the correct action"
if:
- alias: "Check if the by-pass auto off is enabled"
condition: template
value_template: "{{ include_bypass_auto_off == 'bypass_auto_off_enabled' }}"
then:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
- alias: "By-pass is turned on & check by-pass option - keep the current fan state"
conditions:
- condition: trigger
id: 't5'
- condition: template
value_template: "{{ include_bypass == 'bypass_enabled_stop' }}"
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- alias: "Check by-pass settings and preform the correct action"
if:
- alias: "Check if the by-pass auto off is enabled"
condition: template
value_template: "{{ include_bypass_auto_off == 'bypass_auto_off_enabled' }}"
then:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
else:
- stop: "Stop the automation"
- choose:
- alias: "By-pass is turned off & check if the sensor is below falling humidity"
conditions:
- condition: trigger
id: 't6'
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check by-pass options - turn fan off is enabled"
conditions:
- condition: template
value_template: "{{ 'bypass_turn_fan_off' in bypass_options }}"
sequence:
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Check if the sensor is below falling humidity & by-pass options - turn fan off is disabled"
conditions:
- alias: "Check sensor is below falling"
condition: numeric_state
entity_id: !input trigger
below: !input falling_humidity
- condition: not
conditions:
- condition: template
value_template: "{{ 'bypass_turn_fan_off' in bypass_options }}"
sequence:
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Check if the sensor is above rising humidity & by-pass options - turn fan off is disabled"
conditions:
- alias: "Check sensor is above rising"
condition: numeric_state
entity_id: !input trigger
above: !input rising_humidity
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 ) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'off') | list | count > 0)) }}"
- condition: not
conditions:
- condition: template
value_template: "{{ 'bypass_turn_fan_off' in bypass_options }}"
sequence:
- alias: "We need something here to continue"
delay:
milliseconds: 10
default: # Run through automation and preform the correct action
- alias: "Wait until Humidity Derivative Sensor drops or it times out"
wait_for_trigger:
- platform: numeric_state
entity_id: !input trigger
below: !input falling_humidity
timeout:
minutes: !input time_out
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- choose:
- alias: "Preform the manual fan switch option"
conditions:
- condition: trigger
id: 't7'
sequence:
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Low Speed Switch - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ (include_fan_speed == 'fan_low_speed_enabled') or (include_fan_speed == 'fan_speed_off_enabled')}}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Turn on the fan"
service: homeassistant.turn_on
target: !input fan_switch
- choose:
- alias: "Check if manual fan switch auto off is enabled"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch_auto_off' }}"
sequence:
- alias: "Wait until manual fan switch is turned off or the time delay passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
timeout:
minutes: !input manual_fan_switch_time_delay
- alias: "Check if manual fan switch is enabled"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch' }}"
sequence:
- alias: "Wait until manual fan switch is turned off"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
- alias: "Parallel Actions for the fan, lights and automation link"
parallel:
- sequence:
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ (include_fan_speed == 'fan_low_speed_enabled') or (include_fan_speed == 'fan_speed_off_enabled') }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Preform the manual trigger option"
conditions:
- condition: trigger
id: 't8'
sequence:
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn on the automation link"
service: homeassistant.turn_on
target:
entity_id: !input automation_link
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "Set the transition for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
- alias: "Set the transition and brightness for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
- alias: "Set the transition and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
- alias: "Set the colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the default for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Low Speed Switch - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ (include_fan_speed == 'fan_low_speed_enabled') or (include_fan_speed == 'fan_speed_off_enabled') }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Turn on the fan"
service: homeassistant.turn_on
target: !input fan_switch
- choose:
- alias: "Check manual trigger with safeguard is selected"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger' }}"
sequence:
- alias: "Wait until manual trigger is turned off or the safeguard has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input time_out
- choose:
- alias: "Check if the manual trigger switch is ON and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- alias: "Check manual trigger with time delay is selected"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger_time_delay' }}"
sequence:
- alias: "Wait until manual trigger is turned off or the time delay has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input manual_trigger_default_time_delay
- choose:
- alias: "Check if the manual trigger switch is ON and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- alias: "Parallel Actions for the fan, lights and automation link"
parallel:
- sequence:
- alias: "Wait until the time delay has passes"
delay:
minutes: !input time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait until the low speed time delay passes"
delay:
minutes: !input time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled and the lights are ON"
conditions:
- "{{ ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- alias: "Wait until the light time delay has passes"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- alias: "Wait until the automation link time delay has passes"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- choose:
- alias: "Safeguard when HA restarts"
conditions:
- condition: trigger
id: 't2'
sequence:
- choose:
- alias: "Check manual trigger with safeguard is selected and manual trigger is ON"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger' }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual trigger is turned off or the safeguard has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input time_out
- choose:
- alias: "Check if the manual trigger switch is on and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- alias: "Check manual trigger with time delay is selected and manual trigger is ON"
conditions:
- "{{ include_manual_trigger == 'enable_manual_trigger_time_delay' }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual trigger is turned off or the time delay has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_trigger
from: "on"
to: "off"
timeout:
minutes: !input manual_trigger_default_time_delay
- choose:
- alias: "Check if the manual trigger switch is on and turn it OFF"
conditions:
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF the manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check manual fan switch is enabled and manual switch is ON"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch' }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual fan switch is turned OFF or safeguard has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
- alias: "Check manual fan switch with time delay is selected and manual switch is ON"
conditions:
- "{{ include_manual_fan_switch == 'enable_manual_fan_switch_auto_off' }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Wait until manual fan switch is turned off or the time delay has passes"
wait_for_trigger:
- platform: state
entity_id: !input manual_fan_switch
from: "on"
to: "off"
timeout:
minutes: !input manual_fan_switch_time_delay
- choose:
- alias: "Check manual fan switch is ON and turn it OFF"
conditions:
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check automation and preform the correct action"
conditions:
- alias: "Check if the humidity derivative sensor is below falling humidity set point and fan / lights are on"
condition: numeric_state
entity_id: !input trigger
below: !input falling_humidity
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or ((include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) or ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) }}"
sequence:
- choose:
- alias: "Check if the by-pass auto off is enabled and by-pass is ON"
conditions:
- condition: template
value_template: "{{ (include_bypass_auto_off == 'bypass_auto_off_enabled') and (states[by_pass].state == 'on') }}"
sequence:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "Check automation and preform the correct action"
conditions:
- alias: "Check if the humidity derivative sensor is above falling humidity set point and fan / lights are on"
condition: numeric_state
entity_id: !input trigger
above: !input rising_humidity
- "{{ (expand(fan_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or ((include_fan_speed == 'fan_low_speed_enabled') and (expand(fan_speed_low) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- "{{ ((include_lights == 'lights_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) or (include_lights == 'lights_disabled') }}"
- "{{ ((include_automation_link == 'enable_automation_link') and (expand(automation_link) | selectattr('state', '==', 'on') | list | count > 0)) or (include_automation_link == 'disable_automation_link') }}"
sequence:
- choose:
- alias: "Check if the by-pass auto off is enabled and by-pass is ON"
conditions:
- condition: template
value_template: "{{ (include_bypass_auto_off == 'bypass_auto_off_enabled') and (states[by_pass].state == 'on') }}"
sequence:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
- alias: "Wait until Humidity Derivative Sensor drops or it times out"
wait_for_trigger:
- platform: numeric_state
entity_id: !input trigger
below: !input falling_humidity
timeout:
minutes: !input time_out
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
- stop: "Stop the automation"
- choose:
- alias: "Check if the manual trigger option is enabled and switch is on"
conditions:
- "{{ (include_manual_trigger == 'enable_manual_trigger') or (include_manual_trigger == 'enable_manual_trigger_time_delay') }}"
- "{{ expand(manual_trigger) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual trigger"
service: homeassistant.turn_off
entity_id: !input manual_trigger
- choose:
- alias: "Check if the manual fan switch option is enabled and switch is on"
conditions:
- "{{ (include_manual_fan_switch == 'enable_manual_fan_switch') or (include_manual_fan_switch == 'enable_manual_fan_switch_auto_off') }}"
- "{{ expand(manual_fan_switch) | selectattr('state', '==', 'on') | list | count > 0 }}"
sequence:
- alias: "Turn OFF manual fan switch"
service: homeassistant.turn_off
entity_id: !input manual_fan_switch
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan Speed - Low Speed Switch - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- choose:
- alias: "Check if fan speeds are enabled"
conditions:
- "{{ (include_fan_speed == 'fan_low_speed_enabled') or (include_fan_speed == 'fan_speed_off_enabled')}}"
sequence:
- alias: "Fan Speed - Switch Off - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_off
- alias: "Turn on the fan"
service: homeassistant.turn_on
target: !input fan_switch
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- choose:
- alias: "Set the transition for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
- alias: "Set the transition and brightness for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
- alias: "Set the transition and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
- alias: "Set the colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the brightness and colour temperature for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
color_temp_kelvin: "{{temperature_value}}"
- alias: "Set the default for the normal lights"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Turn on the automation link"
service: homeassistant.turn_on
target:
entity_id: !input automation_link
- choose:
- alias: "By-pass is enabled & check by-pass option - turn fan on"
conditions:
- condition: trigger
id: 't5'
- condition: template
value_template: "{{ include_bypass == 'bypass_enabled_turn_on' }}"
sequence:
- alias: "Check by-pass settings and preform the correct action"
if:
- alias: "Check if the by-pass auto off is enabled"
condition: template
value_template: "{{ include_bypass_auto_off == 'bypass_auto_off_enabled' }}"
then:
- alias: "Wait the number of minutes set in the by-pass auto off time delay"
delay:
minutes: !input bypass_auto_off_delay
- alias: "Turn off the by-pass"
service: homeassistant.turn_off
entity_id: !input by_pass
- stop: "Stop the automation"
else:
- stop: "Stop the automation"
- alias: "Wait until Humidity Derivative Sensor drops or it times out"
wait_for_trigger:
- platform: numeric_state
entity_id: !input trigger
below: !input falling_humidity
timeout:
minutes: !input time_out
- alias: "Parallel Actions for the fan and lights"
parallel:
- sequence:
- alias: "Wait the number of minutes that has been set for the time delay"
delay:
minutes: !input time_delay
- alias: "Turn off the fan"
service: homeassistant.turn_off
target: !input fan_switch
- choose:
- alias: "Check if the fan speed switch to low speed then off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_low_speed_enabled' }}"
sequence:
- alias: "Fan low speed ON"
service: homeassistant.turn_on
entity_id: !input fan_speed_low
- alias: "Wait the number of minutes set in the low speed time delay"
delay:
minutes: !input time_delay_low_speed
- alias: "Fan low speed OFF - Safeguard"
service: homeassistant.turn_off
entity_id: !input fan_speed_low
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- alias: "Check if the fan speed off option is enabled"
conditions:
- "{{ include_fan_speed == 'fan_speed_off_enabled' }}"
sequence:
- alias: "Fan off speed"
service: homeassistant.turn_on
entity_id: !input fan_speed_off
- sequence:
- choose:
- alias: "Check if the lights are enabled"
conditions:
- "{{ include_lights == 'lights_enabled' }}"
sequence:
- alias: "Wait the number of minutes set in the lights time delay"
delay:
minutes: !input light_time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- sequence:
- choose:
- alias: "Check if the automation link is enabled"
conditions:
- "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- alias: "Wait the number of minutes set in the automation link time delay"
delay:
minutes: !input automation_link_time_delay
- alias: "Turn off the automation link"
service: homeassistant.turn_off
target:
entity_id: !input automation_link
@mcfarlde
Copy link

Have you considered comparing the bathroom humidity to an average of the floor humidities? It works well for me year round but I need to integrate manual fan control into it as my method turns off the fan when used manually for other purposes than humidity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment