In this video I show and explain the ceiling auto fan control I use in my Bedroom to change the fan speed while I am sleeping. Based on the time and the temperature of the room, I have programmed HA to set the fan speed and to turn it off just before my alarm is to ring as a further incentive to get my but up out of bed. One of the automations in this group of 3 automations uses the new ‘NOT’ condition to make the decision of should the fan be turned off or not.
I have all the YAML here on my website, as some of the character would not display properly in the provided YouTube Text Description Area. Please see the link to my website below to find the YAML code to copy and modify as you feel appropriate.
If you have any set-up and support questions I suggest going to my Discord server linked below as I will see messages there first. Comments are always welcome anywhere.
Related website for this video: https://www.whatarewefixing.today/?p=280
Episode: 30
Video related content (YAML CODE):
automations: ##################################################### # Bedroom # ##################################################### - id: 1a863145-656e-4dd6-8cbf-1de4bc3665f3 # Complain if the bedroom door is still open shortly # before the Bedroom AC is scheduled to turn on alias: Bedroom Door is Open initial_state: 'on' trigger: - platform: time at: '19:34:06' condition: condition: and conditions: - condition: state entity_id: binary_sensor.bedroom state: 'on' - condition: numeric_state entity_id: sensor.bedroom_temperature above: 73 - condition: state entity_id: input_boolean.bedroom_auto_fan state: 'on' action: - service: tts.google_translate_say entity_id: group.intercom_stack data_template: message: The Bedroom door is open. - id: 92fa7b06-d6d5-426e-a197-15cafdce4d6b # Set the fan speed based on Temperature alias: Bedroom Fan Auto Mode initial_state: 'on' trigger: - platform: state entity_id: sensor.bedroom_temperature - platform: state entity_id: input_boolean.bedroom_auto_fan to: 'on' - platform: time at: '20:00:04' condition: condition: and conditions: - condition: time after: '19:59:57' before: '09:12:53' - condition: state entity_id: input_boolean.bedroom_auto_fan state: 'on' action: - service: mqtt.publish data_template: topic: "Bedroom_Fan/cmnd/FanSpeed" payload: > {% set bte = states('sensor.bedroom_temperature') | float %} {% set bat = states('input_number.bedroom_auto_temp') | float %} {% if bte < bat %} 0 {% elif bte < (bat + 5.5) %} 1 {% elif bte < (bat + 8.5) %} 2 {% else %} 3 {% endif %} - id: 15aa3b87-2173-4d8b-aa63-4ee259fda5b0 # Turn the fan off in the morning to wake my ass up. # And make darn sure it's off... alias: Bedroom Fan Auto Off Mode initial_state: 'on' trigger: - platform: state entity_id: input_number.bedroom_auto_temp to: 'off' - platform: time at: '09:12:58' - platform: time at: '09:15:58' - platform: time at: '09:20:58' condition: condition: not conditions: - condition: state entity_id: fan.bedroom_fan state: 'off' action: - service: mqtt.publish data: topic: "Bedroom_Fan/cmnd/FanSpeed" payload: 0 fan: - platform: mqtt name: "Bedroom Fan" command_topic: "Bedroom_Fan/cmnd/FanSpeed" speed_command_topic: "Bedroom_Fan/cmnd/FanSpeed" state_topic: "Bedroom_Fan/stat/RESULT" speed_state_topic: "Bedroom_Fan/stat/RESULT" state_value_template: > {% if value_json.FanSpeed is defined %} {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}4{%- endif %} {% else %} {% if states.fan.bedroom_fan_fan_popup.state == 'off' -%}0{%- elif states.fan.bedroom_fan_fan_popup.state == 'on' -%}4{%- endif %} {% endif %} speed_value_template: "{{ value_json.FanSpeed }}" availability_topic: Bedroom_Fan/tele/LWT payload_off: "0" payload_on: "4" payload_low_speed: "1" payload_medium_speed: "2" payload_high_speed: "3" payload_available: Online payload_not_available: Offline speeds: - off - low - medium - high sensors: #################################################### # # # Fans # # # #################################################### - platform: mqtt name: "Bedroom FanSpeed" state_topic: "Bedroom_Fan/tele/STATE" unit_of_measurement: '%' value_template: >- {% if value_json.FanSpeed is defined %} {% if value_json.FanSpeed == 0 -%} 0 {%- elif value_json.FanSpeed == 1 -%} 33 {%- elif value_json.FanSpeed == 2 -%} 66 {%- elif value_json.FanSpeed == 3 -%} 100 {%- endif %} {% else %} {% if is_state('fan.bedroom_fan ', 'off') %} 0 {%- elif is_state('fan.bedroom_fan ', 'off') %} 75 {%- endif %} {% endif %} #################################################### # # # Temperature # # # #################################################### - platform: mqtt name: "Bedroom Temperature" state_topic: "Bedroom_Fan/tele/SENSOR" device_class: temperature unit_of_measurement: '°F' value_template: "{{value_json['SI7021'].Temperature }}" availability_topic: "Bedroom_Fan/tele/LWT" payload_available: "Online" payload_not_available: "Offline" - platform: mqtt name: "Bedroom Humidity" state_topic: "Bedroom_Fan/tele/SENSOR" device_class: humidity unit_of_measurement: '%' value_template: "{{value_json['SI7021'].Humidity }}" availability_topic: "Bedroom_Fan/tele/LWT" payload_available: "Online" payload_not_available: "Offline" binary_sensors: ##################################################### # Door Switches (433mhz) # ##################################################### - platform: mqtt name: "Bedroom" device_class: opening state_topic: rf433/Bedroom payload_on: 'ON' payload_off: 'OFF' force_update: false availability_topic: RFBridge2/tele/LWT payload_available: Online payload_not_available: Offline
Helpers from HA UI Editor:


Contact Links:
What are we Fixing Today Homepage / Website:
https://www.WhatAreWeFixing.Today/
Channel Link URL: (WhatAreWeFixingToday)
https://bit.ly/WhatAreWeFixingTodaysYT
What are we Fixing Today Facebook page (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodaybFB
What are we Fixing Today Twitter Account (Sir GoodEnough):
https://bit.ly/WhatAreWeFixingTodayTW
Discord Account: (Sir_Goodenough#9683)
https://discord.gg/Uhmhu3B
Please help support the channel:
Patreon: https://www.patreon.com/WhatAreWeFixingToday
Buy me Coffee: https://www.buymeacoffee.com/SirGoodenough
PayPal one-off donation link: https://www.paypal.me/SirGoodenough
Cash App $CASHTAG: https://cash.me/$SirGoodenough
Venmo cash link: https://venmo.com/SirGoodenough
If you would like to donate anything to this channel, please use this address:
C/O: Sirius GoodEnough
322 Buena Vista Ave.
Department: DYT
Waukesha, Wisconsin, 53188-3602
Link to this video on YouTube:
https://youtu.be/a4JFJz-1wKQ