can you help me with this yaml in home assistant? alias: BLINDS Bedroom description:…
- User
can you help me with this yaml in home assistant? alias: BLINDS Bedroom description: Automation to control bedroom blinds based on time, sunlight, and DND mode. triggers:
- trigger: sun event: sunset offset: "-0:30" id: Sunset
- trigger: time at: "20:00:00" id: closeB4bedtime
- trigger: state
entity_id:
- input_boolean.dnd_bedroom from: "on" to: "off" id: DND Off
- trigger: state
entity_id:
- input_boolean.dnd_bedroom from: "off" to: "on" id: DND On
- trigger: template value_template: >- {{ states('sensor.met_office_gogerddan_temperature_3_hourly') | float > 16 }} id: baby_its_hot_out
- trigger: template value_template: >- {{ state_attr('weather.met_office_gogerddan', 'temperature') is not none and state_attr('weather.met_office_gogerddan', 'temperature') > 16 }} id: baby_its_hot_out
- device_id: 2af47b9300fcf239cc70b5f2c832ca22 domain: cover entity_id: d9c57312f1a60951eaf7d55d38530662 type: closed trigger: device id: Manual closed
- device_id: 2af47b9300fcf239cc70b5f2c832ca22 domain: cover entity_id: d9c57312f1a60951eaf7d55d38530662 type: opened trigger: device id: Manual open conditions: [] actions:
- choose:
- conditions:
- condition: trigger
id:
- Sunset
- closeB4bedtime
- DND On
- condition: state entity_id: cover.blinds_upstairs_bedroom state: open sequence:
- action: cover.close_cover target: entity_id: cover.blinds_upstairs_bedroom data: {}
- action: system_log.write data: message: Closed blinds due to sunset, bedtime, or DND on.
- action: input_boolean.turn_on metadata: {} data: {} target: entity_id: input_boolean.automation_closing_bedroom_blinds
- condition: trigger
id:
- conditions:
- condition: trigger
id:
- DND Off sequence:
- if:
- condition: time after: "08:29:00"
- condition: sun before: sunset before_offset: "-0:30" then:
- action: cover.set_cover_position data: position: 98 target: entity_id: cover.blinds_upstairs_bedroom
- delay: seconds: 30
- action: cover.set_cover_position data: position: 100 target: entity_id: cover.blinds_upstairs_bedroom
- action: input_boolean.turn_off metadata: {} data: {} target: entity_id: input_boolean.automation_closing_bedroom_blinds
- action: system_log.write data: message: Opened blinds due to DND off during daytime.
- condition: trigger
id:
- conditions:
- condition: trigger
id:
- Manual closed sequence:
- wait_for_trigger:
- trigger: state
entity_id:
- cover.blinds_upstairs_bedroom to: open from: closed timeout: hours: 0 minutes: 1 seconds: 0 milliseconds: 0
- trigger: state
entity_id:
- if:
- condition: time after: "08:30:00" before: "17:59:00"
- condition: state entity_id: input_boolean.automation_closing_bedroom_blinds state: "off" then:
- action: input_boolean.turn_on target: entity_id: input_boolean.dnd_bedroom data: {}
- wait_for_trigger:
- trigger: state
entity_id:
- cover.blinds_upstairs_bedroom to: open from: closed timeout: hours: 2 minutes: 0 seconds: 0
- trigger: state
entity_id:
- if:
- condition: or
conditions:
- condition: sun before: sunset before_offset: "1:00"
- condition: time before: "21:00:00" then:
- action: input_boolean.turn_off target: entity_id: input_boolean.dnd_bedroom data: {}
- action: system_log.write data: message: >- Turned off DND mode after blinds were manually closed and then opened.
- condition: or
conditions:
- condition: trigger
id:
- conditions:
- condition: trigger
id:
- Manual open sequence:
- if:
- condition: sun before: sunset then:
- action: system_log.write data: message: >- Turned off DND mode after blinds were manually opened and then opened.
- action: input_boolean.turn_off target: entity_id: input_boolean.dnd_bedroom data: {}
- condition: trigger
id:
- conditions:
- condition: trigger
id:
- baby_its_hot_out
- condition: state entity_id: cover.blinds_upstairs_bedroom state: open sequence:
- if:
- condition: time before: "13:00:00" then:
- wait_for_trigger:
- trigger: time at: "13:00:00" continue_on_timeout: false
- action: cover.set_cover_position data: position: 5 target: entity_id: cover.blinds_upstairs_bedroom
- delay: seconds: 30
- action: cover.set_cover_position data: position: 0 target: entity_id: cover.blinds_upstairs_bedroom
- action: input_boolean.turn_on metadata: {} data: {} target: entity_id: input_boolean.automation_closing_bedroom_blinds
- action: system_log.write data: message: Adjusted blinds for sunlight before 1 PM. else:
- action: cover.set_cover_position data: position: 5 target: entity_id: cover.blinds_upstairs_bedroom
- delay: seconds: 30
- action: cover.set_cover_position data: position: 0 target: entity_id: cover.blinds_upstairs_bedroom
- action: system_log.write data: message: Adjusted blinds for sunlight after 1 PM.
- condition: trigger
id:
- conditions:
Assistant
This is a well-structured automation for controlling bedroom blinds. I notice a few potential issues and improvements:
- You have duplicate temperature triggers ("baby_its_hot_out" appears twice with different templates)
- The second temperature trigger might be more reliable as it checks for null values
- The "Manual closed" condition has a wait_for_trigger that might not work as expected
- There's no default action if none of the conditions match
Here's a revised version:
alias: BLINDS Bedroom description: Automation to control bedroom blinds based on time, sunlight, and DND mode. triggers: - trigger: sun event: sunset offset: "-0:30" id: Sunset - trigger: time at: "20:00:00" id: closeB4bedtime - trigger: state entity_id: - input_boolean.dnd_bedroom from: "on" to: "off" id: DND Off - trigger: state entity_id: - input_boolean.dnd_bedroom from: "off" to: "on" id: DND On - trigger: template value_template: >- {{ state_attr('weather.met_office_gogerddan', 'temperature') is not none and state_attr('weather.met_office_gogerddan', 'temperature') > 16 }} id: baby_its_hot_out - device_id: 2af47b9300fcf239cc70b5f2c832ca22 domain: cover entity_id: d9c57312f1a60951eaf7d55d38530662 type: closed trigger: device id: Manual closed - device_id: 2af47b9300fcf239cc70b5f2c832ca22 domain: cover entity_id: d9c57312f1a60951eaf7d55d38530662 type: opened trigger: device id: Manual open conditions: [] actions: - choose: - conditions: - condition: trigger id: - Sunset - closeB4bedtime - DND On - condition: state entity_id: cover.blinds_upstairs_bedroom state: open sequence: - action: cover.close_cover target: entity_id: cover.blinds_upstairs_bedroom data: {} - action: system_log.write data: message: Closed blinds due to sunset, bedtime, or DND on. - action: input_boolean.turn_on metadata: {} data: {} target: entity_id: input_boolean.automation_closing_bedroom_blinds - conditions: - condition: trigger id: - DND Off - condition: time after: "08:29:00" - condition: sun before: sunset before_offset: "-0:30" sequence: - action: cover.set_cover_position data: position: 98 target: entity_id: cover.blinds_upstairs_bedroom - delay: seconds: 30 - action: cover.set_cover_position data: position: 100 target: entity_id: cover.blinds_upstairs_bedroom - action: input_boolean.turn_off metadata: {} data: {} target: entity_id: input_boolean.automation_closing_bedroom_blinds - action: system_log.write data: message: Opened blinds due to DND off during daytime. - conditions: - condition: trigger id: - Manual closed - condition: time after: "08:30:00" before: "17:59:00" - condition: state entity_id: input_boolean.automation_closing_bedroom_blinds state: "off" sequence: - action: input_boolean.turn_on target: entity_id: input_boolean.dnd_bedroom data: {} - wait_for_trigger: - trigger: state entity_id: - cover.blinds_upstairs_bedroom to: open from: closed timeout: hours: 2 minutes: 0 seconds: 0 - if: - condition: or conditions: - condition: sun before: sunset before_offset: "1:00" - condition: time before: "21:00:00" then: - action: input_boolean.turn_off target: entity_id: input_boolean.dnd_bedroom data: {} - action: system_log.write data: message: Turned off DND mode after blinds were manually closed and then opened. - conditions: - condition: trigger id: - Manual open - condition: sun before: sunset sequence: - action: system_log.write data: message: Turned off DND mode after blinds were manually opened. - action: input_boolean.turn_off target: entity_id: input_boolean.dnd_bedroom data: {} - conditions: - condition: trigger id: - baby_its_hot_out - condition: state entity_id: cover.blinds_upstairs_bedroom state: open sequence: - if: - condition: time before: "13:00:00" then: - wait_for_trigger: - trigger: time at: "13:00:00" continue_on_timeout: false - action: cover.set_cover_position data: position: 5 target: entity_id: cover.blinds_upstairs_bedroom - delay: seconds: 30 - action: cover.set_cover_position data: position: 0 target: entity_id: cover.blinds_upstairs_bedroom - action: input_boolean.turn_on metadata: {} data: {} target: entity_id: input_boolean.automation_closing_bedroom_blinds - action: system_log.write data: message: Adjusted blinds for sunlight before 1 PM. else: - action: cover.set_cover_position data: position: 5 target: entity_id: cover.blinds_upstairs_bedroom - delay: seconds: 30 - action: cover.set_cover_position data: position: 0 target: entity_id: cover.blinds_upstairs_bedroom - action: system_log.write data: message: Adjusted blinds for sunlight after 1 PM. default: - action: system_log.write data: message: "Bedroom blinds automation triggered but no conditions matched."Would you like me to explain or break down the changes I made?
- User
I have a problem, sometimes when I manually open the blinds they immediately close by automation - any idea what is causing this?
Assistant
This is a common issue with blind automations. Looking at your configuration, I can see a few potential causes for your blinds immediately closing after manually opening them:
-
Overlapping triggers: When you manually open the blinds, it might be during a time when another condition is active (like high temperature or sunset approaching).
-
State tracking issue: The "Manual open" trigger fires, but another automation condition is immediately evaluated and takes precedence.
-
Missing delay after manual operation: There's no buffer time between manual operation and automation response.
Try adding this to your automation:
# Add this at the top level of your automation mode: queued max: 10 # And add this to your "Manual open" condition sequence sequence: - action: delay data: minutes: 5 - action: system_log.write data: message: Manual override - preventing automations for 5 minutes # Then your existing actions...This creates a 5-minute buffer after manual operation before other automations can take effect. You could also consider adding a specific "manual override" input_boolean that gets set when you manually operate the blinds and prevents other automations from running for a set period.
Another approach is to check what's being logged in your system_log when this happens - it might reveal which specific condition is causing the immediate close.
-
- User
Thank you very much for your help...
Assistant
You're welcome! I'm glad I could help with your blinds automation issue. The immediate closing after manual opening can be frustrating, but the delay buffer should give you more control.
If you continue to have issues or want to refine the automation further, checking your system logs when the problem occurs will provide valuable clues. Sometimes it takes a bit of trial and error to get home automations working perfectly with your specific usage patterns.
Feel free to reach out if you need any additional help with this or other Home Assistant automations!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.