lbbrhzn / ocpp

Home Assistant integration for electric vehicle chargers that support the Open Charge Point Protocol (OCPP).
MIT License
216 stars 67 forks source link

OCPP with Huawei Wallbox #1144

Closed smoki3 closed 2 months ago

smoki3 commented 4 months ago

Version of the custom_component

Latest

LOGs

Logger: ocpp
Quelle: /usr/local/lib/python3.12/site-packages/ocpp/charge_point.py:189
Erstmals aufgetreten: 06:40:38 (17 Vorkommnisse)
Zuletzt protokolliert: 06:48:39

Error while handling request '<Call - unique_id=661eb557000000570056, action=MeterValues, payload={'connectorId': 1, 'transactionId': 1, 'meterValue': {'timestamp': '2024-04-16T17:28:55.000Z', 'sampledValue': [{'value': '0.00', 'context': 'Transaction.Begin', 'measurand': 'Energy.Active.Import.Register', 'unit': 'kWh'}]}}>'
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ocpp/messages.py", line 226, in validate_payload
    validator.validate(message.payload)
  File "/usr/local/lib/python3.12/site-packages/jsonschema/validators.py", line 438, in validate
    raise error
jsonschema.exceptions.ValidationError: {'timestamp': '2024-04-16T17:28:55.000Z', 'sampledValue': [{'value': '0.00', 'context': 'Transaction.Begin', 'measurand': 'Energy.Active.Import.Register', 'unit': 'kWh'}]} is not of type 'array'

Failed validating 'type' in schema['properties']['meterValue']:
    {'items': {'additionalProperties': False,
               'properties': {'sampledValue': {'items': {'additionalProperties': False,
                                                         'properties': {'context': {'additionalProperties': False,
                                                                                    'enum': ['Interruption.Begin',
                                                                                             'Interruption.End',
                                                                                             'Sample.Clock',
                                                                                             'Sample.Periodic',
                                                                                             'Transaction.Begin',
                                                                                             'Transaction.End',
                                                                                             'Trigger',
                                                                                             'Other'],
                                                                                    'type': 'string'},
                                                                        'format': {'additionalProperties': False,
                                                                                   'enum': ['Raw',
                                                                                            'SignedData'],
                                                                                   'type': 'string'},
                                                                        'location': {'additionalProperties': False,
                                                                                     'enum': ['Cable',
                                                                                              'EV',
                                                                                              'Inlet',
                                                                                              'Outlet',
                                                                                              'Body'],
                                                                                     'type': 'string'},
                                                                        'measurand': {'additionalProperties': False,
                                                                                      'enum': ['Energy.Active.Export.Register',
                                                                                               'Energy.Active.Import.Register',
                                                                                               'Energy.Reactive.Export.Register',
                                                                                               'Energy.Reactive.Import.Register',
                                                                                               'Energy.Active.Export.Interval',
                                                                                               'Energy.Active.Import.Interval',
                                                                                               'Energy.Reactive.Export.Interval',
                                                                                               'Energy.Reactive.Import.Interval',
                                                                                               'Power.Active.Export',
                                                                                               'Power.Active.Import',
                                                                                               'Power.Offered',
                                                                                               'Power.Reactive.Export',
                                                                                               'Power.Reactive.Import',
                                                                                               'Power.Factor',
                                                                                               'Current.Import',
                                                                                               'Current.Export',
                                                                                               'Current.Offered',
                                                                                               'Voltage',
                                                                                               'Frequency',
                                                                                               'Temperature',
                                                                                               'SoC',
                                                                                               'RPM'],
                                                                                      'type': 'string'},
                                                                        'phase': {'additionalProperties': False,
                                                                                  'enum': ['L1',
                                                                                           'L2',
                                                                                           'L3',
                                                                                           'N',
                                                                                           'L1-N',
                                                                                           'L2-N',
                                                                                           'L3-N',
                                                                                           'L1-L2',
                                                                                           'L2-L3',
                                                                                           'L3-L1'],
                                                                                  'type': 'string'},
                                                                        'unit': {'additionalProperties': False,
                                                                                 'enum': ['Wh',
                                                                                          'kWh',
                                                                                          'varh',
                                                                                          'kvarh',
                                                                                          'W',
                                                                                          'kW',
                                                                                          'VA',
                                                                                          'kVA',
                                                                                          'var',
                                                                                          'kvar',
                                                                                          'A',
                                                                                          'V',
                                                                                          'K',
                                                                                          'Celcius',
                                                                                          'Celsius',
                                                                                          'Fahrenheit',
                                                                                          'Percent',
                                                                                          'Hertz'],
                                                                                 'type': 'string'},
                                                                        'value': {'type': 'string'}},
                                                         'required': ['value'],
                                                         'type': 'object'},
                                               'minItems': 1,
                                               'type': 'array'},
                              'timestamp': {'format': 'date-time',
                                            'type': 'string'}},
               'required': ['timestamp', 'sampledValue'],
               'type': 'object'},
     'minItems': 1,
     'type': 'array'}

On instance['meterValue']:
    {'sampledValue': [{'context': 'Transaction.Begin',
                       'measurand': 'Energy.Active.Import.Register',
                       'unit': 'kWh',
                       'value': '0.00'}],
     'timestamp': '2024-04-16T17:28:55.000Z'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 187, in route_message
    await self._handle_call(msg)
  File "/config/custom_components/ocpp/api.py", line 1011, in _handle_call
    await super()._handle_call(msg)
  File "/usr/local/lib/python3.12/site-packages/ocpp/charge_point.py", line 215, in _handle_call
    validate_payload(msg, self._ocpp_version)
  File "/usr/local/lib/python3.12/site-packages/ocpp/messages.py", line 229, in validate_payload
    raise TypeConstraintViolationError(
ocpp.exceptions.TypeConstraintViolationError: TypeConstraintViolationError: Payload for Action is syntactically correct but at least one of the fields violates data type constraints (e.g. “somestring”: 12), {'cause': "{'timestamp': '2024-04-16T17:28:55.000Z', 'sampledValue': [{'value': '0.00', 'context': 'Transaction.Begin', 'measurand': 'Energy.Active.Import.Register', 'unit': 'kWh'}]} is not of type 'array'", 'ocpp_message': <Call - unique_id=661eb557000000570056, action=MeterValues, payload={'connectorId': 1, 'transactionId': 1, 'meterValue': {'timestamp': '2024-04-16T17:28:55.000Z', 'sampledValue': [{'value': '0.00', 'context': 'Transaction.Begin', 'measurand': 'Energy.Active.Import.Register', 'unit': 'kWh'}]}}>}

Describe the bug

I tried to set up the OCCP integration withe the Huawei wall box. But I get this validation errors.

github-actions[bot] commented 2 months ago

Stale issue message

ad-ha commented 4 weeks ago

Hi @smoki3

Were you able to get the Huawei Scharger connected with OCPP?

I got mine installed, updated the firmware to version 060 with ocpp, but not able to even get it connected to HA and this integration.

Anyway you may help? Thanks