Bit of advice using zone.home

Hi there I’m a newbie here and apologise if this has been asked elsewhere but I couldn’t see that it had. I’m setting up some automations to turn something off at night and also when people leave the house (this is a tapo plug) - plus reciprocally to turn it on in the morning and when people come home. So far so good.

For people leaving the house I’ve been using successfully the -zone.home to: "0" which is nice and clean because I don’t have to worry about specific users (e.g. sometimes people come to stay and I can just include them seamlessly.

So what I want to do is something really simple and I would like to use zone.home for it. In the morning I turn on tapo plug at 6:45 (i.e.

  - platform: time
    at: "06:45:00"
condition: null
action:
  - type: turn_on

but I also want to add a condition to check if home.zone is greater than 0 i.e. don’t turn on if no one is home. For the life of me I can’t figure out how to do that. Can someone please put me out of my misery (I’ve managed to add other conditions just not this one).

To only turn the switch on if someone is home use a numeric state condition:

condition:
  - condition: numeric_state
    entity: zome.home
    above: 0

You can read about the other available conditions here:

And the different types of triggers are here:

And script syntax (same as automation actions) are here:

1 Like

Amazing thank you!

and just to add the full set of code here incase it helps someone else - note that ‘entity’ in the example above should be (I think) ‘entity_id’. So I’m pretty sure this works for the whole yaml file

alias: HotTap_ON_morningAndSomeoneHome
description: Turn hot tap on in the morning
trigger:
  - platform: time
    at: "06:45:00"
condition: 
  - condition: numeric_state
    entity_id: zone.home
    above: 0
action:
  - type: turn_on
    device_id: 23e00c86bf99bf929802935a18adbea8
    entity_id: switch.hot_tap
    domain: switch
mode: single
1 Like

Yes indeed. That was a mistake on my part.