-
-
Notifications
You must be signed in to change notification settings - Fork 27
Add map camera functionality, better config flow, and initial testing coverage #485
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
=======================================
Coverage ? 98.93%
=======================================
Files ? 16
Lines ? 1314
Branches ? 0
=======================================
Hits ? 1300
Misses ? 14
Partials ? 0 ☔ View full report in Codecov by Sentry. |
I should note this also will resize the camera image before passing it back to HA, seems to be a little faster now. In addition, this would restore the ability to configure low energy mode. That option was removed after I had already reworked the configuration. It's working as advertised, so I would vote to leave it in, but if we want to remove it, I can do that. |
Okay, that's I huge PR. I try to review it.
|
It's absolutely a huge pr, sorry about that, most of its the tests, but I think they'll be worth it. I setup a github action that will run them automatically, if you want to run them manually, I recommend a clean vscode dev container with just this repo, you don't want a core dev container and you can't test directly from windows. From there install the requirements from requirements.txt and then run |
If you decide to merge it, I have the github action setup to upload the coverage results, you would need to register the repo with codecov, codecov.com. It will still pass, just will give a warning that it wasn't able to upload the results. |
Hi, I started reviewing and also testing. |
Ah okay. I have to click on "Save zone" first. Didn't got this. I assumed it's already saved, after it's created. |
It was even in the documentation, that I have to save it :D
This should be catched in the frontend first. |
Good catch, I'll update the options flow to verify that we ensure a mower was added and that we have a test for it to confirm it's all working. |
Yes, it was working. But the problem is, the mower isn't sending en error message when it's in an error mode on the websocket. This only happens when polling. But if we poll only once a day, we have to wait a long time to see, that the mower has an error. So I think it's better, when it's gone again. |
I understand your point on the zone sensor, I would like to keep it for a couple reasons. One, ha isn't going to include polygon zones due to limitations in android/iOS and second, this would sync our codebases, which would allow future PRs to be simpler. |
And the map is still not working anymore after I clicked on it once, and the zone is gone after that. You should also have a look for that. |
Should we make it a configurable pull rate, maybe allow a choice in seconds? With a sane min/max. |
I also thought about that, or even dynamic polling rates. But I think it's better to keep it as simple as possible for the user and just poll every 300s. |
Do you know, why a lot of files are marked as completely changed, but they aren't? e.g. |
Cool, I'll remove that logic, it will take just a bit, have to travel for work tomorrow, may not be able to get to it today. |
I don't understand that, it's clearly not a complete change but git acts like it is. |
Can you give me the exact steps to replicate this, just want to make sure I solve it, didn't happen to me when I was testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, here are the first changes I suggest. I hope I can extend the review, when I discover something else.
What I really like, are the tests. The make work easier I hope.
|
I think the files showing complete changes is a line ending issue. See https://stackoverflow.com/questions/30752959/git-showing-entire-file-is-modified-instead-of-showing-modified-small-part-of-co |
Can this file be deleted: |
No, had to add it for test discovery to work. |
@Thomas55555 Take a look at the last commit,this will raise ConfigEntryAuthFailed if data isn't returned from the api. Not certain I like this though, feel like the error should really originate from aioautomower, but this should allow the user to reauth or just reload if it happens again. |
This should address all the comments to this point, we now retain the existing mower selections and pass them to the form. |
Please leave it as it was before the PR, because we are not knowing where it's coming from. This may cause unneeded reauths, which we don't want. |
We could reload the entry? I hate to just leave the integration in a broken state. Another thought might be, that aioautomower should return the last valid data and log the error, if it is a transient issue with the api, it might be resolved the next time we poll the api. |
Maybe it was just a coincidence with the invalid credentials issue. And polling again didn't take effect. There was no new data for over 24h. |
OK, reverted, we no longer raise ConfigEntryAuthFailed if the API returns a 400 error. |
Okay, I've tested it now. |
We still need something to signal that we are done and end the flow. I think best to keep it, otherwise after we saved a zone we would need to end the flow and start the configuration flow over, could maybe rename it to something else if that helps. |
I just clicked on |
Not sure I'm following you here, are we good as is? |
I for one think the extra save zone is just confusing. The zone is already saved. If you need an entry, I suggest you name it "End configuration" and put it last. If you can do without it, even better. After moving to the latest dev version, trying to update my Mower in config gives me |
I had tried to remove it earlier and ended up where submit would repeatedly reload the window if nothing was selected, since there was no user input it thought we were loading it for the first time. Thought that was super confusing, there's probably a way to remove it, it might come to me. I changed the way we store data, in order to allow us to prefill the multiple choice lists. There was no way to do that with the select helper, had to move to cv.multiple which does support default values. The problem though is this breaks existing config for those of us testing. Coincidentally, your second question is why you are seeing this, when you set up the camera the last choice is to select additional mowers that should be shown on the same map, since we only have a single mower, the list is empty and not displayed, since we can't show the same mower twice. But since I changed the multiselect, we went from passing the data as a list of dicts to a dict. Think this is the cause of your error, your existing options dict has an empty list, it expects an empty dict. Long story short, delete the integration via the ui then reinstall it and you should be good, that way you will have your options in the correct format. I didn't bother migrating or catching it, since it applies only to those of us testing, same with the migration, if you had an earlier commit, the migration logic will fail since it expects to migrate from a pre PR config. If that doesn't fix it, please let me know and I'll dig some more. I just opened my dev box which is running the latest commit and had no issues changing the rotation several times. |
Very good. Just wanted to call it out in case it wasn't this. I thought I might revert to the previous known good when we start to get ready to migrate back in to main, and verify the migration works. |
Great, appreciate all the support in testing. When you write something, you know how it's supposed to work and will think that it's pretty solid until you get other to use it, always amazed at how many things you find that were missed when other people try to use it. Better to discover issue here then when it's an issue in production and I'm getting pinged on a support incident. Also, side note, I'm very envious of your drone imagery, that looks amazing. Unfortunately, can't justify a drone to make my home assistant look better.... |
c60747f addresses comments on the zone menu, still don't have a way to get rid of the option, but this does make it clear that it's a closing step, enables translations for those two options, and ensures that the default option is to finish and close. |
Can I merge it? |
I'm good with merging, since @Din-BH has been instrumental in helping to test it, let's give him a shot to test the latest changes and if he's good merge it. Hopefully we can get some help with the missing translations, we added a bunch of keys that will need to be translated once we merge. |
Works like a charm. ;) I say go! Great work! |
Coverage Report
Two Mower Map, With Rotation
Single Mower Map, With Rotation