obviously you would have to alter :
yourusername to the username you have entered in the NextGen app
yourpass to the password you ised in the nextgen app
you can change the format=json to format is CSV for CSV response, or to format=XML for XML respone, or to format=HTTP for also comma seperated values. And possibly there are more formats you can use.
I am not able to copy paste this into configuration.yaml it says duplicate keys errors. Is there a way you can share it in proper code form and indention. Or is it because it’s and old way of doing this and it needs to be re-written. Just stumbled on this would be cool to have this data in HA.
Thanks in advance.
Thanks man, for taking time to change the layout, much appreciated. Look forward to test this later.
Perhaps I should look into learning how to create something for HACS so there be a nice integration for Zero stuff.
Update: Works great. I just don’t have no luck saying that’s it’s home, despite my app on my phone says I am home, so it knows!
also is this Zero’s own public API we are calling or some third party in front ?
How did you create the card ‘Wo ist Zero’ It’s cool to know as well.
Thanks again.
I’m running into an error every time I try to use the link you provided. It keeps giving me “601 Unauthorized user (…)”. I’m using the same username for my Zero NG app. Any ideas how to fix that? Thanks.
I created a package file to bundle up all of the sensors plus device tracker automation I’ve created, based on the information provided in this thread, and tossed it up on GitHub as a Gist.
The markdown file explains how to install it, and how to enable the Package function in Home Assistant if you haven’t already.
I figure this is the next best thing to an actual integration in Home Assistant, since I keep bouncing off the Python every time I try to write one. I can’t quite wrap my head around dealing with asyncio objects.
Works like a charm, thanks a lot!
I’ve combined this with the Google Sheets integration. Wtih an added entity (see below) and a couple of automations I’m now keeping track of every trip I make (address from-to, milage, etc), removing the need to do this by hand.
Thanks for sharing your implementation. I’ve made an integration for this including device_tracker. That way you can just add the git repo to hacs and then add it without having to worry about the API or sensor templates.
The only reason it’s not submitted to the default repository is because that requires me to submit branding first and I know from earlier experience that zero actively kills anything not official.
Reviving this old thread in case future nerds run into this issue like we did.
My username in the NG app is an email, would that be causing the problem?
In short; yes that is exactly what’s causing your problem. Fortunately the fix is simple, and obvious after I thought about it.
You need to utilize URL encoding for your ASCII symbols. So if your email address has an “@” then you need to replace it with “%40”. So if your login is [email protected] then you would need to use: &user=username%40example.com
I did the same thing for the symbols in my password as well. At any rate, it works!
In what context is that the conversion from miles to km? If it were, I’d expect 1.609344.
Then again, I do recognize the strange factor between the value in the api and on the motor bike. For me it’s a slightly different factor though (1.0634)
Bike on miles setting: 6455
Bike on km setting: 10388
Api mileage: 9768.45
So what is the unit for the api mileage? Reading from the ElectricMotorcycleForum they suggest it could be GPS mileage rather than actual mileage.
Hello
I think you are right… as mentionned in this git (GitHub - s28400/zmci-tool: Non official zero-motorcycle cloud interface tool) the system is based on https://www.starcomsystems.com/ … thats why mileage are not in phase as mobile app mileage or motorcylces mileage …
My motorcycle is a test motorcycle and i don’t have the same mileage between : motorcycles, mobile app and api …
did you find a solution to have real motorcycle’s values ?
Best regards
Christophe
I experimented with an alternative approach, which turns out to be more precise. It needs some technical knowledge though.
Read the get_history api for each day (is only available for the last year unfortunately)
For each (json) line and the next, pass the coordinates to the Google Distance Matrix API. This API determines the road distance between coordinates.
In a certain period I came up with these numbers:
Distance meter went up in 3893. This is the value we’d want
The Zero API gives me 3691 from the starcom device. This is an error of 5,5%
The sum from the Google Distance Matrix API gives me 3998. This is an error of 2,7%.
Even though it is much more precise, It’s still a workaround. I’ll monitor if this is a constant factor, if so I could compensate with that factor and have an even more precise estimate.