custom-components / places

Component to integrate with OpenStreetMap Reverse Geocode (places)
GNU General Public License v3.0
110 stars 22 forks source link

Repeated information on UI #238

Closed paoloantinori closed 10 months ago

paoloantinori commented 10 months ago

Hi still see the bug described on #188

It kicks in with Show last updated time at end of state '(since xx:yy)' set to true.

And I'f I'm interpreting the code correctly the issue I think it's either here:

https://github.com/custom-components/places/blob/d40057cb3633c6b2effbeafb7b0469c38313a40f/custom_components/places/sensor.py#L2276

where the trimming happens only for a value that exceeds 256 chars

or

with the test conditions

https://github.com/custom-components/places/blob/d40057cb3633c6b2effbeafb7b0469c38313a40f/custom_components/places/sensor.py#L2249

that should compare 2 locations for update only after stripping the (since xx:yy) suffix

Snuffy2 commented 10 months ago

I'm still confused about how this may be happening. Each update the status is rebuilt from scratch so I can't sort out how it may be adding multiple '(since xx:yy)' to the end of the state.

I don't believe it is either of the 2 code sections you listed above.

Line 2276 only trims the state string if it is larger than (225-14) to make sure when adding (since xx:yy) doesn't exceed the 255 character limit.

At the start of an update the previous state is saved prior to any updates. If show time is true, it is removed at line 2074. https://github.com/custom-components/places/blob/d40057cb3633c6b2effbeafb7b0469c38313a40f/custom_components/places/sensor.py#L2074

Then the new state is built from scratch and compared to the previous value to decide if it needs to be updated or not.

Is this happening all of the time or just intermittently? Is it for all states or only when you are Home (or in a zone)?

paoloantinori commented 10 months ago

It doesn't happen constantly, but relatively frequently. I'm currently running a version of the code with additional logging calls to try to pinpoint what is causing this. I'm gonna share update as soon as I have some

Vinkoy commented 10 months ago

I am observing the same issue when the person is in the zone or at home. The new "since time" is appended to the existing string. Home Assistant 2023.11.0 running in docker.

image

Snuffy2 commented 10 months ago

Since I've not been able to sort out what is causing this nor reproduce it on my machines, I'm not totally sure how to fix this. @paoloantinori did you ever find anything in your logging that might help?

All that being said, I did just release v2.5.3 that is more aggressive in removing the (since xx:yy) from the states and will remove >1 of them if they exist. Please give it a try and let me know if it fixes this.

If not, please enable debug logging and post logs when this happens to see if I can sort out what is happening. If you want to email them instead of posting them (due to the location info in the logs), please send them to me at: my7idwq0@mail.snuffy2.com

Snuffy2 commented 10 months ago

Hopefully this is now resolved. Please open a new issue if this is still happening.

paoloantinori commented 10 months ago

Yes, sorry for lack of updates. With your latest release the issue seems to be gone! Thank you

On Sun, 19 Nov 2023, 05:03 Snuffy2, @.***> wrote:

Hopefully this is now resolved. Please open a new issue if this is still happening.

— Reply to this email directly, view it on GitHub https://github.com/custom-components/places/issues/238#issuecomment-1817738092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALTHWU5FNUGB5D25KZIXDLYFGAJBAVCNFSM6AAAAAA6L6Q2IGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXG4ZTQMBZGI . You are receiving this because you were mentioned.Message ID: @.***>