Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Growatt Thor 11A/S: Session Energy and Active Import Register sensors are always 0 #1466

Open
altserg opened this issue Jan 4, 2025 · 1 comment

Comments

@altserg
Copy link

altserg commented Jan 4, 2025

I'm using Growatt Thos 11 A/S charger with firmware THOR_11AS-V5.2.4-20230307-NOVO. HASS Version: 2024.12.5,
OCPP version: 0.7.0

Describe the bug
Session energy and Active Import Register sensors are always 0. The charger returns correct data in Energy.Active.Import.Register, StopTransaction and in DataTransfer messages. See the log below

To Reproduce
Steps to reproduce the behavior:

  1. Start charging session. Watch sensors do not update
  2. Stop charging session. Watch sensors = 0

Expected behavior
Session Energy and Active Import Register sensors display correct value

Additional context
Looking at the log and code in chargepoing.process_measurands(),
{"value":"0","context":"Transaction.Begin","format":"Raw","measurand":"Energy.Active.Import.Register","unit":"Wh" entry
probably overrides the previous entry
{"value":"4369","context":"Sample.Periodic","format":"Raw","measurand":"Energy.Active.Import.Register","unit":"Wh"},
Question is:

  1. Should the context other than Sample.Periodic be ignored in this function?
  2. Or should the Charger be configured as OCPP 2.0.1 ?

Logs
`
7607,"meterValue":[{"timestamp":"2025-01-03T19:01:48+01:00","sampledValue":[{"value":"4369","context":"Sample.Periodic","format":"Raw","measurand":"Energy.Active.Import.Register","unit":"Wh"},{"value":"0","context":"Transaction.Begin","format":"Raw","measurand":"Energy.Active.Import.Register","unit":"Wh"},{"value":"2.4","context":"Sample.Periodic","format":"Raw","measurand":"Current.Import","phase":"L1","unit":"A"},{"value":"0.0","context":"Sample.Periodic","format":"Raw","measurand":"Current.Import","phase":"L2","unit":"A"},{"value":"0.0","context":"Sample.Periodic","format":"Raw","measurand":"Current.Import","phase":"L3","unit":"A"},{"value":"236.1","context":"Sample.Periodic","format":"Raw","measurand":"Voltage","phase":"L1","unit":"V"},{"value":"236.5","context":"Sample.Periodic","format":"Raw","measurand":"Voltage","phase":"L2","unit":"V"},{"value":"237.3","context":"Sample.Periodic","format":"Raw","measurand":"Voltage","phase":"L3","unit":"V"},{"value":"386","context":"Sample.Periodic","format":"Raw","measurand":"Power.Active.Import","phase":"L1","unit":"W"},{"value":"0","context":"Sample.Periodic","format":"Raw","measurand":"Power.Active.Import","phase":"L2","unit":"W"},{"value":"0","context":"Sample.Periodic","format":"Raw","measurand":"Power.Active.Import","phase":"L3","unit":"W"},{"value":"33.0","context":"Sample.Periodic","format":"Raw","measurand":"Temperature","unit":"Celsius"}]}]}]
2025-01-03 19:01:48.393 INFO (MainThread) [ocpp] CHM00003232208F3: send [3,"2304",{}]
2025-01-03 19:01:53.822 INFO (MainThread) [ocpp] CHM00003232208F3: receive message [2,"2305","StatusNotification",{"connectorId":1,"errorCode":"EVCommunicationError","info":"ChargeWait","status":"SuspendedEV"}]
2025-01-03 19:01:53.839 INFO (MainThread) [ocpp] CHM00003232208F3: send [3,"2305",{}]
2025-01-03 19:04:53.812 INFO (MainThread) [ocpp] CHM00003232208F3: receive message [2,"2309","StatusNotification",{"connectorId":1,"errorCode":"NoError","info":"","status":"Finishing"}]
2025-01-03 19:04:53.830 INFO (MainThread) [ocpp] CHM00003232208F3: send [3,"2309",{}]
2025-01-03 19:04:56.894 INFO (MainThread) [ocpp] CHM00003232208F3: receive message [2,"2310","StopTransaction",{"idTag":"96DA565A","meterStop":4369,"timestamp":"2025-01-03T19:04:56+01:00","transactionId":1735917607,"reason":"Other","transactionData":[{"timestamp":"2025-01-03T19:04:56+01:00","sampledValue":[{"value":"4369","context":"Transaction.End","format":"Raw","measurand":"Energy.Active.Import.Register","unit":"Wh"}]}]}]
2025-01-03 19:04:56.935 INFO (MainThread) [ocpp] CHM00003232208F3: send [3,"2310",{"idTagInfo":{"status":"Accepted"}}]
2025-01-03 19:04:57.179 INFO (MainThread) [ocpp] CHM00003232208F3: receive message [2,"2311","StatusNotification",{"connectorId":1,"errorCode":"NoError","info":"","status":"Preparing"}]
2025-01-03 19:04:57.195 INFO (MainThread) [ocpp] CHM00003232208F3: send [3,"2311",{}]
2025-01-03 19:04:57.398 INFO (MainThread) [ocpp] CHM00003232208F3: receive message [2,"2312","DataTransfer",{"vendorId":"Growatt","messageId":"currentrecord","data":"id=27&connectorId=1&chargemode=1&plugtime=2025-01-03 16:19:44&unplugtime=2025-01-03 19:04:56&starttime=2025-01-03 16:20:07&endtime=2025-01-03 19:04:56&costenergy=4369&costmoney=48&transactionId=1735917607&workmode=7"}]
2025-01-03 19:04:57.426 INFO (MainThread) [ocpp] CHM00003232208F3: send [3,"2312",{"status":"Accepted"}]

`

@altserg altserg changed the title Growatt Thor 11A/S: Session energy always 0 Growatt Thor 11A/S: Session Energy and Active Import Register sensors are always 0 Jan 4, 2025
@altserg
Copy link
Author

altserg commented Jan 5, 2025

Proposed solution for Option 1. Add following code around lines ~775 in chargeppoint.py process_measurands() function and import ReadingContext from ocpp library

774 # Only set the meter start value from Transaction begin context
775 if (
776 is_transaction
777 and context == ReadingContext.transaction_begin.value
778 ):
779 self._metrics[csess.meter_start].value = value
780 self._metrics[csess.meter_start].unit == unit
781 continue
782 # End

altserg added a commit to altserg/ocpp that referenced this issue Jan 9, 2025
altserg added a commit to altserg/ocpp that referenced this issue Jan 9, 2025
@coderabbitai coderabbitai bot mentioned this issue Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant