chrisz / pyhusmow

Control your Husqvarna automower
GNU General Public License v3.0
59 stars 29 forks source link

Awesome Reference #20

Closed simlu closed 6 years ago

simlu commented 6 years ago

Started by extracting and hard-coding the token, but unfortunately that seems to expire eventually. So great to have this project as a reference!

Just wanted to say thanks for reverse engineering this! We use it as a basis to generate a heatmap and mower states over time (using aws).

chrisz commented 6 years ago

Thanks for your comment :-).

icepicknz commented 6 years ago

how are you generating the heat map, would love to do the same

simlu commented 6 years ago

@icepicknz We use aws lambda and invoke it every minute as a cronjob using cloudwatch rules. Then we write the current status to s3, interpolating times against the previous status. We then aggregate files by day. We do this once every day but one could do this more frequently if so desired. Finally we have an api that fetches the correct files, merges and serves their content for a given start and end timestamp. And that api then gets visualized using Google map and time line sdk. Not a trivial setup, but at least operation cost is only around $0.20 USD / month and so far it has been very reliable.

icepicknz commented 6 years ago

You did this all for private consumption or as a service to your customers?

simlu commented 6 years ago

It was a fun weekend project using tools that are readily available. Currently it's for private consumption only, but I have considered making it an invite only website (bc not sure how husquana would feel about commercializing it)

icepicknz commented 6 years ago

How are you visualising the plot from and to? I see http://simpleheatmap.com can easily do what i want but it plots the lat/long as a destination, not as a path showing where its been

simlu commented 6 years ago

You need to interpolate. The mower only updates every thirty seconds. If that isn't enough for your purpose you need to fill in points. However I found that depending on what you want to achieve just using the points is enough.

I found most value over extended time (a week or so) to see where the mower has and where it hasn't been (so you can fine tune). You don't need paths for that.

Also very helpful was status change visualized over time: for example was the mower only mowing for five minutes for given settings due to cycle length. Or did the mower not mow because of faulty charging connection etc

simlu commented 6 years ago

We use https://developers.google.com/maps/documentation/javascript/examples/layer-heat map btw

icepicknz commented 6 years ago

Thanks will take a look.

When you say fine tune, what is there to fine tune?

simlu commented 6 years ago

@icepicknz I mean with the mower itself. So far we got these as uses directly from the visualization:

icepicknz commented 6 years ago

Ah got ya; Well i threw something together last night and finished it this morning; though the last problem i have is when zoomed in the heat is not visible unless you zoom out - http://www.atiamuri.co.nz/husky-heatmap.php

simlu commented 6 years ago

Looks great! You just need more data points and the heat should start showing correctly

icepicknz commented 6 years ago

Added another map so I could see the path covered - http://www.atiamuri.co.nz/husky-path.php

fafoulon commented 6 years ago

Hi, That's really awesome what you are doing. Do you think you could share the source code of your php scripts?

jonasdig commented 6 years ago

I try to do something similar. The lastlocation variable includes several locations. Do anyone now the time between thees points? And is the first location the last measured position?

simlu commented 6 years ago

@jonasdig Depends on the mode (15 min or more in idle and 30 seconds while mowing). Might also depend on mower? Yes, fist should be last recorded.

Best way is to not visualize the api response, but instead collect it and visualize the collection (and store timestamps and newest point only).

jonasdig commented 6 years ago

I looked more into my data now. I have a 430x AutoMower and I only get gps location every minute. The battery status seem to update every 30s.

simlu commented 6 years ago

Interesting! There must be a difference between the models then!

Adesin-fr commented 6 years ago

Hi @icepicknz Your heatmap is awesome ! I'd like to use it for my mower, as my lawn is complex and I'd like to see how to optimize the robot...

Can you share your code ?