EVerest / everest-core

Apache License 2.0
92 stars 68 forks source link

EvseManager: Wait for initial meter value #765

Closed Pietfried closed 1 month ago

Pietfried commented 2 months ago

Describe your changes

If EVerest starts up with an EV plugged in (and authorization is present immediately), there is a race condition between the TransactionStarted event and the first powermeter value received. Without this change, transactions may start and use an initial meter value of 0.

This PR adds handling to wait for an initial powermeter value before the EvseManager becomes operational (is ready to start charging). The waiting time is configurable ( initial_meter_value_timeout_ms ) or can be disabled (by configuring 0)

Issue ticket number and link

Checklist before requesting a review

lategoodbye commented 2 months ago

@Pietfried Is there a possible relation to this issue?

Pietfried commented 2 months ago

@Pietfried Is there a possible relation to this issue?

Good catch, looks like it. If the powermeter is not updated, the timestamp string defaults to ""