serkri / SmartEVSE-3

Smart Electric Vehicle Charging Station (EVSE)
MIT License
68 stars 28 forks source link

fix: Potential workaround for modem operation w/normal access off #174

Closed arpiecodes closed 1 year ago

arpiecodes commented 1 year ago

In my case, CP_OFF inside the setAccess method wasn't required to maintain state sanity with the PEV. The combination of states within the code of this pull seems to work well, also with the 'autocharge' feature that continually loops through multiple Modem Setup phases.

It also fires the disconnect event after the cable has being disconnected for 3 seconds instead of 60, so the session is cleared (and access is revoked again) fast. If you cycle through the modes after successful 'authentication' (and set the mode to OFF), it is also possible to resume the session without needing another Modem Request cycle as long as the cable remains connected to the vehicle. So that's pretty neat.

Anyway, YMMV with these changes. I will be using this fix for my daily driver the next few days.

Also had to increase the JSON doc size, as it was not enough for all of the data with Modem enabled resulting in weird javascript console errors of missing properties.