Trying to get a zone to dynamically change between home and work

Trying to get a zone to dynamically change between home and work to reduce the number of routes used by the HERE integration, and I’m getting tripped up by the syntax of the new service call action nomenclature…would love some help please: current code throws errors of data template wrong usage and other variants of errors while trying to figure this out.

choose:
  - conditions:
      - condition: state
        entity_id: device_tracker.iphone_owntracks
        state: Work
    sequence:
      - action: homeassistant.update_entity
        data:
          entity_id:
            - zone.target_zone
          data:
            latitude: <<!nav>>32.29<<!/nav>>
            longitude: <<!nav>>-129.89<<!/nav>>
  - conditions: []
    sequence:
      - action: homeassistant.update_entity
        data_template:
          entity_id: zone.target_zone
          latitude: <<!nav>>33.57<<!/nav>>
          longitude: <<!nav>>-125.92<<!/nav>>

What makes you think that action will reconfigure a zone? Based on the action’s docs, the only argument it takes is a target…

data_template was deprecated nearly 4 years ago…

What even is that?

Plausible-sounding but not fit for purpose actions, defunct configuration keys, and some utter nonsense… its got all the hallmarks of the output from an LLM bullshit engine.


AFAIK, the only way to do that for non-home zones is with the custom action from Spook.

1 Like

The code looks like something dreamed up by AI.

Here’s the documentation for homeassistant.update_entity which only accepts an entity_id key.

Here’s the documentation for homeassistant.set_location which will only allow you to move the default zone (intended for HA installations in RV’s or boats which move).

@Didgeridrew got to admit it was some late night hobbling of some google searches and gemini best tosses at guesses, but I had seen in some of the other threads that the spook integration can illicit a zone change like this - haven’t played around with this integration much as I know it is super powerful and can have some unexpected behavior…what’s a safe route to explore changing a target zone to a new location?

Please explain the problem you are trying to solve with an example. Like, when I leave home and get to the office, I want XYZ to happen.

It’s now working using spook’s zone.update thanks @Didgeridrew. @PeteRage it is to minimize the number of routes needing to be established for the HERE integration, to ensure that there is no additional charges for the free tier…it simply changes the target zone to either home or work depending on if you are at work or not.

Bear in mind that coffee still hasn’t kicked in, and I’ve only had a very quick look at the HERE integration docs, but you might be going about this the wrong way…

You seem to have created a zone named target_zone, then using spook to change the zone location dynamically (set target_zone to work when you’re home, and vice versa).

You could avoid all this by creating a dynamic configuration using an input_select with your two existing destination zones (zone.home & zone.work). You don’t need target_zone at all.

The automation to change the destination would be pretty simple:

  • 2 triggers for device_tracker.iphone_owntracks, one with state Home and the other with state Work.
  • A choose condition within the action which calls input_select.select_option and sets the input select to zone.home when you arrive at work, and zone.work when you arrive home.

Hope the above makes sense. Like I said, coffee still hasn’t kicked in, so let me know if anything’s unclear.