gboudreau / LEAF_Carwings_EasyAccess

One-click access to LEAF Carwings remote actions
16 stars 9 forks source link

'Status Update' displays previous information #2

Closed ianshepherd closed 7 years ago

ianshepherd commented 7 years ago

I've noticed a change in behaviour in the last week or two, which presumably means something's changed at Nissan's end. When I request a status update and wait, the LEAF status dialog eventually appears, but with old data. If I then click 'Last Known Status', I see up-to-date data - so the status update is obviously working in so far as updating the Nissan servers, but the new info is not getting back to my php site in the same routine.

gboudreau commented 7 years ago

When you press Status, the Last Update date & time you see at the bottom is old? I just tried, and when I do, I see the current time in the Last Updated.

ianshepherd commented 7 years ago

Sorry for the delay in the replying. Yes, that's exactly what I mean.

For example, I'm using your One-click LEAF Controls. It's currently 8:40am on 12 July. I've just pressed Status Update and waited. The "LEAF status" dialog pops up, and says I've got 20% SOC and was last updated 2017-07-11 13:10. I close the dialog and click "Last Known Status" and wait. The "LEAF Status" dialog pops up again and says I have 81% SOC, last updated 2017-07-12 08:40.

I did tweak the code a bit when I first installed it to slightly customise the display of the SOC, but nothing that should cause this, and it worked for a long time before this issue appeared about 6 weeeks ago.

gboudreau commented 7 years ago

Can't reproduce. Status Update always shows me up to date information (i.e. last updated is always now). Maybe try to see if you would be missing changes to NissanConnect.class.php I made after you installed. I might have fixed an issue, and since you are not running the latest version, you have this bug and I don't.

jeremyakers commented 7 years ago

I can reproduce it on other Nissan Apps, as well as with my scripts making direct API access. It's a change in the behavior of the API itself.

When BatteryStatusCheckResultRequest.php finally returns a "resultFlag" of 1 to indicate that the battery response is good, if you make an immediate call to "BatteryStatusRecordsRequest.php" to get the newly updated info, you will sometimes find that the information returned is still old. Since I wrote my own scripts to call these APIs, the way I worked around this is basically using this pseudocode:

DO CALL BatteryStatusCheckResultRequest.php Retrieve ResultFlag Retrieve UpdatedTime1 LOOP UNTIL ResultFlag = 1

DO PAUSE 5 seconds CALL BatteryStatusRecordsRequest.php Retrieve UpdatedTime2 LOOP UNTIL UpdatedTime1 is within 120 seconds of UpdatedTime2

Basically, after the battery status check completes, it can take up to 30 seconds for BatteryStatusRecordsRequest.php to be updated with the new battery info. Sometimes it's immediate, sometimes it's not, which makes this "bug" somewhat difficult to reproduce. It may also differ depending on what API endpoint you're hitting. I'm using https://gdcportalgw.its-mo.com/gworchest_160803A/gdc/ in my scripts.

Hope this helps, -Jeremy Akers

On Wed, Jul 12, 2017 at 1:01 PM, Guillaume Boudreau < notifications@github.com> wrote:

Can't reproduce. Status Update always shows me up to date information (i.e. last updated is always now). Maybe try to see if you would be missing changes to NissanConnect.class.php I made after you installed. I might have fixed an issue, and since you are not running the latest version, you have this bug and I don't.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gboudreau/LEAF_Carwings_EasyAccess/issues/2#issuecomment-314849233, or mute the thread https://github.com/notifications/unsubscribe-auth/ANDiTgqADF5Tngg6J92byaW83IKNApaWks5sNQoNgaJpZM4N6Gm3 .

gboudreau commented 7 years ago

Thanks @jeremyakers for the details. I updated my code to do something similar. @ianshepherd update to the latest version to get the fix.

ianshepherd commented 7 years ago

Awesome. Thanks, both of you 👍🏼