ufozone / ha-zcs-mower

ZCS Lawn Mower Robots (Ambrogio, Techline, Wiper) platform as a Custom Component for Home Assistant.
MIT License
19 stars 0 forks source link

GPS out of position #152

Closed githubdebit closed 3 months ago

githubdebit commented 3 months ago

After the 1.5 update the GPS positions on the map appear to be offset.

Before (positions OK): Captura de pantalla -2024-06-11 13-23-57 After (positions NOK): Captura de pantalla -2024-06-11 13-14-42

Both have the same top left corner & bottom right corner GPS positions and the same map

Thank you for your work, really appreciated!

ufozone commented 3 months ago

There was no change to the map generation between 1.4 and 1.5: https://github.com/ufozone/ha-zcs-mower/compare/v1.4...v1.5#diff-1992899edc3064b26970f059c17a774d5ca41dc350e801517dd9f1f8508fd15c

To me, this looks like a different map section.

I cannot confirm the problem. Perhaps you can provide more information? For example, which version was actually in use before the upgrade? From 1.1 to 1.3 there were the last major changes to map generation with the introduction of possible map rotation.

githubdebit commented 3 months ago

Your so fast! :)

I updated from 1.4.1 to 1.5 with the same png and the same coordinates. Afterward I return to 1.4 and the map again was ok. Tried to update again to 1.5 and the offset appeared again so I'm now at 1.4 (where the map again returned to normal position).

Always same png and coordinates

ufozone commented 3 months ago

I think I'm on to something. Have you already upgraded to HA 2024.6?

githubdebit commented 3 months ago

Yes!

Core 2024.6.1 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240605.0

ufozone commented 3 months ago

Which HA version was running when you installed zcsmower 1.4? Which HA version was running when you upgraded to zcsmower 1.5? How did you find out the key points?

The following background: My production system is running 2024.5.5 and zcsmower Map in version 1.4 and 1.5 look the same (good). In my test system is running 2024.7.0.dev and zcsmower Map in 1.5 looks good, and 1.4 looks broken.

I guess: You had HA 2024.6.x running and zcsmower 1.4 installed. You experimented with the corner points until it looked good. But it was actually broken. By upgrading to zcsmower 1.5, the integration now displays it correctly, but it looks broken in your case because the corner points are actually not quite right.

My tip: Realign the corner points in the map configuration.

ufozone commented 3 months ago

I have now looked at and tested the source code changes between 1.4 and 1.5 five times and can find no reason for this behavior. All changes were actually just my reactions to the super great and frequent breaking changes in Home Assistant. Curiously, no changes were made to the generation itself, only the generation was outsourced to an asynchronous thread. These sub-threads seem to work differently to the main thread during generation - really good.... not.

The behavior in version 1.5 is correct, at least according to my tests. If the dots are shifted in your case, you must change the configuration so that they move to the correct position. They should then stay there ... at least until the next breaking change.

githubdebit commented 3 months ago

The points are exactly the points reported by google maps in both versions. The captured screen goes from point 1 (upper left) trough point 2 (bottom right) (did as is documented on zcsmower instructions)

I'll try to shift the points. How I can do that? It would be fantastic to have in the configuration window of zcsmower an x,y offset.

ufozone commented 3 months ago

Do not change anything for the time being. I think I have found a race condition. I am currently looking for a solution.

ufozone commented 3 months ago

@githubdebit, you were right that it is not generated correctly in version 1.5.

As suspected, the outsourcing of the map generation to an asynchronous thread is the cause of a race condition. The fix is easy, but it took me a long time.

The fix is now already included in the main branch. A new version will follow soon. Please download the integration directly from the main-branch again: grafik

ufozone commented 3 months ago

OK, I couldn't wait - new version released: https://github.com/ufozone/ha-zcs-mower/releases/tag/v1.5.1

githubdebit commented 3 months ago

I confirm the bug is fixed, thank you very much!

You solve problems at light speed. :1st_place_medal: