CurtRod / SimpleEVSE-WiFi

Brings EVSE WB/DIN into your WiFi
https://www.evse-wifi.de
78 stars 33 forks source link

Charge duration not reset #39

Closed rtfmjoey closed 4 years ago

rtfmjoey commented 4 years ago

I'm testing to let Domoticz switch off the EVSE via the API when power usage thresholds exceeds and noticed that the charge duration is logged wrongly sometimes.

The duration in EVSE always starts at 00:00 and stops counting when EVSE is deactivated but the logged duration looks like some counter is not reset sometimes after EVSE is deactivated: charge_duration

Anyone else seen this (is this a bug)? I'm using version 0.3.0 but also experienced this sometimes with 0.2.8

rtfmjoey commented 4 years ago

Hm, strange things are happening...

I noticed that the NodeMCU sometimes reboots when deactivating the EVSE, after that the charge duration is displaying the weird values.

Also, when charging shortly everything is logged correct but if charging is running for a longer time the charged energy is not logged (just displays the circle arrow).

When connecting a serial terminal I see all kind of exception when the NodeMCU reboots. (2 and 3 mostly). I swapped the NodeMCU (original Amica 1.0) already but it shows the same issue.

At this point I'm beginning to suspect the power supply. Although it's specced at 5V 1A (hilink) I think that it's not enough or dips at certain times (i.e. when writing to spiffs and transmitting packets over wifi). Because it's enclosed it's running a bit warm (not hot!). I'll source a power supply which can supply more power, swap it out and see what happens.

rtfmjoey commented 4 years ago

I swapped the power supply last night for a 2.5A model and the NodeMCU seems stable (no crashes, restarts or poorly connecting to WiFi anymore). To be sure I added decoupling capacitors directly to the VIN/GND and 3V3/GND pins.

However, the issue with the charging time remained with version 0.3.0. It seems that there is an issue with getChargingTime() or updateLog (getting skipped or millisStartCharging = 0; is not executed properly).

I've reverted to 0.2.8, which I recompiled as discussed in https://github.com/CurtRod/SimpleEVSE-WiFi/issues/28#issuecomment-557041613 and everything seems to be working correctly now. The charge duration is logged correctly everytime (tested via a mix of API, GUI and button requests with variation from 5 seconds to 2 hours).

I'll continue to test to see if things remain stable but it may be that some bug is introduced on 0.3.0

rtfmjoey commented 4 years ago

After some days of testing I found that the issue was completely resolved with the new power supply. Even with 0.3.0 the durations are logged normally.

I did find a bug in the charge duration when 'always active' mode is used. The millisStopCharging = millis(); is only executed when not in always active mode. I'll close this issue and will open a new one for the bug.