How to proper setup proximity with different distance triggers?

Hi all,

I’m new to Home Assistant, but I’m already loving it and adding more and more automation to my house.

My question is about the right way to configure automation triggered by the proximity sensor but acts at different distances.

My concrete example is that I want the temperature of the HVAC to go down when everyone is further than 2km and to go back up when we are closer than 3km.

My first attempt was to do this by creating two triggers:

trigger:
  - platform: numeric_state
    entity_id: proximity.home_martin
    above: 1.9
    id: leaving-home
  - platform: numeric_state
    entity_id: proximity.home_martin
    below: 3.1
    id: approaching-home

I use 1.9 and 3.1 because, in my installation, proximity is reported as integers, so it goes from 1 to 2 to 3 and so on.

That approach worked until I went away enough to trigger the leaving-home trigger but not far away enough to trigger the approaching-home one when getting back. It took me 3 hours and feeling really cold to figure that out.
My mistake, as I see it, is that no numeric state change will go below 3.1km if it never was higher than that.

So I changed it to this:

trigger:
  - platform: numeric_state
    entity_id: proximity.home_martin
    above: 1.9
    id: leaving-home-short
  - platform: numeric_state
    entity_id: proximity.home_martin
    above: 3.1
    id: leaving-home
  - platform: numeric_state
    entity_id: proximity.home_martin
    below: 1.9
    id: approaching-home-short
  - platform: numeric_state
    entity_id: proximity.home_martin
    below: 3.1
    id: approaching-home

With this approach, I have two well-defined radii around my home, and both triggers are fallbacks of the other.

Is there a better or correct way to do this, as both triggers are triggered twice per travelling session?