mac-zhou / midea-msmart

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

有时不能控制 unexpected data length #108

Open QGB opened 1 year ago

QGB commented 1 year ago

-------> a.toggle_display()
2023-08-11:02:06:24,776 ERROR    [security.py:105] unexpected data length
2023-08-11:02:06:24,777 ERROR    [lan.py:127] Authentication failed for 192.168.1.10:38288 -> 192.168.1.4:6444 retries: 5 time: 0.0 
2023-08-11:02:06:24,777 WARNING  [base.py:87] Got Null from 192.168.1.4:6444 Version: 3 Count: 0 Spend time: 1.04
2023-08-11:02:06:24,799 ERROR    [security.py:105] unexpected data length
2023-08-11:02:06:24,799 ERROR    [lan.py:127] Authentication failed for 192.168.1.10:38298 -> 192.168.1.4:6444 retries: 6 time: 0.02 
2023-08-11:02:06:24,799 WARNING  [base.py:87] Got Null from 192.168.1.4:6444 Version: 3 Count: 0 Spend time: 0.02

有时隔两个小时可以,有时不行 ,显示屏背光不亮

mill1000 commented 1 year ago

Can you enable debug logging?

e.g.

logging.basicConfig(level=logging.DEBUG)
QGB commented 1 year ago
2023-08-12:22:43:07,60 WARNING  [appliance.py:165] Device is not capable of operational mode 2.
2023-08-12:22:43:07,61 WARNING  [appliance.py:169] Device is not capable of swing mode 0.
2023-08-12:22:43:07,62 ERROR    [lan.py:70] Send 192.168.1.10:48614 -> 192.168.1.4:6444 retries: 0 time: 11802.12 Error: [Errno 104] Connection reset by peer
2023-08-12:22:43:07,152 INFO     [lan.py:122] Got TCP key for 192.168.1.10:45740 -> 192.168.1.4:6444 retries: 0 time: 0.06 tcp_key: 6a3145393b555d49b82b32aa049f04ed30707d67cbecd9be756156166712cf43

In [5]: U.set_log_level(10)
Out[5]: 10

In [6]: a.power_state=True;a.target_tem
   ...: perature=17;
   ...: a.display_on
   ...: a.apply()
2023-08-12:22:43:32,633 WARNING  [appliance.py:165] Device is not capable of operational mode 2.
2023-08-12:22:43:32,633 WARNING  [appliance.py:169] Device is not capable of swing mode 0.
2023-08-12:22:43:32,635 INFO     [appliance.py:155] Ignored special response. 192.168.1.4:6444 a100005370000000000000000070ff000000030002
2023-08-12:22:43:32,635 INFO     [appliance.py:155] Ignored special response. 192.168.1.4:6444 a1000053700000000000000000717a000000350002
2023-08-12:22:43:32,636 INFO     [appliance.py:155] Ignored special response. 192.168.1.4:6444 a00b40667f7f00000000000000000000000000000000002000000000000002
2023-08-12:22:43:32,636 INFO     [appliance.py:155] Ignored special response. 192.168.1.4:6444 a00b40667f7f00000000000000000000000000000000002000000000000002
QGB commented 1 year ago

In [7]: a.power_state=True;a.target_temperature=30;
   ...: a.apply()
2023-08-12:23:58:46,247 WARNING  [appliance.py:165] Device is not capable of operational mode 2.
2023-08-12:23:58:46,248 WARNING  [appliance.py:169] Device is not capable of swing mode 0.
2023-08-12:23:58:46,249 ERROR    [lan.py:70] Send 192.168.1.10:45740 -> 192.168.1.4:6444 retries: 0 time: 4539.15 Error: [Errno 104] Connection reset by peer
2023-08-12:23:58:48,254 ERROR    [lan.py:42] Connect Error: 192.168.1.4:6444 timed out
2023-08-12:23:58:48,254 ERROR    [lan.py:60] Sokcet is None: 192.168.1.4:6444
2023-08-12:23:58:48,254 ERROR    [security.py:105] unexpected data length
2023-08-12:23:58:48,255 ERROR    [lan.py:127] Authentication failed for 192.168.1.10:45740 -> 192.168.1.4:6444 retries: 1 time: 4541.16 
2023-08-12:23:58:48,255 WARNING  [base.py:87] Got Null from 192.168.1.4:6444 Version: 3 Count: 0 Spend time: 2.01

In [8]: a.power_state=True;a.target_temperature=30;
   ...: a.apply()
2023-08-12:23:59:02,999 WARNING  [appliance.py:165] Device is not capable of operational mode 2.
2023-08-12:23:59:02,999 WARNING  [appliance.py:169] Device is not capable of swing mode 0.
2023-08-12:23:59:03,74 INFO     [lan.py:122] Got TCP key for 192.168.1.10:47042 -> 192.168.1.4:6444 retries: 0 time: 0.06 tcp_key: af904dc8d8b4d9bd1b59b35834cd031da0eb78949227df4cfcced1e58a55c9b0
mill1000 commented 1 year ago

Looks like it eventually works?

2023-08-12:23:59:03,74 INFO     [lan.py:122] Got TCP key for 192.168.1.10:47042 -> 192.168.1.4:6444 retries: 0 time: 0.06 tcp_key:

Are you able to set temperature?

QGB commented 1 year ago

NO , sometimes can't control anything

mill1000 commented 1 year ago

I don't recognize this as a valid command: In [5]: U.set_log_level(10)

Enable debug logging with logging.basicConfig(level=logging.DEBUG)

QGB commented 1 year ago

@mill1000 the two commands are equal. U.set_log_level just a wrap.

mill1000 commented 1 year ago

But there are no DEBUG lines in your logs above.