diff --git a/packages/sunrise.yaml b/packages/sunrise.yaml index a2fe7ce..3e8b300 100644 --- a/packages/sunrise.yaml +++ b/packages/sunrise.yaml @@ -52,6 +52,24 @@ script: - service: scene.turn_on data: entity_id: scene.sunrise_daylight +input_select: + sunrise_days: + name: Days to wake up + options: + - Every Day + - Weekdays + initial: Every Day + icon: mdi:weather-sunset +input_datetime: + sunrise_time: + name: Latest start time + has_date: false + has_time: true + initial: '06:30' +sensor: + - platform: time_date + display: + - time automation: - alias: Sunrise action: @@ -60,26 +78,47 @@ automation: trigger: - platform: sun event: sunrise + - platform: template + value_template: >- + {{ states('sensor.time') == ( + states.input_datetime.sunrise_time.attributes.timestamp + | int | timestamp_custom('%H:%M', False) + ) + }} condition: - condition: state - entity_id: group.phones - state: home - - condition: time - weekday: - - mon - - tue - - wed - - thu - - fri - + entity_id: binary_sensor.occupied + state: 'on' + - condition: state + entity_id: group.bedroom_lights + state: 'off' + - condition: or + conditions: + - condition: state + entity_id: input_select.sunrise_days + state: Every Day + - condition: and + conditions: + - condition: state + entity_id: input_select.sunrise_days + state: Weekdays + - condition: time + weekday: + - mon + - tue + - wed + - thu + - fri group: Sunrise: view: yes icon: mdi:weather-sunset entities: - sun.sun + - sensor.time - group.sunrise_scenes - group.sunrise_automations + - group.sunrise_options - group.sunrise_scripts sunrise_scenes: name: scenes @@ -92,6 +131,11 @@ group: name: Automations entities: - automation.sunrise + sunrise_options: + name: Options + entities: + - input_select.sunrise_days + - input_datetime.sunrise_time sunrise_scripts: name: Scripts entities: