zaptec icon indicating copy to clipboard operation
zaptec copied to clipboard

Missing all phase voltage and current from event notifications

Open sveinse opened this issue 4 months ago • 6 comments

Question for Zaptec

I've noticed a pattern in my logs which is strange. I'm receiving two CurrentPhase updates by the service bus events, but the last doesn't update until we poll for it much later. I'd expect the three phase measurements to be more or less atomic, so its unexpected that the service bus doesn't deliver the last measurements by events.

This also happens to the VoltagePhase* values.

Why is this happening?

14:56:42.008 @@@  EVENT {'ChargerId': '<--Charger[f40861]-->', 'StateId': '710 (ChargerOperationMode)', 'Timestamp': '2025-08-17T14:56:41.541463Z', 'ValueAsString': '3'}
14:56:42.008 >>>  Updating Charger[f40861].charger_operation_mode (ChargerOperationMode)  =  <str> 'Connected_Charging'  (was 'Connected_Finished')
14:57:19.114 @@@  EVENT {'ChargerId': '<--Charger[f40861]-->', 'StateId': '507 (CurrentPhase1)', 'Timestamp': '2025-08-17T14:57:18.613495Z', 'ValueAsString': '9.509'}
14:57:19.114 >>>  Updating Charger[f40861].current_phase1 (CurrentPhase1)  =  <float> 9.509  (was 0.045)
14:57:19.141 @@@  EVENT {'ChargerId': '<--Charger[f40861]-->', 'StateId': '509 (CurrentPhase3)', 'Timestamp': '2025-08-17T14:57:18.615199Z', 'ValueAsString': '9.484'}
14:57:19.141 >>>  Updating Charger[f40861].current_phase3 (CurrentPhase3)  =  <float> 9.484  (was 0.031)
14:57:42.058 @@@  REQUEST GET to 'https://api.zaptec.com/api/chargers/<--Charger[f40861]-->/state'
14:57:42.193 >>>  Updating Charger[f40861].current_phase2 (CurrentPhase2)  =  <float> 9.367  (was 0.024)

sveinse avatar Aug 18 '25 11:08 sveinse

You're right, they are reported all together, and I can confirm that was the case here as well. Also, all of them are part of reporting to service bus (it is highly recommended to avoid using it, since it is deprecated). Same for VoltagePhase1/2/3. @sveinse Are you always missing CurrentPhase2, or it depends?

Image

ivastokic avatar Aug 18 '25 12:08 ivastokic

@ivastokic It varies which of the three phases that are not reported like this.

BTW! With regards to the deprecation of the service bus, I raised a question to Zaptec here: https://github.com/custom-components/zaptec/issues/125#issuecomment-3196829674

sveinse avatar Aug 18 '25 13:08 sveinse

@ivastokic It varies which of the three phases that are not reported like this.

This is really strange, we have much bigger integrators working with serviceBus, I don't remember we had similar case reported. Could it be that they are somehow skipped on your side on processing, since they are reported at almost same time?

ivastokic avatar Aug 18 '25 13:08 ivastokic

@ivastokic The logs in our side are logging the raw input delivered from Zaptec, so I'm confident that the logs are complete.

But, since I only have my personal Zaptec charger to test on, I run both my development setup and the production system at the same time. When that happens there will be two clients connected to the service bus. Could there be an issue around that?

sveinse avatar Aug 18 '25 13:08 sveinse

Could there be an issue around that?

Yes, message can be consumed/processed only once, so I guess your other consumer has info in logs of CurrentPhase2? In order to have same messages for 2 consumers, you need 2 subscriptions

ivastokic avatar Aug 18 '25 14:08 ivastokic

OK, that might explain it. Let me test that by disabling the production system next time I run the development setup. I'll make observations to see if everything is as it should be. I'll come back once I have more info. Thanks.

sveinse avatar Aug 18 '25 14:08 sveinse