#Time & @Home Trigger

1 messages · Page 1 of 1 (latest)

charred bluff
#

New to HA, just wanting to make sure I'm understanding this right...

So, in theory, this should trigger at 08:15, 09:15, and 10:15, unless a device assigned to 'Sam' or 'Gabriel' is in the 'Home' zone.

The main thing I'm concerned about is the NOT condition, if II need to be using an OR condition within it for the @home conditions or not.

description: ""
mode: single
triggers:
  - trigger: time_pattern
    hours: /1
    minutes: "15"
    alias: Time @ Hour:15
conditions:
  - alias: AND
    condition: and
    conditions:
      - condition: time
        after: "08:00:00"
        before: "11:00:00"
        alias: Time @ 0800-1100
      - alias: NOT
        condition: not
        conditions:
          - condition: zone
            entity_id: person.sam
            zone: zone.home
            alias: Sam @ Home
          - condition: zone
            entity_id: person.gabriel
            zone: zone.home
            alias: Gabriel @ Home
actions: []

last void
#

The hours: /1 line isn't doing anything

#

That condition will be true if you're both not at home. Which doesn't seem like what you want

#

BTW, you can just test the state of zone.home for 0 (nobody home) or not zero (somebody is home)

#

Unless there are more people that you're excluding

charred bluff
# last void Unless there are more people that you're excluding

I'm essentially trying to handle 'away from home' temp setting.

alias: Temp | Away | Summer
description: ""
triggers:
  - trigger: time_pattern
    minutes: "15"
    alias: Time @ :15
conditions:
  - alias: AND
    condition: and
    conditions:
      - condition: time
        after: "08:00:00"
        before: "11:00:00"
        alias: Time @ 0800-1100
      - condition: state
        entity_id: sensor.season
        state:
          - spring
          - summer
      - condition: state
        entity_id: zone.home
        state:
          - "0"
        attribute: persons
actions:
  - alias: Temp @ 78 | Cool
    action: climate.set_temperature
    metadata: {}
    target:
      entity_id: climate.sensi_thermostat
    data:
      temperature: 78
      hvac_mode: cool
mode: single

Is this better?

last void
#

Remove the attribute line

#

And you don't need the top level and at all. Conditions are and by default

charred bluff
#

Got it. Thank you.

tight drum
#

Just my two cents if you're wanting to expand this automation.

  • You could make it work year-round by moving the season condition into the actions with two IF blocks or a CHOOSE block. IF spring/summer THEN temp = 75; IF fall/winter THEN temp = 65.
  • You could take it a set further by defining a temperature variable based on the season (instead of using the IF/CHOOSE blocks) and then only need a single action using the temperature variable.
  • The variable could determine the season, based on the month for example, and you wouldn't need the sensor entity. (If it is used elsewhere then this doesn't really matter.)
  • You could use input_number helpers to set the two temperatures and not have them hard-coded. You could then easily change the preset temperatures on a dashboard, for example.
charred bluff
charred bluff
#

Alright, this is what I have now for the 'Away' state...

alias: Temp | Away
description: ""
triggers:
  - trigger: time_pattern
    minutes: "15"
    alias: Time @ :15
conditions:
  - condition: time
    after: "08:14:00"
    before: "10:16:00"
    alias: Time @ 0815-1015
  - condition: state
    entity_id: sensor.season
    state:
      - spring
      - summer
    alias: Season @ Spring, Summer
  - condition: state
    entity_id: zone.home
    state:
      - "0"
    alias: 0 @ Home
actions:
  - alias: IF-THEN
    if:
      - alias: OR
        condition: or
        conditions:
          - alias: Current Temp @ Desired
            condition: numeric_state
            entity_id: climate.sensi_thermostat
            attribute: current_temperature
            above: input_number.temp_home
          - alias: External Temp @ Desired
            condition: numeric_state
            entity_id: weather.forecast_home
            attribute: temperature
            above: input_number.temp_home
    then:
      - action: climate.set_temperature
        metadata: {}
        target:
          entity_id: climate.sensi_thermostat
        data:
          temperature: input_number.temp_away_hot
          hvac_mode: cool
        alias: Temp @ away_hot | Cool
    else:
      - action: climate.set_temperature
        metadata: {}
        target:
          entity_id: climate.sensi_thermostat
        data:
          temperature: input_number.temp_away_cold
          hvac_mode: heat
        alias: Temp @ 65 | Heat
mode: single

With input_number.temp_home being a range between 65-75, temp_away_hot being between 75-85, and temp_away_cold being between 65-70 ||(65 is the min allowed in our apartments)||

tight drum
#

The temperature data doesn't look right. You need to return the state of the entity itself.
temperature: "{{ states('input_number.temp_away_cold') }}"
EDIT: Forgot the quotation mark at the end.

charred bluff