panhans / HomeAssistant

Home Asisstant related stuff like blueprints for automations and scripts.
102 stars 28 forks source link

AHC: Proximity ignores Distance #88

Open tim-peters opened 1 day ago

tim-peters commented 1 day ago

Even though I'm currently hundreds of km away from my home zone (defined in the proximity section), every time I move towards it, my heating turns on. Expected behavior would be that my movements are being ignored when I'm out of the defined "Proximity Distance". I tried different values for the "Proximity Distance" without success (so this does not seem to be a unit issue).

I'm running v 5.0.9

Here is my trace log: https://controlc.com/5f228328

panhans commented 1 day ago

Hey,

could you paste this in your template editor and post the results here? This snippet filters all sensors of your proximity entity that is equal or less than 50 whatever ( ;) ) to your home.

{{ device_entities('ad0d9c5f424600fb53cfdc4a7501cd97')  
          | expand 
          | selectattr('attributes.device_class', 'eq', 'distance')
          | selectattr('state', '<=', 50 | string)
          | map(attribute='entity_id')
          | map('regex_replace','_(?=[^_]*$)(.*)', '')
          | list }}