For statement applied on "from" state

hi guys,

i was wondering if there was a way to use the “for” statement on the “from” state too.
In particular this is the automation i created

- action:
  - alias: Notify to iPhone
    data:
      message: "arrived home"
    service: notify.ios_iphone
  alias: arrived at home
  condition:
  - after: '08:00:00'
    before: '23:30:00'
    condition: time
  id: '1502891081254'
  trigger:
  - entity_id: device_tracker.iphone
    from: not_home
    platform: state
    to: home
# this is optional and make such that condition is triggered only if home
# persist for more than 10 minutes
    for:
      hours: 0
      minutes: 10
      seconds: 0

so with this automation everything works as expected but in order to make it more robust i would like notification to be sent ONLY if “not_home” state persisted for more than 30mins for example.
Is there a way to do that?

thanks a lot to whom will help!

No one can help?

Do you want it to only trigger if your iphone was not_home for 30 mins and then home for 10 mins? If so, I think you need an input select (or dummy switch) to keep track if not_home was 30 min so when 10 min at home is triggered, the automation can look at this input select.

you hit the point i guess.

I would like the trigger to work:

 - if the phone was NOT HOME for 30mins or more
AND
 - the phone has been HOME for 10mins

now next question is: where can i find info for “input select (or dummy switch” as I have no idea what this :slight_smile:

Input boolean is probably what you’re after, though the documentation also gives you details of input_select and others.

Basically, set up an automation that triggers when you’ve been not_home for 30 minutes and sets the input_boolean. Then, in your “arrived home” notification, unset that input_boolean.