# input_select for dropdown menu to select the timer duration or cancel input_select: master_bedroom_climate_timer_duration: name: Master Bedroom Aircon Sleep options: - "1 hour" - "2 hours" - "3 hours" - "Cancel sleep timer" initial: "Cancel sleep timer" icon: mdi:timer-outline # Single timer for managing the countdown timer: master_bedroom_climate_timer: name: Master Bedroom Aircon Timer duration: "00:00:00" # Initial duration; will be set dynamically # Automation to start or cancel the timer based on the dropdown selection automation: - alias: "Start or Cancel Master Bedroom Climate Timer" trigger: - platform: state entity_id: input_select.master_bedroom_climate_timer_duration action: - service: timer.cancel entity_id: timer.master_bedroom_climate_timer - choose: - conditions: - condition: state entity_id: input_select.master_bedroom_climate_timer_duration state: "1 hour" sequence: - service: timer.start data: entity_id: timer.master_bedroom_climate_timer duration: "01:00:00" - conditions: - condition: state entity_id: input_select.master_bedroom_climate_timer_duration state: "1 minute" sequence: - service: timer.start data: entity_id: timer.master_bedroom_climate_timer duration: "00:01:00" - conditions: - condition: state entity_id: input_select.master_bedroom_climate_timer_duration state: "2 hours" sequence: - service: timer.start data: entity_id: timer.master_bedroom_climate_timer duration: "02:00:00" - conditions: - condition: state entity_id: input_select.master_bedroom_climate_timer_duration state: "3 hours" sequence: - service: timer.start data: entity_id: timer.master_bedroom_climate_timer duration: "03:00:00" - conditions: - condition: state entity_id: input_select.master_bedroom_climate_timer_duration state: "Cancel sleep timer" sequence: - service: timer.cancel entity_id: timer.master_bedroom_climate_timer - service: climate.turn_off target: entity_id: climate.master_bedroom # Automation to turn off the climate entity when the timer finishes - alias: "Turn Off Master Bedroom Climate on Timer Completion" trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.master_bedroom_climate_timer action: - service: climate.turn_off target: entity_id: climate.master_bedroom - service: input_select.select_option data: entity_id: input_select.master_bedroom_climate_timer_duration option: "Cancel sleep timer" # Reset to the initial value