Hierarchy for zones?

I’ve been struggling with overlappings zones. I haven’t found any topics related to this, but surely someone else would like to have nested zones / hierarchy (parent-child) in zones ?

The problem:
I have one big zone called “near area”, which is about 20 km radius from my home. There is also some smaller zones inside that area, like shopping centers.

I have some automations which are based on whether anyone is in home or “near home”. Example turn on the towel heater in the evening. Now the problem with this is, that if we are in the shopping center when automation is run, automation does not turn on the heater, because we are in the shopping center zone, not in the near area zone. Eventough these two zones do overlap.

I can circumvent this by checking all the zones in the automation. But this makes it really difficult to maintain. Everytime I add new zone inside the near area, I need to add it to multiple automations also. If I could add zone inside/under another zone, it would be automatically considered in all automations where I have added the parent zone.

Now my automation is this:

alias: Turn on Towel heater
triggers:
  - trigger: time
    at: "18:40:00"
conditions:
  - condition: or
    conditions:
      - condition: numeric_state
        entity_id: zone.near
        above: "0"
      - condition: numeric_state
        entity_id: zone.home
        above: "0"
      - condition: numeric_state
        entity_id: zone.lielahti
        above: 0
      - condition: numeric_state
        entity_id: zone.veska
        above: 0
      - condition: numeric_state
        entity_id: zone.elo
        above: 0
      - condition: numeric_state
        entity_id: zone.kaleva
        above: 0
actions:
  - type: turn_on
    device_id: xxx
    entity_id: xxx
    domain: switch
mode: single

When ideally there could be only one condition, if all the zones could be marked as a child for near area.

There’s currently no support for multiple zones when reporting which zone the person is in. See this GitHub issue & the linked thread.

Your only option for now is to use the Proximity integration & have a single condition that you are less than 20km from home in the automation.

1 Like

Zones are not that easy to use as an entity in HA, but the state changes of the zones can be used to create a self-made zone.
It requires some automations, but it can be much more granular than what is available in HAs built-in features.

Thank You for this! Proximity seems to be the way to solve my problems.

I still do believe there should be nesting for zones for other use cases.