Skip to content

Not an issue - just wanted to share my own automations with you in case there is anything useful for your project. #1

@WyndStryke

Description

@WyndStryke

This is not an issue, I just wanted to share my own 'work in progress' automations with you in case there is anything useful for your project. I suspect that you have already covered all of this.

Not that it's working right now anyway!

The ETA estimator was the most recent thing I added, it's not integrated into the main automation yet but it could be useful for pre-heating the house.


alias: tado_journey_tracker
description: ""
triggers:
  - trigger: time_pattern
    minutes: /1
  - trigger: state
    entity_id:
      - sensor.home_sm_s906b_direction_of_travel
    to: towards
    for:
      hours: 0
      minutes: 1
      seconds: 0
conditions:
  - condition: not
    conditions:
      - condition: zone
        entity_id: device_tracker.sm_s906b
        zone: zone.tesco
      - condition: zone
        entity_id: device_tracker.sm_s906b
        zone: zone.work
      - condition: zone
        entity_id: device_tracker.sm_s906b
        zone: zone.andover
      - condition: zone
        entity_id: device_tracker.sm_s906b
        zone: zone.home
  - condition: and
    conditions:
      - condition: or
        conditions:
          - condition: numeric_state
            entity_id: input_datetime.tado_journey_tracker_start_time
            above: 1
            attribute: timestamp
          - condition: state
            entity_id: sensor.home_sm_s906b_direction_of_travel
            state: towards
            for:
              hours: 0
              minutes: 1
              seconds: 0
          - condition: state
            entity_id: sensor.home_sm_s906b_direction_of_travel
            state: stationary
            for:
              hours: 0
              minutes: 5
              seconds: 0
          - condition: state
            entity_id: sensor.home_sm_s906b_direction_of_travel
            state: arrived
actions:
  - if:
      - condition: or
        conditions:
          - condition: state
            entity_id: sensor.home_sm_s906b_direction_of_travel
            state: stationary
            for:
              hours: 0
              minutes: 5
              seconds: 0
          - condition: state
            entity_id: sensor.home_sm_s906b_direction_of_travel
            state: arrived
      - condition: numeric_state
        entity_id: input_datetime.tado_journey_tracker_start_time
        above: 1
        attribute: timestamp
    then:
      - action: input_datetime.set_datetime
        metadata: {}
        data:
          timestamp: 0
        target:
          entity_id: input_datetime.tado_journey_tracker_start_time
      - action: input_number.set_value
        metadata: {}
        data:
          value: 0
        target:
          entity_id: input_number.tado_journey_tracker_max_distance
      - action: input_number.set_value
        metadata: {}
        data:
          value: 0
        target:
          entity_id: input_number.tado_journey_tracker_speed
      - action: input_datetime.set_datetime
        metadata: {}
        data:
          timestamp: 0
        target:
          entity_id: input_datetime.tado_journey_tracker_eta
  - if:
      - condition: numeric_state
        entity_id: input_datetime.tado_journey_tracker_start_time
        attribute: timestamp
        below: 1
      - condition: state
        entity_id: sensor.home_sm_s906b_direction_of_travel
        state: towards
    then:
      - action: input_datetime.set_datetime
        metadata: {}
        data:
          datetime: "{{ now() }}"
        target:
          entity_id: input_datetime.tado_journey_tracker_start_time
  - if:
      - condition: numeric_state
        entity_id: input_number.tado_journey_tracker_max_distance
        below: sensor.home_sm_s906b_distance
      - condition: state
        entity_id: sensor.home_sm_s906b_direction_of_travel
        state: towards
    then:
      - action: input_number.set_value
        metadata: {}
        data:
          value: "{{ states('sensor.home_sm_s906b_distance') | float }}"
        target:
          entity_id: input_number.tado_journey_tracker_max_distance
  - if:
      - condition: numeric_state
        entity_id: input_number.tado_journey_tracker_speed
        below: "1"
      - condition: state
        entity_id: sensor.home_sm_s906b_direction_of_travel
        state: towards
    then:
      - action: input_number.set_value
        metadata: {}
        data:
          value: "{{ state_attr('device_tracker.sm_s906b', 'speed') | float }}"
        target:
          entity_id: input_number.tado_journey_tracker_speed
    else:
      - if:
          - condition: state
            entity_id: sensor.home_sm_s906b_direction_of_travel
            state: towards
          - condition: numeric_state
            entity_id: input_number.tado_journey_tracker_speed
            above: "0"
        then:
          - action: input_number.set_value
            metadata: {}
            data:
              value: >-
                {{ ((states('input_number.tado_journey_tracker_speed') | float *
                4) + state_attr('device_tracker.sm_s906b', 'speed') | float) / 5
                }}
            target:
              entity_id: input_number.tado_journey_tracker_speed
  - if:
      - condition: numeric_state
        entity_id: input_number.tado_journey_tracker_speed
        above: 0
    then:
      - action: input_datetime.set_datetime
        metadata: {}
        data:
          datetime: >-
            {{ ((now() | as_timestamp) +
            ((states('sensor.home_sm_s906b_distance') | float) /
            (states('input_number.tado_journey_tracker_speed') | float))) |
            as_datetime }}
        target:
          entity_id: input_datetime.tado_journey_tracker_eta
mode: single


alias: Tado - Travelling towards home
description: >-
  TODO car_2 does not work because Tile not ST2 so how to figure out what to do
  - perhaps track device_tracker.sm_s906b.speed or distance via input_number
  helpers
triggers:
  - trigger: state
    entity_id:
      - sensor.home_wyndstryke_direction_of_travel
      - sensor.home_wyndstryke_distance
      - sensor.home_car_2_direction_of_travel
      - sensor.home_car_2_distance
conditions:
  - condition: or
    conditions:
      - condition: and
        conditions:
          - condition: state
            entity_id: sensor.home_car_2_direction_of_travel
            state: towards
            for:
              hours: 0
              minutes: 1
              seconds: 0
          - condition: numeric_state
            entity_id: sensor.home_car_2_distance
            below: 6000
      - condition: and
        conditions:
          - condition: state
            entity_id: sensor.home_wyndstryke_direction_of_travel
            state: towards
            for:
              hours: 0
              minutes: 2
              seconds: 0
          - condition: numeric_state
            entity_id: sensor.home_wyndstryke_distance
            below: 2500
          - condition: not
            conditions:
              - condition: state
                state: Tesco
                entity_id: person.wyndstryke
          - condition: not
            conditions:
              - condition: state
                state: Work
                entity_id: person.wyndstryke
      - condition: and
        conditions:
          - condition: state
            entity_id: sensor.home_wyndstryke_direction_of_travel
            state: arrived
          - condition: state
            entity_id: sensor.home_tado_mode
            state: AWAY
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.home_wyndstryke_direction_of_travel
            state: arrived
        sequence:
          - action: climate.set_preset_mode
            target:
              entity_id:
                - climate.dining_room
                - climate.living_room
            data:
              preset_mode: home
          - action: climate.set_preset_mode
            metadata: {}
            data:
              preset_mode: home
            target:
              entity_id:
                - climate.bathroom
                - climate.main_bedroom
                - climate.spare_bedroom
          - action: light.turn_on
            metadata: {}
            data:
              kelvin: 5000
              brightness_pct: 5
            target:
              area_id: downstairs
      - conditions:
          - condition: state
            entity_id: sensor.home_wyndstryke_direction_of_travel
            state: towards
            for:
              hours: 0
              minutes: 1
              seconds: 0
          - condition: state
            entity_id: sensor.home_car_2_direction_of_travel
            state: arrived
            for:
              hours: 0
              minutes: 5
              seconds: 0
        sequence:
          - action: tado.set_climate_timer
            metadata: {}
            data:
              temperature: >-
                {{18.5 - ((states('sensor.home_wyndstryke_distance')|float) /
                1000)}}
              time_period: "20"
            target:
              floor_id: first_floor
      - conditions:
          - condition: state
            entity_id: sensor.home_wyndstryke_direction_of_travel
            state: towards
            for:
              hours: 0
              minutes: 1
              seconds: 0
          - condition: state
            entity_id: sensor.home_car_2_direction_of_travel
            state: towards
            for:
              hours: 0
              minutes: 1
              seconds: 0
          - condition: numeric_state
            entity_id: sensor.home_car_2_distance
            above: 700
        sequence:
          - action: tado.set_climate_timer
            metadata: {}
            data:
              temperature: >-
                {{18.5 - ((states('sensor.home_wyndstryke_distance')|float) /
                3000)}}
              time_period: "20"
            target:
              floor_id: first_floor
mode: single


alias: Tado - Leaving home
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.home_wyndstryke_direction_of_travel
conditions:
  - condition: not
    conditions:
      - condition: state
        entity_id: sensor.home_tado_mode
        state: AWAY
      - condition: state
        entity_id: sensor.home_wyndstryke_direction_of_travel
        state: arrived
  - condition: state
    entity_id: sensor.home_wyndstryke_direction_of_travel
    state: away_from
actions:
  - action: climate.set_preset_mode
    metadata: {}
    data:
      preset_mode: away
    target:
      floor_id: second_floor
  - action: climate.set_preset_mode
    target:
      floor_id: first_floor
    data:
      preset_mode: away
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id:
        - light.downstairs_a_2
        - light.downstairs_b_2
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id:
        - light.dining_room_a_2
        - light.dining_room_b
        - light.living_room_a
        - light.kitchen_a
        - light.kitchen_b
        - light.kitchen_c
        - light.kitchen_d
        - light.living_room_b
        - light.living_room_c
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id:
        - light.bathroom_a
        - light.main_bedroom_a
        - light.main_bedroom_b
        - light.spare_room_a
mode: single


input_number.tado_journey_tracker_speed
input_number.tado_journey_tracker_max_distance
input_datetime.tado_journey_tracker_start_time
input_datetime.tado_journey_tracker_eta
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions