mac-zhou / midea-msmart

This is a library to allow communicating to a Midea AC via the Local area network.
MIT License
149 stars 38 forks source link

OverflowError: int too big to convert #59

Closed tinymins closed 2 years ago

tinymins commented 2 years ago

ENVIRONMENT

ERROR MESSAGE

Logger: homeassistant.core
Source: custom_components/midea_ac/climate.py:120
Integration: midea_ac (documentation)
First occurred: 2021年12月28日 24:05:52 (8 occurrences)
Last logged: 10:12:38

Error executing service: <ServiceCall climate.set_hvac_mode (c:faxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx): entity_id=['climate.midea_ac_16xxxxxxxxxxxxx'], hvac_mode=heat>
Error executing service: <ServiceCall climate.set_hvac_mode (c:d3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx): entity_id=['climate.midea_ac_16xxxxxxxxxxxxx'], hvac_mode=heat>
Error executing service: <ServiceCall climate.set_hvac_mode (c:f4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx): entity_id=['climate.midea_ac_16xxxxxxxxxxxxx'], hvac_mode=heat>
Error executing service: <ServiceCall climate.set_hvac_mode (c:37xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx): entity_id=['climate.midea_ac_16xxxxxxxxxxxxx'], hvac_mode=heat>
Error executing service: <ServiceCall climate.set_hvac_mode (c:d1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx): entity_id=['climate.midea_ac_16xxxxxxxxxxxxx'], hvac_mode=heat>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1511, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 667, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 863, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 704, in _handle_entity_call
    await result
  File "/config/custom_components/midea_ac/climate.py", line 295, in async_set_hvac_mode
    await self.apply_changes()
  File "/config/custom_components/midea_ac/climate.py", line 120, in apply_changes
    await self.hass.async_add_executor_job(self._device.apply)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/msmart/device.py", line 264, in apply
    self._send_cmd(cmd)
  File "/usr/local/lib/python3.9/site-packages/msmart/device.py", line 208, in _send_cmd
    responses = self._lan_service.appliance_transparent_send_8370(data)
  File "/usr/local/lib/python3.9/site-packages/msmart/lan.py", line 136, in appliance_transparent_send_8370
    data = self.security.encode_8370(data, msgtype)
  File "/usr/local/lib/python3.9/site-packages/msmart/security.py", line 113, in encode_8370
    data = self._request_count.to_bytes(2, 'big') + data
OverflowError: int too big to convert

REFERENCE

https://github.com/mac-zhou/midea-msmart/blob/f43c9d881d1d9101f0c43b9446b70a71385afb1b/msmart/security.py#L113

mac-zhou commented 2 years ago

fixed in https://github.com/mac-zhou/midea-msmart/commit/607fa1b5ea9922e9fd7b7fe0030dccdbc14588e8 after request_count is reset to 0, I don’t know if there will be other problems, please help to observe, thank you