ElectricMotorcycleForum.com

  • November 25, 2024, 03:57:46 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Electric Motorcycle Forum is live!

Pages: 1 ... 4 5 [6] 7 8

Author Topic: SR/F App (NextGen) - API  (Read 10821 times)

i550

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #75 on: April 07, 2020, 10:38:52 PM »

Thanks Remmie! 

I've enjoyed the iOS app as well. 

My plan for this project is to run it off a raspberry pi in my home office on a wall mounted display as a dashboard for my bike.  Maybe also package it in an electron app, like slack, so it can run on my laptop and desktop.

I may work on adding gpx stored paths in a local db. to store rides in the future as well.

As for the unused data in the json file, I did ignore the things that seemed like template fields from cars or trucks, such as door, hood, water and oil_pressure.  Do you know if field such as siren, driver, shock, ignition, volume, lock, int_lights, perimeter are useful from the file?

Comments inline below:

Nice work i550 !

As for the yellow items.
* Unit type is 5 with me as well, dont know what it means though, it could be related to the bike (SR/F) or to the GPS/GSM unit or maybe even to the use of KM or Miles. Mine is in km and the milage figure is correct for km which would imply that unit type is not for km/miles

[i550]  Agree, everything seems to be in metric, which makes conversion math easy.  I assumed that unit type had to do with the gps unit setting or model.  Leaves the question, is the unit being referenced the GPS receiver or the bike itself?

* Unit model is 6 with me as well, if it would relate to the bike : mine's a SR/F

[i550]  Mine is 6 and a SR/F as well.  Makes me wonder if 0-5 are the previous models, such as the fx.

* Response is also 0 with mine. no idea what it means
* Reason is also 2 with mine. no idea
* Logic state is 2 with mine instead of 1 in yours. Mine is keyed off?
[i550] Hmmm, weird, wouldn't 0 be off?  Could it be a error status or logic board status?

* Analog has been 0.09 with mine always. It think it is an unused analog input. It is named analog1 instead of analog
[i550]  These are the fields (response, reason, logic) I assumed would be the hardest to make sense of without proper api documentation, such a shame, I assume this would be good information for owners to have to be proactive on bike maintenance.

* Color is 6 with mine instead of 5 in yours. I have a boardwalk red SR/F
[i550]  That is odd about the color, I have a red SR/F as well, and my color field is 5, can other collaborate that discrepancy as well?


There are also a couple of items in the JSON response that are not visible in your webpage (maybe on purpose?)
* driver, 0 in my case
[i550]  Same for me, I was really curious what this field could possibly mean.

* gps_valid, 0 in my case (sitting in the garage with a reinforced concrete ceiling
* shock, 0 in my case (which is a good thing :) )

* ignition, 0 in my case keyed off in the garage
[i550]  Have you seen this go to 1?

* door, 0 in my case (figures, because it has no doors, LOL. Or is does the storage compartment have a door, or is that a lid, ;) )
[i550]  lol, I laughed when I saw this field and others like it, as well.  I shrugged it off as the zero guys working off some template that they were forced into by the gps manufacturer.

* hood, 0 in my case
* volume, 0 in my case
* water_temp, "" in my case which makes sense
* oil_pressure, 0 in my case which also makes sense
[i550]  All the same for me.

* siren, 0 in my case (it has none)
[i550]  I was wondering if the SR/F alarm would trigger this one.

* lock, 0 in my case
* int_lights, 0 in my case
* datetime_utc, 20200405201257
* datetime_actual, 20200407061530
* perimeter, "" in my case
* tipover, 0 in my case (which is good !)
[i550]  Very good. :)

Of those last batch I think only gps_valid, ignition, shock and tipover would be helpfull for your page, maybe make a fourth page with the all the unknown/unused values, just for info if someone sees a use for it.
[i550]  Hmmm, good point, I'll add them, I wanted to build in more conditional logic to convert the data into layman's terms for as much as possible.  Seems I'll have to guess for the rest.


Other than that : Great work
[i550]  Thanks!  Love the iOS app too.

As far as accessing the data that Nextgen App has like riding modes etc, that information is only available via bluetooth, not through the web.
[i550]  That does suck, so much of this data and cloud experience could be improved and become interactive for owners with not only the bike but zero motorcycles themselves. If they updated their approach they could start the process of building a vendor/owner community that rivals Harley. 

That being said, please don't get me wrong, I love the bike and what abilities this provides. Huge leap forward in tech and tinkering.  :)



Thanks for the help.


« Last Edit: April 07, 2020, 10:56:22 PM by i550 »
Logged
First and current Zero: Red Premium SR/F

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #76 on: April 09, 2020, 12:51:50 PM »

Nice looking dashboard @i550

I also have the red one as Remmie does and I get color 2 :o . My output looks like this (mostly, altered some values like position, unit and VIN).

Edit: The mileage on mine is always around 200-400km behind of the actual value. And often it takes a while for this response to pick up the charging state. I've seen logic state and reason change over multiple requests but never bothered thinking it through. Don't think I ever saw another value for analog1.

Some values are obviously just not present, like door and hood.

It would be interesting to see the result of someone with an SR/S just to know if that changes anything.

Code: [Select]
{
  "unitnumber": "123456",
  "name": "538ZFAZ74LCK00000",
  "unittype": "5",
  "unitmodel": "6",
  "mileage": "4875.26",
  "software_version": "190430",
  "logic_state": "2",
  "reason": "2",
  "response": "0",
  "driver": "0",
  "longitude": "2.349014",
  "latitude": "48.864716",
  "altitude": "52",
  "gps_valid": "0",
  "gps_connected": "0",
  "satellites": "0",
  "velocity": "0",
  "heading": "168",
  "emergency": "0",
  "shock": "",
  "ignition": "0",
  "door": "0",
  "hood": "0",
  "volume": "0",
  "water_temp": "",
  "oil_pressure": "0",
  "main_voltage": 13.18,
  "analog1": "0.09",
  "siren": "0",
  "lock": "0",
  "int_lights": "0",
  "datetime_utc": "20191116090806",
  "datetime_actual": "20191116210319",
  "address": "Paris",
  "perimeter": "",
  "color": 2,
  "soc": 64,
  "tipover": 0,
  "charging": 1,
  "chargecomplete": 0,
  "pluggedin": 1,
  "chargingtimeleft": 120
}

« Last Edit: April 09, 2020, 12:56:12 PM by Hans2183 »
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

i550

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #77 on: April 09, 2020, 09:45:56 PM »

Thanks Hans2183

Oddly, I just noticed that the color field on mine changed today and now says 2 as well.  Seems they may be updating the api.

It would be good to see what an SRS looks like, as well as a blue SRF.

The mileage in the json file is also behind the real odometer on my bike too, by about 50ish miles or so.
Logged
First and current Zero: Red Premium SR/F

i550

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #78 on: April 30, 2020, 11:28:13 PM »

I'm still looking for details on the other fields.  Or others with different colors and hopefully some SR/S's too.

Here's the most recent dashboard I have, I drew half the icons and the bike, but also used font awesome for other icons.  I kept everything a SVG to make sure scaling of screen size wouldn't impact the clarity of the images and cause them to get grainy.

I also tried to make the GPS Information more visual by including a circular satellite and heading imagery.  The arrow points the actual heading angle and the satellites in the circle will update to match the number connected from the json file.

I was hoping to find a way to get the ride data (power and lean) from the app as well. 

So was wondering since they oddly won't share the raw data in the app, if it can at least be seen over the Bluetooth connection as well?  Have anyone been able to see a trace from the Bluetooth connection?
« Last Edit: April 30, 2020, 11:30:33 PM by i550 »
Logged
First and current Zero: Red Premium SR/F

BrianTRice@gmail.com

  • Unofficial Zero Manual Editor
  • Hero Member
  • *****
  • Posts: 4014
  • Nerdy Adventurer
    • View Profile
    • Personal site
Re: SR/F App (NextGen) - API
« Reply #79 on: May 01, 2020, 12:39:30 AM »

I wish I had a bike to test this with, but what I've heard from an SR/S owner is that the app doesn't work for them. I think there's an authentication issue still present that makes this less useful than it might be.
Logged
Current: 2020 DSR, 2012 Suzuki V-Strom
Former: 2016 DSR, 2013 DS

gadgetgirl

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #80 on: May 01, 2020, 10:49:44 PM »

Thanks Hans2183

Oddly, I just noticed that the color field on mine changed today and now says 2 as well.  Seems they may be updating the api.

It would be good to see what an SRS looks like, as well as a blue SRF.

The mileage in the json file is also behind the real odometer on my bike too, by about 50ish miles or so.

I have a blue SR/F, and I get 2 for the color too.
Logged
Current: 2020 SR/F Premium Seabright Blue (J1772)
Former: 2011 VRSCDX Sedona Orange

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #81 on: May 05, 2020, 02:09:55 AM »

they probably didn't bother implementing the colors then, just like many of the other params.
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

mcvl

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #82 on: June 05, 2020, 02:53:15 AM »

HI,good job,i give you report from SR/S blue in europe for your projet:
[{"unitnumber":"xxxxxxx",
"name":"538ZFxxxxxxxxxxxx",
"unittype":"5",
"unitmodel":"6",
"analog1":"0.09",
"mileage":"10.24",
"software_version":"190905",
"logic_state":"1",
"reason":"5",
"response":"0",
"driver":"0",
"longitude":"2.0335",
"latitude":"42.7859",
"altitude":"83",
"gps_valid":"1",
"gps_connected":"1",
"satellites":"6",
"velocity":"0",
"heading":"36",
"emergency":"0",
"shock":"",
"ignition":"0",
"door":"0",
"hood":"0",
"volume":"0",
"water_temp":"",
"oil_pressure":"0",
"main_voltage":13.18,
"siren":"0",
"lock":"0",
"int_lights":"0",
"datetime_utc":"20200604152748",
"datetime_actual":"20200604152745",
"address":"Le Barcarès,
 Rue xxxxxx",
"perimeter":"",
"color":2,
"soc":75,
"tipover":0,
"charging":0,
"chargecomplete":0,
"pluggedin":0,
"chargingtimeleft":0}]
« Last Edit: June 05, 2020, 02:59:12 AM by mcvl »
Logged
before 17 ICE bikes
DS2014
DRS2016
SRS 2020
DSR/X 2023

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #83 on: June 08, 2020, 11:55:25 AM »

Congrats on the SR/S and thanks for reporting your output. Seems like you have the same color and even same model numbers. So that would indicate they didn't implement that part.

The only way to extract that information would be from the Serial number then. What are the next 2 digits in yours? For SRF we have the below sequence:

538 = Zero
Z = Z4 - FST platform
FA = 20 MY SR/F
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

oli

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #84 on: June 09, 2020, 03:54:06 AM »

Thank You for this Work. Now i can integrate my Zero in Home Assistant  8)
Logged

markearth

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #85 on: June 21, 2020, 01:21:10 AM »

Now i can integrate my Zero in Home Assistant  8)
Hi. Can you post your Home Assistant sensor config? I've tried to get this going with the following, but not working yet:

- platform: rest
    name: Zero
    resource: https://mongol.brono.com/mongol/api.php\?commandname\=get_last_transmit
    device_class: battery
    scan_interval: 60
    timeout: 30
    authentication: digest
    username: !secret zero_username
    password: !secret zero_password
    headers:
      User-Agent: Home Assistant
      Content-Type: application/json
      Accept: application/json
      unitnumber: !secret zero_unitnumber
    unit_of_measurement: %
    value_template: >-
      {% if value_json.zero[0].soc is defined %}
        {{ value_json.zero[0].soc }}
      {% else %}
        0
      {% endif %}
    json_attributes_path: '$.zero[0]'
    json_attributes:
      - address           
      - altitude           
      - analog1           
      - chargecomplete
      - charging           
      - chargingtimeleft
      - color               
      - datetime_actual
      - datetime_utc   
      - door               
      - driver             
      - emergency       
      - gps_connected 
      - gps_valid         
      - heading           
      - hood               
      - ignition           
      - int_lights         
      - latitude           
      - lock               
      - logic_state     
      - longitude       
      - main_voltage 
      - mileage         
      - name             
      - oil_pressure   
      - perimeter       
      - pluggedin       
      - reason           
      - response       
      - satellites       
      - shock           
      - siren             
      - soc               
      - software_version
      - tipover       
      - unitmodel   
      - unitnumber 
      - unittype       
      - velocity       
      - volume         
      - water_temp 
Logged

mcvl

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #86 on: June 26, 2020, 05:54:32 PM »

with some delay last Vin number for SR/S blue 2020 :538ZFBZ71
Logged
before 17 ICE bikes
DS2014
DRS2016
SRS 2020
DSR/X 2023

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #87 on: June 26, 2020, 06:02:30 PM »

with some delay last Vin number for SR/S blue 2020 :538ZFBZ71

Thanks for posting this information. So breakdown would be:

538 = zero
Z = Z4 - FST platform
FB = 20 MY SR/S
Z7 = 40 kW
1 = check digit

while my SR/F starts with 538ZFAZ74

538 = zero
Z = Z4 - FST platform
FA = 20 MY SR/F
Z7 = 40 kW
4 = check digit
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---

remmie

  • Sr. Member
  • ****
  • Posts: 318
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #88 on: July 03, 2020, 04:28:31 PM »

Hi Hans,

I don't know if you still have some time to develop your awesome ZeroNG app but I would have 2 (fairly simple?)  feature requests.

1) In the location tab when you have selected a date (or multiple dates) an indication of the total amount of km (or miles), based on the data points provided by the API. I know this is not the real actual driven distance as the points are a few minutes apart and are straight lines rather than following the road but still would be nice :)

2) place a distinctive dot (maybe red?) at the start and end of each day. So if you have a multiday trip you can clearly see each daytrip.

an example of both on the 2 attached pictures. first is your current app on the iPad, second is an example of how it could look with the 2 features included.  The trip is a 12 day trip through Europe featuring 12 days and almost 3900 km. and that leads to a third feature request :)

3) selecting multiple days to download from the server by setting a start date and end date and a download button. I know it can only be downloaded per day so it may require a timer which downloads a day per 1 or 2 seconds to not overload the server. Maybe also keeping the start and end date inside a single month could help to prevent server overload.
Logged
Current : Red Premium Zero SR/F (ordered May 25, delivered August 23 2019) with Rapid charger for 12kW charging
Former : White Zero SR 2018 ZF14.4 kWh (17.500 km)
Former : Black Zero SR 2014 ZF11.4 kWh (25.000 km)
SR's outfitted with Homemade "Supercharger" 6x eltek Flatpack S (12 kW)

Hans2183

  • Sr. Member
  • ****
  • Posts: 468
    • View Profile
Re: SR/F App (NextGen) - API
« Reply #89 on: July 03, 2020, 06:36:45 PM »

Sure we can add some features. Always happy to get input.

1) Seems easy enough, just need to figure out how to display that information

2) That I would like myself since when you select multiple dates you quickly get lost in all the plotted tracks. The dots are a good start in case you're going round, never crossing the same point again. An alternative is to color each day/route in a slightly different (generated) color. Or well I could just combine the 2. I'll play with it and report back.

3) Download to a gpx format then? I"ll have to look into that but should indeed be possible.
Logged
2021 Energica SS9+ 21.5kWh
--- Belgium ---
Pages: 1 ... 4 5 [6] 7 8