<commit_before>- alias: 'Set heat when I get home'
  trigger:
    platform: state
    entity_id: group.all_devices
    from: 'not_home'
    to: 'home'
  condition:
    condition: and
    conditions:
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: 60
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_occupied

- alias: 'Set heat lower after bed'
  trigger:
    platform: state
    entity_id: group.bedroom_lights
    from: 'on'
    to: 'off'
  condition:
    condition: and
    conditions:
      - condition: time
        after: "22:00:00"
        before: "05:00:00"
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: 60
      - condition: state
        entity_id: group.all_devices
        state: 'home'
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_bed

- alias: 'Set heat higher in the morning'
  trigger:
    platform: time
    after: "07:35"
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: group.all_devices
        state: 'home'
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: 60
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_occupied

- alias: 'Turn heat up as I get closer to home'
  trigger:
    platform: numeric_state
    entity_id: proximity.home
    # 1-5 miles away
    below: 5
    above: 1
  condition:
    condition: and
    conditions:

        # Heading home
      - condition: template
        value_template: '{{ states.proximity.home.attributes.dir_of_travel == "towards" }}'

        # Not already set
      - condition: template
        # TODO figure out how to use a variable
        value_template: '{{ states.climate.stelpro_stzw402_electronic_thermostat_heating_1_11.attributes.temperature != 62 }}'

        # Nobody home
      - condition: state
        entity_id: group.all_devices
        state: 'not_home'

        # Temp below target
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: !secret heat_target_mid

        # Automation enabled
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: climate.set_temperature
    entity_id: climate.stelpro_stzw402_electronic_thermostat_heating_1_11
    data:
      temperature: !secret heat_target_mid

# In case I get close and the above triggers, then go away
- alias: 'Make sure heat is down when I am far away'
  trigger:
    platform: numeric_state
    entity_id: proximity.home
    above: 6
  condition:
    condition: and
    conditions:
        # Heading away
      - condition: template
        value_template: '{{ states.proximity.home.attributes.dir_of_travel != "towards" }}'
        # Nobody home
      - condition: state
        entity_id: group.all_devices
        state: 'not_home'
        # Temp below target
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        above: !secret heat_target_away
        # Automation enabled
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: climate.set_temperature
    entity_id: climate.stelpro_stzw402_electronic_thermostat_heating_1_11
    data:
      temperature: !secret heat_target_away
<commit_msg>add weekend heat automation<commit_after>- alias: 'Set heat when I get home'
  trigger:
    platform: state
    entity_id: group.all_devices
    from: 'not_home'
    to: 'home'
  condition:
    condition: and
    conditions:
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: 60
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_occupied

- alias: 'Set heat lower after bed'
  trigger:
    platform: state
    entity_id: group.bedroom_lights
    from: 'on'
    to: 'off'
  condition:
    condition: and
    conditions:
      - condition: time
        after: "22:00:00"
        before: "05:00:00"
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: 60
      - condition: state
        entity_id: group.all_devices
        state: 'home'
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_bed

- alias: 'Set heat higher in the morning - weekday'
  trigger:
    platform: time
    after: "07:30"
  condition:
    condition: and
    conditions:
      - condition: time
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
      - condition: state
        entity_id: group.all_devices
        state: 'home'
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_occupied

- alias: 'Set heat higher in the morning - weekend'
  trigger:
    platform: time
    after: "09:00"
  condition:
    condition: and
    conditions:
      - condition: time
        weekday:
          - sat
          - sun
      - condition: state
        entity_id: group.all_devices
        state: 'home'
      - condition: state
        entity_id: input_boolean.vacation
        state: 'off'
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: script.heat_occupied

- alias: 'Turn heat up as I get closer to home'
  trigger:
    platform: numeric_state
    entity_id: proximity.home
    # 1-5 miles away
    below: 5
    above: 1
  condition:
    condition: and
    conditions:

        # Heading home
      - condition: template
        value_template: '{{ states.proximity.home.attributes.dir_of_travel == "towards" }}'

        # Not already set
      - condition: template
        # TODO figure out how to use a variable
        value_template: '{{ states.climate.stelpro_stzw402_electronic_thermostat_heating_1_11.attributes.temperature != 62 }}'

        # Nobody home
      - condition: state
        entity_id: group.all_devices
        state: 'not_home'

        # Temp below target
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        below: !secret heat_target_mid

        # Automation enabled
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: climate.set_temperature
    entity_id: climate.stelpro_stzw402_electronic_thermostat_heating_1_11
    data:
      temperature: !secret heat_target_mid

# In case I get close and the above triggers, then go away
- alias: 'Make sure heat is down when I am far away'
  trigger:
    platform: numeric_state
    entity_id: proximity.home
    above: 6
  condition:
    condition: and
    conditions:
        # Heading away
      - condition: template
        value_template: '{{ states.proximity.home.attributes.dir_of_travel != "towards" }}'
        # Nobody home
      - condition: state
        entity_id: group.all_devices
        state: 'not_home'
        # Temp below target
#      - condition: numeric_state
#        entity_id: sensor.stelpro_stzw402_electronic_thermostat_temperature_11
#        above: !secret heat_target_away
        # Automation enabled
      - condition: state
        entity_id: input_boolean.automation_override
        state: 'off'
  action:
    service: climate.set_temperature
    entity_id: climate.stelpro_stzw402_electronic_thermostat_heating_1_11
    data:
      temperature: !secret heat_target_away

{'fraction_non_alphanumeric': 0.07502903600464576, 'fraction_numerical': 0.016376306620209058, 'mean_word_length': 2.4388977635782747, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1959699', 'n_tokens_mistral': 2722, 'n_tokens_neox': 2540, 'n_words': 643}