Skip to content

Feature: Add Device Track Sensor without breaking Geolocation sensor#158

Open
denisabt wants to merge 2 commits intohass-agent:development-2.2.0-beta1from
denisabt:device_track_sensor
Open

Feature: Add Device Track Sensor without breaking Geolocation sensor#158
denisabt wants to merge 2 commits intohass-agent:development-2.2.0-beta1from
denisabt:device_track_sensor

Conversation

@denisabt
Copy link

This additional sensor returns location as a device tracker sensor, which can directly be added to a map card. Addidional strings (Sensor Description) have been machine translated into all implemented languages.
Also applied minor code cleanups (remove usings, add missing parameters to xml comments).

@amadeo-alex amadeo-alex changed the title Add Device Track Sensor without breaking Geolocation sensor Feature: Add Device Track Sensor without breaking Geolocation sensor Oct 19, 2024
@amadeo-alex amadeo-alex changed the base branch from main-old to development-2.2.0-beta1 June 15, 2025 15:35
@amadeo-alex
Copy link
Collaborator

Apologies that it took so long, I have a few comments/requests regarding the PR.
Would you like me to add them as part of the review process or to grab your branch and do the changes myself?
The question is purely in the terms of time - do you have time to adjust the code - you'll get full credit either way :D

@denisabt
Copy link
Author

Sorry on my part now, github mails seem to go to spam for some weird reason. Up to you, if you have time, grab it and adjust, no problem at all :-)

@amadeo-alex amadeo-alex changed the base branch from development-2.2.0-beta1 to feature-denisabt-devicetracksensor September 12, 2025 10:33
@amadeo-alex amadeo-alex added this to the 2.2.0 milestone Sep 12, 2025
amadeo-alex added a commit to amadeo-alex/HASS.Agent that referenced this pull request Sep 12, 2025
@amadeo-alex amadeo-alex changed the base branch from feature-denisabt-devicetracksensor to development-2.2.0-beta1 September 12, 2025 10:57
@amadeo-alex
Copy link
Collaborator

Yeah, today I've learned not to do git stuff when sick...I wanted to remove changes to some of the files, instead I deleted them from your repo. Very nice of me. Let me fix that...

@amadeo-alex
Copy link
Collaborator

Fixed, now some pills and I'll come back to it later. Sorry for the confusion, at least I've learned gh cli :D
Best result is that I'd like to get the new feature without cleanup/other changes.

@amadeo-alex
Copy link
Collaborator

Hmm, I've taken a more in-depth look and few questions arose:

  • you mention that it creates a device tracker sensor, but the "Domain" is never set to "device_tracker"
  • what is the purpose of the cache?

@amadeo-alex amadeo-alex removed this from the 2.2.0 milestone Sep 12, 2025
@denisabt
Copy link
Author

Hey @amadeo-alex, just wanted after a too long time check back on how it goes, and fortunatly, your question hasn't been unanswered for too long - still figuring out my provider's spam software, notifications still don't arrive at my inbox. But should be able to fix that in no time. Let me have a look at my code again and get back to you by tomorrow. I vaguely remember my reason for the cache, not sure about question one though, so let me get back, to get you a proper reply. Thanks for merging/checking/deleting&undeleting ;-) and your work in general! Back soon.
Cheers Denis

@denisabt
Copy link
Author

In my GeolocationSensor.cs I pushed, Domain=device_tracker shows up twice. Not yet sure why that seems to be missing on your end.
https://github.com/denisabt/HASS.Agent/blob/location-sensor-show-as-device-tracker/src/HASS.Agent/HASS.Agent/HomeAssistant/Sensors/GeneralSensors/SingleValue/GeoLocationSensor.cs

Regarding Caching, during my tests, I stumbled upon a situation in which Location Services from Windows where hammered with Requests from this Sensor / Hass.Agent, and put an unnecessary load on CPU/Battery (Laptop), also due to exceptions being thrown constantly (several times a minute or even seconds).
Not sure if it was when my computer was offline (mobile office etc.), and/or when Hass.Agent had no permission to Location Services, but of those or both, 99% sure.

And also, as even laptops rarely are used as high-res device trackers, I figured, getting location (expensive call in terms of CPU/battery) constantly is not needed.

If you want, I can retest. Usually I comment these things, surprised I did not. Also just found two line feeds which are not needed at all - oups. But thanks for your review & thoughts about this - well spotted !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants