rmoesbergen / openwrt-ha-device-tracker

OpenWRT device tracker for Home Assistant that actually works
101 stars 18 forks source link

Version sensor modification suggestions #42

Closed walberjunior closed 11 months ago

walberjunior commented 1 year ago

rmoesbergen Thank you for adding the sensor with the current version.

I have 2 suggestions:

The way the sensor was added, it remains without any domain, something like "c2.presence_detector_version" I modified line 22, from:

        entity_id = f"{ap_name}.presence_detector_version"

to:

        entity_id = f"sensor.{ap_name}_presence_detector_version"

So the sensor looks like this:

sensor.c2_presence_detector_version

And after restarting the HA, the sensor remains undefined, perhaps a problem with the card I use, as it seems to me that the last_change and last_update states do not change after the restart.

So I modified lines 265 and 266, from:

                    self._do_initial_sync()
            else:

to:

                    self._do_full_sync()
                    self._update_version_entity()
            else:

I don't know if it has any negative impact, perhaps this part of the code is executed at other times and not just when reconnecting with the HA

rmoesbergen commented 11 months ago

Thanks @walberjunior ! I've added these changes and released 2.1.1