I’ve had several zones set up for work, church, extended family, etc. and have been trying to set up an automation so that when I leave one of those locations and head home, the HVAC turns on about 10 minutes before we are scheduled to get home, to heat/cool the house appropriately (automations adjust the climate when we’re not home so we’re not wasting power on heat/cooling when nobody is home). I’ve spent several days fighting this simple automation, and had various issues that I’ve been working through. But this last one really had me scratching my head. Here’s an example automation trigger to show what I’ve had set up for my wife when she leaves work):
automation heading_home:
trigger:
- platform: zone
entity_id: person.wife
zone: zone.w-work
event: "leave"
One would expect this to work, and indeed when we are at work (or visiting family, or church, or whichever zone we happens to be in), our person entry actually shows that we’re in that zone (at least, it shows in the history and dashboard as such). However, this particular automation has been failing on the zone: zone.w-work
and similar entries consistently. I’ve had 20+ zones set up at this point, and have been using several of them in this automation, with plans to add almost all of them, since I haven’t yet been able to develop a fool-proof way to set a way-point zone that triggers the automation when I or my wife get within 10 minutes of home… So, in the absence of that logic and configuration, I’m using the above logic. And these zones have all worked perfectly fine as far as showing where we are currently located (if my wife is visiting her sister or kids, for example, she always shows as being in the appropriate zone).
So my problem has been that after I created the automation to trigger on leaving a particular zone and set a variable to trigger a climate reset, I got the following error whenever I load the automations:
This had me pulling my hair out, but finally, after much trial and error and very little hair left, I discovered that in one of my trigger entries, I had made a mistake and used underscores instead of dashes in the zone name, such as follows:
- platform: zone
entity_id: person.me
zone: zone.my_work
event: "leave"
…instead of entering it correctly as zone: zone.my-work
, as it had been named when I created the zone, and yet this particular entry did NOT get flagged with an error (I had moved it to the top of the list, so it was now the first one, which had always been flagged with an error)! So I subsequently renamed ALL of my zones to use underscores ‘_’ instead of dashes ‘-’ in their names, and reloaded the automations. Wouldn’t you know, that resolved the issue! No more errors!
I’ve spent a little time going through the documentation and so far have not found any indication that we should not use the dash in zone names, so I’m thinking that this might be a bug with the automation code. Anyway, wanted to post this on the chance that someone else might run into the same issue. If the docs do actually indicate not to use dashes in the zone names, please post a link. Thanks!