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

0 is not a valid ProtocolVersion #339

Closed
bprus opened this issue Oct 3, 2024 · 14 comments
Closed

0 is not a valid ProtocolVersion #339

bprus opened this issue Oct 3, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@bprus
Copy link

bprus commented Oct 3, 2024

HA core version

2024.9.3

Current integration version

0.6.0

Last known working integration version

0.5.9

Device type and model

Heat Pump Wi-Fi Controller 171H120F (0)

Working mobile app

iLetComfort

The description of problem

After upgrading to 0.6.0 I get the ValueError: 0 is not a valid ProtocolVersion. Please check the attached logs.
If you need more information I'm happy to help.

The logs

2024-10-03 08:40:43.770 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Socket is None, try to connect
2024-10-03 08:40:43.771 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Connecting to 192.168.1.151:6444
2024-10-03 08:40:43.780 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Connected
2024-10-03 08:40:43.780 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Authentication handshaking
2024-10-03 08:40:43.834 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Received auth response with 72 bytes: 8370004020012649c6eee62450e61f3a4c5f2acf20273de8c352940936e1dd070402270d9d37c917d730d1a7e6cf6971649a737548eaa82059318d71ae46d16fa77bb907d9ad5b13
2024-10-03 08:40:43.842 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Authentication success
2024-10-03 08:40:43.842 DEBUG (Heat Pump) [midealocal.device] [153931628219814] refresh_status with cmds: [<midealocal.message.MessageQueryAppliance object at 0xd53d6d80>, <midealocal.devices.c3.message.MessageQueryBasic object at 0xd53d6768>, <midealocal.devices.c3.message.MessageQuerySilence object at 0xd53d6c90>], check_protocol True
2024-10-03 08:40:43.842 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Sending: {'_device_type': <DeviceType.C3: 195>, '_message_type': <MessageType.query_appliance: 160>, '_body_type': <BodyType.X00: 0>, '_protocol_version': <ProtocolVersion.V1: 1>, 'header': 'aa1dc3000000000001a0', 'body': '00000000000000000000000000000000000000', 'message_type': 'query_appliance', 'body_type': '00', 'self': <midealocal.message.MessageQueryAppliance object at 0xd53d6d80>}, query is True
2024-10-03 08:40:44.028 ERROR (Heat Pump) [midealocal.device] [153931628219814] Error in process message, msg = aa2ac3000000000000a000c3000000000000000000000000000000000000000000000000000000000000b0
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 423, in parse_message
    cont = self.pre_process_message(decrypted)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 389, in pre_process_message
    message = MessageApplianceResponse(msg)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midealocal/message.py", line 613, in __init__
    super().__init__(message)
  File "/usr/local/lib/python3.12/site-packages/midealocal/message.py", line 579, in __init__
    self.protocol_version = ProtocolVersion(self._header[-2])
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 0 is not a valid ProtocolVersion
@bprus bprus added the bug Something isn't working label Oct 3, 2024
@chemelli74
Copy link
Collaborator

@bprus di you mind joining HomeAssistant on Discord and then contact me: chemelli74#2180 ?

@bprus
Copy link
Author

bprus commented Oct 3, 2024

Here're the logs with updated debugging:

2024-10-03 12:05:21.739 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Socket is None, try to connect
2024-10-03 12:05:21.740 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Connecting to 192.168.1.151:6444
2024-10-03 12:05:21.763 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Connected
2024-10-03 12:05:21.764 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Authentication handshaking
2024-10-03 12:05:21.833 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Received auth response with 72 bytes: 8370004020012649ce6fa2609b3671de92b475ed208150597143bd70b9ac9352f9d4224514d2fa91e3f2377b3119dacc913f668cb82e5359ff23cce2a8a6567db55d2778e441bc05
2024-10-03 12:05:21.842 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Authentication success
2024-10-03 12:05:21.842 DEBUG (Heat Pump) [midealocal.device] [153931628219814] refresh_status with cmds: [<midealocal.message.MessageQueryAppliance object at 0xd524fe58>, <midealocal.devices.c3.message.MessageQueryBasic object at 0xd524fd20>, <midealocal.devices.c3.message.MessageQuerySilence object at 0xd524f7e0>], check_protocol True
2024-10-03 12:05:21.842 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Sending: {'_device_type': <DeviceType.C3: 195>, '_message_type': <MessageType.query_appliance: 160>, '_body_type': <BodyType.X00: 0>, '_protocol_version': <ProtocolVersion.V1: 1>, 'header': 'aa1dc3000000000001a0', 'body': '00000000000000000000000000000000000000', 'message_type': 'query_appliance', 'body_type': '00', 'self': <midealocal.message.MessageQueryAppliance object at 0xd524fe58>}, query is True
2024-10-03 12:05:22.038 DEBUG (Heat Pump) [midealocal.message] MessageResponse - message: b'\xaa*\xc3\x00\x00\x00\x00\x00\x00\xa0\x00\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb0'
2024-10-03 12:05:22.040 DEBUG (Heat Pump) [midealocal.message] MessageResponse - header: b'\xaa*\xc3\x00\x00\x00\x00\x00\x00\xa0'
2024-10-03 12:05:22.040 ERROR (Heat Pump) [midealocal.device] [153931628219814] Error in process message, msg = aa2ac3000000000000a000c3000000000000000000000000000000000000000000000000000000000000b0
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 423, in parse_message
    cont = self.pre_process_message(decrypted)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 389, in pre_process_message
    message = MessageApplianceResponse(msg)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midealocal/message.py", line 616, in __init__
    super().__init__(message)
  File "/usr/local/lib/python3.12/site-packages/midealocal/message.py", line 581, in __init__
    self.protocol_version = ProtocolVersion(self._header[-2])
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 0 is not a valid ProtocolVersion
2024-10-03 12:05:22.050 DEBUG (Heat Pump) [midealocal.device] [153931628219814] Sending: {'_device_type': <DeviceType.C3: 195>, '_message_type': <MessageType.query: 3>, '_body_type': <BodyType.X01: 1>, '_protocol_version': <ProtocolVersion.V1: 1>, 'header': 'aa0bc300000000000103', 'body': '01', 'message_type': 'query', 'body_type': '01', 'self': <midealocal.devices.c3.message.MessageQueryBasic object at 0xd524fd20>}, query is True
2024-10-03 12:05:22.156 DEBUG (Heat Pump) [midealocal.message] MessageResponse - message: bytearray(b'\xaa#\xc3\x00\x00\x00\x00\x00\x00\x03\x01\x01\x17\x90\x03\x03(\x1e(0A#\x19\x057\x19\x19\x05<"<\x14&\x00\x80\x86')
2024-10-03 12:05:22.158 DEBUG (Heat Pump) [midealocal.message] MessageResponse - header: bytearray(b'\xaa#\xc3\x00\x00\x00\x00\x00\x00\x03')
2024-10-03 12:05:22.158 ERROR (Heat Pump) [midealocal.device] [153931628219814] Error in process message, msg = aa23c300000000000003010117900303281e283041231905371919053c223c1426008086
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 425, in parse_message
    status = self.process_message(bytes(decrypted))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midealocal/devices/c3/__init__.py", line 125, in process_message
    message = MessageC3Response(msg)
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midealocal/devices/c3/message.py", line 271, in __init__
    super().__init__(bytearray(message))
  File "/usr/local/lib/python3.12/site-packages/midealocal/message.py", line 581, in __init__
    self.protocol_version = ProtocolVersion(self._header[-2])
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 0 is not a valid ProtocolVersion

@chemelli74
Copy link
Collaborator

For reference, we tested using the following requirement in manifest.json:

"git+https://github.com/chemelli74/midea-local.git@chemelli74-debug-message#midea-local==6.0.0"

@bprus
Copy link
Author

bprus commented Oct 3, 2024

Small clarification, it was:

"git+https://github.com/chemelli74/midea-local.git@chemelli74-debug-message#midea-local==5.0.0"

@erikgieseler
Copy link
Contributor

I have exactly the same error with 0.6.0.
With the adjustments from #319, 0.5.9 worked again.
A 0.6.0 log is attached.
home-assistant.log

@chemelli74
Copy link
Collaborator

We have identified the issue and we are working on a solution.
Probably later today we will release a new version.

In the mean time, can you be so kind to share the device info ?
You can collect them via: midea-local download -sn <serial>

@bprus
Copy link
Author

bprus commented Oct 4, 2024

As I mentioned on Discord, I can't do that, because I use NetHome Plus cloud app and download_lua is not implemented there.

@rokam
Copy link
Collaborator

rokam commented Oct 5, 2024

As I mentioned on Discord, I can't do that, because I use NetHome Plus cloud app and download_lua is not implemented there.

Share your device SN and we can download it

@bprus
Copy link
Author

bprus commented Oct 5, 2024

Shared with @chemelli74 via Discord.

@twiktorowicz
Copy link

Same problem with 0.6.0.
My SN is: 0000C3310171H120F2312410182205V3

@patman-cp
Copy link

patman-cp commented Oct 5, 2024

I get an error for protocol 8:

ValueError: 8 is not a valid ProtocolVersion

Stack has:

homeassistant    | Traceback (most recent call last):
homeassistant    |   File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 425, in parse_message
homeassistant    |     status = self.process_message(bytes(decrypted))
homeassistant    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/usr/local/lib/python3.12/site-packages/midealocal/devices/ac/__init__.py", line 190, in process_message
homeassistant    |     message = MessageACResponse(bytearray(msg), self._power_analysis_method)
homeassistant    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/usr/local/lib/python3.12/site-packages/midealocal/devices/ac/message.py", line 910, in __init__
homeassistant    |     super().__init__(message)
homeassistant    |   File "/usr/local/lib/python3.12/site-packages/midealocal/message.py", line 579, in __init__
homeassistant    |     self.protocol_version = ProtocolVersion(self._header[-2])
homeassistant    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
homeassistant    |     return cls.__new__(cls, value)
homeassistant    |            ^^^^^^^^^^^^^^^^^^^^^^^
homeassistant    |   File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
homeassistant    |     raise ve_exc
homeassistant    | ValueError: 8 is not a valid ProtocolVersion
homeassistant    | 2024-10-05 08:02:23.992 ERROR (Air Conditioner) [midealocal.device] [151732604698822] Error in process message, msg = aa22ac00000000000805a05840660000003c0080000000000000000000000000217337

Home Assistant says the "device info" is:

Air Conditioner 00000Q1F (0) by Midea

@chemelli74
Copy link
Collaborator

closed via #343

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


closed via #343

@bprus
Copy link
Author

bprus commented Oct 6, 2024

I confirm that the new version solves the issue.
Thank you very much for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants