Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AHC: Proximity ignores Distance #88

Closed
tim-peters opened this issue Nov 29, 2024 · 8 comments
Closed

AHC: Proximity ignores Distance #88

tim-peters opened this issue Nov 29, 2024 · 8 comments
Assignees
Labels

Comments

@tim-peters
Copy link

tim-peters commented Nov 29, 2024

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 panhans self-assigned this Nov 29, 2024
@panhans panhans added help wanted Extra attention is needed Advanced Heating Control labels Nov 29, 2024
@panhans
Copy link
Owner

panhans commented Nov 29, 2024

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 }}

@tim-peters
Copy link
Author

Thank you for your quick response!

Here is the result:

['sensor.home_[redacted:my full name]', 'sensor.home_nachste']

Please note that I'm currently home (and not far away anymore).

@panhans
Copy link
Owner

panhans commented Dec 2, 2024

Ok, could you check your history (graph) of all distance sensors of your proximity device when you were far away from home?

@tim-peters
Copy link
Author

They were both correct (the graphs overlap as they are identical). The only difference is that the entities shown above are missing the '_entfernung' ending ('sensor.home_nachste' -> 'sensor.home_nachste_entfernung').
image

@Sonsi79
Copy link

Sonsi79 commented Dec 15, 2024

Same error here. I was over 50km away, the distance in blueprint was set to 900m but it start to heat up...

@andreipoenaru
Copy link
Contributor

The problem is that the two distances are compared as strings, and not as numbers: so while 50000 <= 900 is False, '50000' <= '900' is True (because '5' < '9' and the string comparison stops there).

@panhans
Copy link
Owner

panhans commented Dec 17, 2024

Good point. Will check this an fix this soon.

//EDIT: I'd just pushed an update with the fix. Feel free to test and give some feedback

@tim-peters
Copy link
Author

Works like a charm now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants