Code Monkey home page Code Monkey logo

midea-msmart's People

Contributors

aa755 avatar elahd avatar fabaff avatar j0nathan33 avatar jchasey avatar kueblc avatar mac-zhou avatar mill1000 avatar neoacheron avatar rokam avatar sdebruyn avatar wmp avatar zvldz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

midea-msmart's Issues

Will not read or set 16°C

The minimum set temperature for heating on my system is 16°C but when set to this it is read back as 17°C. It will not set to 16°C either.

Midea-discover

Where can I run midea-discover, pip3 etc...

Thanks in advance
Andrew

Potential issue in crc calculation?

Hey,
I was looking through the code and I found this:

if k > 256:

I think this is a mistake and it should be >= 256 (or just > 255) because in some rare cases if k stays at exactly 256 then there will be no value to take from the table.

Please verify and if current solution is really correct then maybe leave a comment in the code why, because it looks really confusing.

thanks!

Update 0.1.23 -> 0.1.24 stops the integration from working

I had two air con units showing up in home assistant in version 0.1.23 however after performing the update they are now showing as unavailable. I am using version 2020.11.0 of home assistant on a Raspberry Pi 3.

To try and fix the issue I have rebooted the Pi, power cycled the air con, uninstalled the integration and reinstalled it.

The only thing I can find in the log is: Update of climate.midea_ac_0********1 is taking over 10 seconds
(
to hide the item number)

padding is incorrect

15.06 15:26 msmart.cli   INFO     Discovering devices with UDP Broadcast
15.06 15:26 msmart.security ERRORaes_decrypt error: ValueError('Padding is incorrect.') - data: 0000000000000000b2c65aa3bf842cf537a3cf07dda75ce37ea68da00601c5f2f7d7a54947ac851233f45f1784c5bb1f661a21549e00596c8ad99d4f22407a12

Hi Mac-zhou.
i got one user that has this error on UDP broadcast. you know whats wrong?

8° Heat frost protection

I know that the Midea AC units have a function called "8° Heat", which is a mode that is programmable to serve as frost protection for the room. If you live in a cold climate and are away for a while, you can activate this mode and the AC unit will keep a steady 8°C indoor temperature.

Do you know if this mode is able to be set through python?

Midea AC - Token reset?

hi dev, another issue i noticed is that every few weeks the integrated entities stop working, and after running midea-discover i see a different key and token. replacing them they work again.

is there a way to avoid the above?

Local wifi pairing

Hello,
is there a way to pair climate with my wifi network in local mode, without to use app (and its cloud)?

UART protocol

Hi. Help is needed!

The fact is that I have an Electrolux air conditioner. Externally, the control boards are identical and many sources claim that they are manufactured in the Midea factories in China. Specifically for my model, the "USB" module is not on sale in the Russian market, although the connector is provided and declared by the supplier (sometimes it happens)... Therefore, it is not possible to carry out reverse engineering. If I knew the protocol on the UART side, I could at least try to control the device. It is necessary to help understand the relationship between the external control protocol and frames on the side of the UART interface.

Perhaps, with your help, community will get a library for controlling Midea and Electrolux air conditioners by UART interface.

I would be grateful for the help provided. Thanks.

allow setting the temperature unit to Fahreheit

I tried self.data[0x09] |= 0x04 but it did not work. My AC still shows the temperature in Celcius. I can use the nethome app to set it to Fahrenheit. But because device.refresh() doesn't work for me, I cannot reverse engineer the state. How did you reverse engineer the LAN protocol?

SK102 wifi usb key goes unavailable for 30 minutes after 12 state queries

I have a Klimaire AC unit with an SK102 wifi usb key installed in it to support WIFI access. I've found that when the unit is queried 12 times (12 requests for the unit's state) it goes offline and won't respond to requests for 30 minutes. After 30 minutes, it resumes normal operation.

It doesn't seem to matter what interval this occurs in. If I query the state every 15 seconds, it goes down after 3 minutes. If I query every 5 minutes, it goes down after 1 hour.

This doesn't seem to be a problem with the unit itself because when I use the official Midea Air app it is able to issue many state updates and refreshes without this issue occurring. I imagine there is something about how the data packets are being sent to the WIFI key that is causing this issue.

Let me know if I can provide more info.

Discover padding error

Discover fails. Device can be found, but response can't be parsed? Used the latest .19 version.

midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
INFO:msmart.cli:Midea Local Data 192.168.2.4 837000b8200f04025a5a0111a8007a800000000000000000000000007f1a0000001500000000000000000000000000006706f38709678c8dfd06cb24d5690557541b21fed71585eef2cfeccc730d70a7a7574a5b8f1647c7e0e090b3244dfe6e4a6afd78359f14d13eab2efd80c60ed1d76e2c3e43a6dda418000da16e50e0db682b11e235eef961e588bd6fd663cf18f31443d17c3aac03a7656614ae1dca448aeb8c241f94e80aeac46942dc1ad0e37b77e4e6472e6914b86c59cdc1b6cd1b
ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.',) - data: 6706f38709678c8dfd06cb24d5690557541b21fed71585eef2cfeccc730d70a7a7574a5b8f1647c7e0e090b3244dfe6e4a6afd78359f14d13eab2efd80c60ed1
Traceback (most recent call last):
  File "/home/pi/.pyenv/versions/3.6.9/bin/midea-discover", line 11, in <module>
    sys.exit(discover())
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/msmart/cli.py", line 76, in discover
    m_type = m_ssid.split('_')[1]
IndexError: list index out of range

wifi connection without midea app?

Hi,

first, thank you for this project. Im really looking into integrating this into my openhab.
I havent mounted the ac yet, so im not familiar with the setup yet.

When using the midea cloud app, you connect to the access point of the wifi module first and then setup your home wifi name and password, so the wifi module can connect to the local network.

Is this step needed too, when using this method? I'd like to skip the cloud completely :)

是否可以支持非全量 apply ?

我看 apply 函数的实现,即使是只修改了一个属性值的话,也会把所有属性收集后打包发出去。

这样有 2 个问题:

  1. 浪费了带宽,不过局域网内可能没人关心这个;
  2. 如果有两个控制终端,终端 A 修改了属性 a,终端 B 修改了属性 b,两方同时提交,必然会有一方的修改值被覆盖掉。 一个可缓解此问题的方法是每次 apply 前都 refresh 一次,但是这样的话,又加剧了问题 1,而且不能根本解决问题。

所以,是否支持对指定属性的更新呢?不确定是美的协议不支持,或是库实现问题,烦请回复,谢谢。

Unable to download APK

When trying to clone Midea-Air-gettoken-only-oversea.apk I get:

"This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access."

Is there an alternate way to get this apk?

cant connect to device

Protocol V3
Got Token and Key from LDPlayer adb.
example.py

#!/usr/bin/python3
# -*- coding: UTF-8 -*-
from msmart.device import air_conditioning_device as ac
import logging
logging.basicConfig(level=logging.DEBUG)

device_ip = '192.168.178.80'
device_id = '19791209337257'
device_K1 = '51EC9781C90241F982E49B6985D1D63074C54171FD054DFB8D0B7D107B146396'
device_Token = 'AF388C69453EAE05E184399DFB0AC7F174FEE3D31C04C1FA60D1F6557831C5289851BDAE5B99B39737C554AA4A4DEFC2A1E3261E51391148BF6B31E3AFEC0FD0'


# first take device's ip and id, port is generally 6444
# pip3 install msmart; midea-discover
#device = ac(device_ip, device_id, 6444)
device = ac(device_ip, int(device_id), 6444)

# If the device is using protocol 3 (aka 8370)
# you must authenticate with device's k1 and token.
# adb logcat | grep doKeyAgree
# device.authenticate('YOUR_AC_K1', 'YOUR_AC_TOKEN')
device.authenticate(device_K1, device_Token)

# Refresh the object with the actual state by querying it
device.refresh()
print({
        'id': device.id,
        'name': device.ip,
        'power_state': device.power_state,
        'prompt_tone': device.prompt_tone,
        'target_temperature': device.target_temperature,
        'operational_mode': device.operational_mode,
        'fan_speed': device.fan_speed,
        'swing_mode': device.swing_mode,
        'eco_mode': device.eco_mode,
        'turbo_mode': device.turbo_mode,
        'indoor_temperature': device.indoor_temperature,
        'outdoor_temperature': device.outdoor_temperature,
    })



# Set the state of the device and 
device.power_state = True
device.prompt_tone = True
device.target_temperature = 19
device.operational_mode = ac.operational_mode_enum.cool

# commit the changes with apply()
device.apply()

print({
        'id': device.id,
        'name': device.ip,
        'power_state': device.power_state,
        'prompt_tone': device.prompt_tone,
        'target_temperature': device.target_temperature,
        'operational_mode': device.operational_mode,
        'fan_speed': device.fan_speed,
        'swing_mode': device.swing_mode,
        'eco_mode': device.eco_mode,
        'turbo_mode': device.turbo_mode,
        'indoor_temperature': device.indoor_temperature,
        'outdoor_temperature': device.outdoor_temperature
    })

but nothing changed

Debug-log:

11.08 16:20 msmart.lan   DEBUG    Attempting new connection to 192.168.178.80:6444
11.08 16:20 msmart.lan   DEBUG    Sending to 192.168.178.80:6444 8370004020000000af388c69453eae05e184399dfb0ac7f174fee3d31c04c1fa60d1f6557831c5289851bdae5b99b39737c554aa4a4defc2a1e3261e51391148bf6b31e3afec0fd0
11.08 16:20 msmart.lan   DEBUG    Received from 192.168.178.80:6444 83700040200100004134f2ea3c2f3ec0e71f34c3b073a267d103142605e47e12d6cfdf1def4ee7309382c1c3f64eeca1efe844694840da8911ded11758228052874488e280ef0333
11.08 16:20 msmart.lan   DEBUG    Got TCP key for 192.168.178.80:6444 79ac3d2009746e4c746630de87c87f85ed46ebc57ecb664e4348d7a5b8f14923
11.08 16:20 msmart.command DEBUG    Finalize request data: aa20ac00000000000003418100ff03ff000200000000000000000000000035ae89
11.08 16:20 msmart.lan   DEBUG    Sending to 192.168.178.80:6444 8370008e2066a8a3da2370e7a4a0eabd1d45ef9c95de9f1feb49c84fd92ea90d37bfddef49f907cb8ad08a0af867f7742aa2b19e15a40dd4798a79e2afdf8d8ece07b2e3f2c3e1dde8c342eacdeafaa501fe183b3e8d470e7acc66b6784d9c9caf4630199b0c673771df1bb7eab1d5b277db860b3ba1b3a7a47a0d2b31e45bca13607c2a59956deceb06ba38154ae34a3e0dc56342ef
11.08 16:21 msmart.lan   INFO     Couldn't connect with Device 192.168.178.80:6444
11.08 16:21 msmart.command DEBUG    Finalize request data: aa23ac000000000000024043436603ff003000000000000000000000000001000000c907
11.08 16:21 msmart.lan   DEBUG    Attempting new connection to 192.168.178.80:6444
11.08 16:21 msmart.lan   DEBUG    Sending to 192.168.178.80:6444 8370004020000001af388c69453eae05e184399dfb0ac7f174fee3d31c04c1fa60d1f6557831c5289851bdae5b99b39737c554aa4a4defc2a1e3261e51391148bf6b31e3afec0fd0
11.08 16:21 msmart.lan   DEBUG    Received from 192.168.178.80:6444 8370004020010000f03a3ec73d6c1c587074662fd0a978c8d81a960ae800dc052c14ebf8e16ed173b0c7cbcec01af1bf9d5e4e3c65a8e5e2ef8ed7291bf370c4cc3556b4f1ca3e89
11.08 16:21 msmart.lan   DEBUG    Got TCP key for 192.168.178.80:6444 38b7652a835431644523edf55350a1af644cb5eee56f396576e5088e848b9608
11.08 16:21 msmart.lan   DEBUG    Sending to 192.168.178.80:6444 8370008e2066a08f67f96863e9b1ef25045474b7a8dd0c733db06a8f45a576c69a7d3fa722492b2645d9722e58ae6e2c30f5743977a4ca61260120a138fcf8b6282da635f72319e7bcfd5a63d1c79932a7808a38c966ce2b24dde8b65bdfee9ba6c7a1aff0941267665ebedd7a4d2247ea5abed44a170a9f1f5bd3f98a5889bee7f6d028e33619e6c21c8441643c924a800c78876111
11.08 16:21 msmart.lan   INFO     Couldn't connect with Device 192.168.178.80:6444

thanks for support

Help decoding encrypted data from midea water boiler

I am currently trying to rev engineering midea water boiler, and I have a question for you
I saw you hard coded keys in security.py, may i ask where did you get it from,

appKey = '434a209a5ce141c3b726de067835d7f0'
signKey = 'xhdiwjnchekd4d512chdjx5d8e4c394D2D7S'

attached file is the data I dumped from sock.recvfrom(512) in cli.py, I'd be appreciate if you can help me

...
    for i in range(10):
        try:
            sock.sendto(BROADCAST_MSG, ("255.255.255.255", 6445))
            while True:
                data, addr = sock.recvfrom(512)
                m_ip = addr[0]
                _LOGGER.info('IP: {}'.format(m_ip))
                _LOGGER.info('data: {}'.format(data))
                with open('dump_enc.bin', 'wb') as f:
                    f.write(data)
                if len(data) >= 41 and m_ip not in found_devices:
                    m_id = convert_device_id_int(data[20:26].hex())
                    found_devices[m_ip] = m_id
                    data = data[40:40+64]
...

dump_enc.zip

有没有可能支持美的**空调?

Hi zhou,

研究你的代码有好几周了,一直也没有什么进展,我家的空调是美的**空调,给它配了一个控制面板,就能在美的美居里控制所有空调内机了,空调面板型号是D1ZDK-1B,它好像兼有蓝牙网关的功能.

使用该库进行设备发现,开启debug模式后输出如下:

C:\Users\jason>midea-discover -d -a 15720****** -p **********
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
DEBUG:asyncio:Using proactor: IocpProactor
DEBUG:msmart.scanner:Broadcast message sent: 0
DEBUG:msmart.scanner:Socket timeout

也尝试了使用tcpdump进行抓包,抓包使用的命令是是在另外一个issue中给出的:
tcpdump -i any host 192.168.101.155 -p -nn -s 0 -w midea.pcap -vvv
其中192.168.101.155是控制面板的IP地址,但是抓了一下午也才抓出来6k的pcap文件,使用你在另外一个库中的pcap-decrypt.py打开后该文件后报错如下:

C:\Users\jason\Downloads\midea-ac-py-master\midea-ac-py-master>python pcap-decrypt.py midea.pcap
Traceback (most recent call last):
  File "C:\Users\jason\Downloads\midea-ac-py-master\midea-ac-py-master\pcap-decrypt.py", line 78, in <module>
    for packet in cap:
  File "C:\Users\jason\AppData\Local\Programs\Python\Python39\lib\site-packages\pyshark\capture\capture.py", line 232, in _packets_from_tshark_sync
    tshark_process = existing_process or self.eventloop.run_until_complete(self._get_tshark_process())
  File "C:\Users\jason\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Users\jason\AppData\Local\Programs\Python\Python39\lib\site-packages\pyshark\capture\capture.py", line 396, in _get_tshark_process
    parameters = [self._get_tshark_path(), "-l", "-n", "-T", output_type] + \
  File "C:\Users\jason\AppData\Local\Programs\Python\Python39\lib\site-packages\pyshark\capture\capture.py", line 373, in _get_tshark_path
    return get_process_path(self.tshark_path)
  File "C:\Users\jason\AppData\Local\Programs\Python\Python39\lib\site-packages\pyshark\tshark\tshark.py", line 58, in get_process_path
    raise TSharkNotFoundException(
pyshark.tshark.tshark.TSharkNotFoundException: TShark not found. Try adding its location to the configuration file. Searched these paths: ['C:\\Program Files\\Wireshark\\tshark.exe', 'C:\\Program Files (x86)\\Wireshark\\tshark.exe', 'C:\\Program Files\\Wireshark\\tshark.exe']

没有办法了,想你寻求帮助,不甚感激.

Allow to set the indoor temperature

As the remote has a 'follow me' function that transmits the internal temperature (of the remote) to the AC will it be possible to replicate it in msmart?

非常抱歉。之前一个issues没能跟进。因为一直在管主hass论坛的内容了。美的的华菱空调适配问题。

我现在将msmart升级到最新版本。并且运行midea-discover -d如下: 空调有三台。重复运行midea-discover -d会随机显示其中一台。。

bash-5.0# pip show msmart
Name: msmart
Version: 0.1.19
Summary: A library to control Midea appliances via the Local area network
Home-page: https://github.com/mac-zhou/midea-msmart
Author: mac_zhou
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.7/site-packages
Requires: pycryptodome
Required-by:
bash-5.0# midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
INFO:msmart.cli:Midea Local Data 192.168.3.29 837000b8200f04055a5a0111a8007a80000000000000000000000000c204020000850000000000000000000000000000195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027a74a0a46d69f23e8ae365d721dfba3998a0fa254619b8d2f622538cb2ff085ec06c416020931f48926620dfe95e231116d3c5561ee26ead19c5988051404fdb68f2c51de7e8ba309244b935150e8845d
ERROR:msmart.security:aes_decrypt error: ValueError('Padding is incorrect.') - data: 195610e33f8ad661d6bcf360d699751ce43a10d55b2c14f8dd337a30238b38c61d0fa9bf7435ce8fdc29858455ac912f32fc917cb459c4a3135aac7ca28ce027
Traceback (most recent call last):
File "/usr/local/bin/midea-discover", line 8, in
sys.exit(discover())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/msmart/cli.py", line 76, in discover
m_type = m_ssid.split('_')[1]
IndexError: list index out of range

OverflowError: int too big to convert

ENVIRONMENT

  • midea_ac: 0.1.35

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

data = self._request_count.to_bytes(2, 'big') + data

Example does not work

In the example.py the port parameter is missing:

c = midea_device('YOUR_AC_IP', YOUR_AC_ID)

The port has no default value thus needs to be provided. Would be nice to see an actually working example or the port initialized with adefault one. What is the most common port for Midea AC?

Mider AC not supported

Hello,

sadly, my ac of midea isn't supported via your midea-msmart.
Logging infos:


pi@raspberrypi:~ $ midea-discover
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.20
INFO:msmart.cli:Discovering devices with UDP Broadcast, press CTRL-C to quit...
INFO:msmart.cli:Midea Local Data 192.168.2.15 837000b8200f04015a5a0111a8007a80000000000000000000000000534a000000130000000000000000000000000000c9dba42446780e89ca2989f876df6a55858af37fdb1aa402d4a5addbb7f5e4466921d8ad922d2805f1f9f9b3d78568d381cea6223c7417895adabd0b1d20bd0f45aa229ad5d70ede5de8aa75aab124a5ea299df42bb39faf330f5ff8c078f38ef31443d17c3aac03a7656614ae1dca44fd21ad9c2af4841039f0f4be5e90c31134481db8d1ef2de31cb993c2f253b33d
DEBUG:msmart.packet_builder:Finalize request data: aa20ac00000000000003418100ff03ff0002000000000000000000000000246ddb
DEBUG:msmart.lan:Sending to 192.168.2.15:6444 5a5a011168002000000000001e24031408071414534a0000001300000000000000000000000000006b000a76e27eed2c3647e57d8602df8b5e715882de60dba0e3796fe854da3af32d7ed3293c5031048410429ad538d2fbaa83339460bcb3449c04e26668216aeb
INFO:msmart.lan:Couldn't connect with Device 192.168.2.15:6444
DEBUG:msmart.device:refresh - Recieved from 192.168.2.15, 534a00000013:
INFO:msmart.cli:*** Found a unsupported '0xac' at 192.168.2.15 - id: 20890720946771 - sn: P0000000Q1847C9BBE52200000 - ssid: net_ac_5220


Maybe you could help me to get this supported ;) Please let me know, whether you need more infos (and which/how).

Cheers,
PatMei

refresh works but apply command don't

Hi,
I'm in France, and I discovered your update yesterday. Nice job !!
I love the local connection (whithout cloud), I dream of it since 2 years :)
I have a Qlima AC (midea built). The code works well for refresh data (get state and parameters from AC), but applying new values only works 1 of 10 times or less... don't know why. I try to put prints but can't see anything. (Ido not user Home assistant, just send orders directly with python)
for example here an exchenge between my webserver and the AC :

Finalize request data: aa23ac000000000000024081426503ff000000000000000000000000000000000000bc09
Recieved from 3c4c0000000f: aa22ac00000000000302c00043287f7f00300000005f5a000000000000000000000e0d
Appliance response data: c00043287f7f00300000005f5a000000000000000000000e0d

I don't know if it can help...
Thanks

error running

Hi,
sorry I'm not very good with python.
When I try to create device, iget this error :
NameError: name 'cloud' is not defined. There is no "cloud" any more in the packager. What did I missed ?
Thanks

Made some cleaning and it's ok now . sorry

Couldn't connect but get response

Hello ppl I have 4 AC units I'm trying to connect with the library. But after get K1 and Token sometimes works sometimes not.

Requirement already satisfied: msmart in ./.local/lib/python3.7/site-packages (0.1.28)
Requirement already satisfied: pycryptodomex in ./.local/lib/python3.7/site-packages (from msmart) (3.10.1)
Requirement already satisfied: pycryptodome in ./.local/lib/python3.7/site-packages (from msmart) (3.10.1)
Requirement already satisfied: click in ./.local/lib/python3.7/site-packages (from msmart) (8.0.1)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from click->msmart) (4.6.3)
Requirement already satisfied: zipp>=0.5 in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->click->msmart) (3.5.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in ./.local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->click->msmart) (3.10.0.0)

The output log is

DEBUG:msmart.lan:Attempting new connection to 192.168.1.145:6444
DEBUG:msmart.lan:Sending to 192.168.1.145:6444 837000402000000078c9b43865b2b3ac5901d27a8b0785d17fccb796e1200eaba07e11ce4b0b59de16542d3dc9f9d9e75db9467a69ab9fb2783bdd119ac08cde20e80c7446a0e39f
DEBUG:msmart.lan:Received from 192.168.1.145:6444 8370004020010000b2cb8cb5f6dd50fc0657a896c05200fbb7204bb303ef21322d18f6ecc80005e4efe4c1888be95b5654cb97fbb5a1abdd0174c48222a657e6aa05ef9d97c3e941
INFO:msmart.lan:Got TCP key for 192.168.1.145:6444 8e414e29d357b38d3e4265aa5576e51ce905d0e9a2543f080dc23af1210a01c7
DEBUG:msmart.command:Finalize request data: aa20ac00000000000003418100ff03ff000200000000000000000000000006f274
DEBUG:msmart.device:pkt_builder: 192.168.1.145:192.168.1.145 len: 104 data: 5a5a0111680020000000000025060d0d1108151468590300001d00000000000000000000000000006b000a76e27eed2c3647e57d8602df8bf295fcc1f4b9ce80e506ab2a879fe3c5a8a539f3ded2b04298069292e4ad666e4dd02e9fe4b8fb958ea15ba3dca5f282
DEBUG:msmart.lan:Sending to 192.168.1.145:6444 8370008e206671ce9076ab3f7bc9f7981ddc2a5977874ae6aa72d2d382544e09d86fcd4171d878d4daebb934c9b7bd66dc68526951f6bdf09fd1a5a2f2ccfde734d9f9d84df855beb911d7806547201fb88d23b0af373de83d834a514f63ad32ddb826318872d4db93ac39c408aac4c4f6f1fdea034b780b6d1bd6438af2abf3f17f6ae8b5480e975f3e43f410f435908293bf8c3b9d
ERROR:msmart.lan:Couldn't connect with Device 192.168.1.145:6444 timed out
DEBUG:msmart.device:Got responses from 192.168.1.145:192.168.1.145 Version: 3 Count: 0
{'id': 31885837425000, 'name': '192.168.1.145', 'power_state': False, 'prompt_tone': False, 'target_temperature': 17.0, 'operational_mode': <operational_mode_enum.auto: 1>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 0.0, 'outdoor_temperature': 0.0}
{'id': 31885837425000, 'name': '192.168.1.145', 'power_state': True, 'prompt_tone': True, 'target_temperature': 19, 'operational_mode': <operational_mode_enum.cool: 2>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 0.0, 'outdoor_temperature': 0.0}

My script for test ist

#!/usr/bin/python3
# -*- coding: UTF-8 -*-
from msmart.device import air_conditioning_device as ac
import logging
logging.basicConfig(level=logging.DEBUG)

device_ip = '192.168.1.145'
device_id = '31885837425000'
device_K1 = 'D86532ACE8564E34A0F51413FD1394A3937BA756C34348B485D84E4D2464F57A'
device_Token = '78C9B43865B2B3AC5901D27A8B0785D17FCCB796E1200EABA07E11CE4B0B59DE16542D3DC9F9D9E75DB9467A69AB9FB2783BDD119AC08CDE20E80C7446A0E39F'
port = 6444

device = ac(device_ip, int(device_id), port)

device.authenticate(device_K1, device_Token)

# Refresh the object with the actual state by querying it
device.refresh()
print({
        'id': device.id,
        'name': device.ip,
        'power_state': device.power_state,
        'prompt_tone': device.prompt_tone,
        'target_temperature': device.target_temperature,
        'operational_mode': device.operational_mode,
        'fan_speed': device.fan_speed,
        'swing_mode': device.swing_mode,
        'eco_mode': device.eco_mode,
        'turbo_mode': device.turbo_mode,
        'indoor_temperature': device.indoor_temperature,
        'outdoor_temperature': device.outdoor_temperature,
    })

what can i be doing wrong?

Thanks

8370 Breaking Changes

Installed latest 8370 changes to test compatability. Problem during pip3 install where it seems the wrong cryptodome library is installed?

Installed with:
user@pop-os:~$ pip3 install git+https://github.com/mac-zhou/midea-msmart.git

Output:

user@pop-os:~$ pip3 install git+https://github.com/mac-zhou/midea-msmart.git
Collecting git+https://github.com/mac-zhou/midea-msmart.git
  Cloning https://github.com/mac-zhou/midea-msmart.git to /tmp/pip-req-build-veo6_kmt
  Running command git clone -q https://github.com/mac-zhou/midea-msmart.git /tmp/pip-req-build-veo6_kmt
Requirement already satisfied: click in /usr/lib/python3/dist-packages (from msmart==0.1.25) (7.1.2)
Collecting pycryptodome
  Using cached pycryptodome-3.10.1-cp35-abi3-manylinux2010_x86_64.whl (1.9 MB)
Building wheels for collected packages: msmart
  Building wheel for msmart (setup.py) ... done
  Created wheel for msmart: filename=msmart-0.1.25-py3-none-any.whl size=16998 sha256=e6c7d33cc5bb2a035a61385c4b83bdae55232ffa2c0b1b20814f6c4b6dff3237
  Stored in directory: /tmp/pip-ephem-wheel-cache-sj4d12g8/wheels/89/c8/73/017e6e110d7eb53fc3871b48040270be951180ad8702e15bc7
Successfully built msmart
Installing collected packages: pycryptodome, msmart
Successfully installed msmart-0.1.25 pycryptodome-3.10.1
user@pop-os:~$ midea-discover
Traceback (most recent call last):
  File "/home/user/.local/bin/midea-discover", line 5, in <module>
    from msmart.cli import discover
  File "/home/user/.local/lib/python3.9/site-packages/msmart/cli.py", line 9, in <module>
    from msmart.security import security
  File "/home/user/.local/lib/python3.9/site-packages/msmart/security.py", line 4, in <module>
    from Cryptodome.Cipher import AES
ModuleNotFoundError: No module named 'Cryptodome'

This is not fixed until I run pip3 install pycryptodomex,

Output after installing new lib:

user@pop-os:~$ pip3 install pycryptodomex
Collecting pycryptodomex
  Downloading pycryptodomex-3.10.1-cp35-abi3-manylinux2010_x86_64.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 3.0 MB/s 
Installing collected packages: pycryptodomex
Successfully installed pycryptodomex-3.10.1
user@pop-os:~$ midea-discover
INFO:msmart.cli:msmart version: 0.1.25
INFO:msmart.cli:Sending Device Scan Broadcast...
INFO:msmart.cli:Midea Local Data 10.0.0.252 837000b8200f04965a5a0111a8007a80000000000000000000000000856b0100000e0000000000000000000000000000dc449482eb2a18046c25f9d6f40040bb7c5179b1de29da3850d76d9beb6696c43c62647f4cd2d2970bc61b40da818a41fc8e848a4e8dd114460862be7fde510a2a78f6fe90fe0607a7e5ae341e42aa7a1e13b89b18cacc5258a419137be8ced2f31443d17c3aac03a7656614ae1dca4439ef79621da6e307efe525d9260ca3c730ad07ec1162951f501b492fb9432443
INFO:msmart.cli:Decrypt Reply: 10.0.0.252 fc00000a2c19000030303030303050303030303030305131353032444242353933383441303030300b6e65745f61635f333834410000000001000000040000000000ac00000000000000502dbb59384a069fcd0400040103000000000000000000000000000000000000000000
Traceback (most recent call last):
  File "/home/user/.local/bin/midea-discover", line 8, in <module>
    sys.exit(discover())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.9/site-packages/msmart/cli.py", line 114, in discover
    m_support = support_test(m_ip, int(m_id), int(m_port))
  File "/home/user/.local/lib/python3.9/site-packages/msmart/cli.py", line 181, in support_test
    device.refresh()
  File "/home/user/.local/lib/python3.9/site-packages/msmart/device.py", line 196, in refresh
    self._send_cmd(cmd)
  File "/home/user/.local/lib/python3.9/site-packages/msmart/device.py", line 199, in _send_cmd
    pkt_builder = packet_builder(self.id)
  File "/home/user/.local/lib/python3.9/site-packages/msmart/packet_builder.py", line 38, in __init__
    self.packet[20:26] = device_id.to_bytes(6, 'little')
AttributeError: 'str' object has no attribute 'to_bytes'

Python version 3.9.5

Thanks for the 8370 support! Can't wait until its fully working.

Display command

Hi everyone.

Once they have already helped me a lot in #22 about the UART protocol. Thank you so much.
I figured out all the necessary commands for my air conditioner except enabling / disabling the LED display.
There is a similar command in the original code, but doesn't work for me.
Based on the packet headers, protocol version 3 is used.

Can anyone help with this question? Thanks.

swing_mod can not be set, only read

I am surprised it works and its very good, thanks so much for your work
But I found one issue - swing_mod can not be set to any value

Interesting thing that I can do it via NetHome Plus app and when I read status using msmart
it shows actual value

Before setting
{'id': '6d2800000xxx', 'power_state': True, 'audible_feedback': False, 'target_temperature': 22, 'operational_mode': <operational_mode_enum.cool: 2>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 22.0, 'outdoor_temperature': 102.5}

Setting new values
After set of new values
{'id': '6d2800000xxx', 'power_state': True, 'audible_feedback': False, 'target_temperature': 22, 'operational_mode': <operational_mode_enum.cool: 2>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 22.0, 'outdoor_temperature': 102.5}

Read values set by NetHome Plus

python3  ~/lanAcControl.py
Before setting
{'id': '6d2800000xxx', 'power_state': True, 'audible_feedback': False, 'target_temperature': 22, 'operational_mode': <operational_mode_enum.cool: 2>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Vertical: 12>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 22.0, 'outdoor_temperature': 102.5}

My python script to set

from msmart.device import air_conditioning_device as ac
from msmart.device import device as midea_device
device_ip = '192.168.X.X'
device_id ='xxxxxxxxxxx'

client = midea_device(device_ip, int(device_id))
device = client.setup()

client = midea_device(device_ip, int(device_id))
device = client.setup()

#get AC info
def get_status():
    device.refresh()
    print({
        'id': device.id,
        'power_state': device.power_state,
        'audible_feedback': device.prompt_tone,
        'target_temperature': device.target_temperature,
        'operational_mode': device.operational_mode,
        'fan_speed': device.fan_speed,
        'swing_mode': device.swing_mode,
        'eco_mode': device.eco_mode,
        'turbo_mode': device.turbo_mode,
        'indoor_temperature': device.indoor_temperature,
        'outdoor_temperature': device.outdoor_temperature})


print("Before setting")
get_status()

print("\nSetting new values")
# Set the state of the device and test
device.power_state = True
device.target_temperature = 22
device.operational_mode = ac.operational_mode_enum.cool
#device.fan_speed = ac.fan_speed_enum.Auto
#device.swing_mode = ac.swing_mode_enum.Off
device.swing_mode = ac.swing_mode_enum.Vertical
device.apply()

print("After set of new values")
get_status()

msmart version

pip3 show msmart
Name: msmart
Version: 0.1.18
Summary: A library to control Midea appliances via the Local area network
Home-page: https://github.com/mac-zhou/midea-msmart-py
Author: mac_zhou
Author-email: [email protected]
License: UNKNOWN
Location: /home/hass/venv/lib/python3.7/site-packages
Requires:
Required-by:

Cant get python scripts to work.

Traceback (most recent call last): File "example.py", line 2, in <module> from msmart.device import device as midea_device File "/root/midea-msmart/msmart/device.py", line 17 def convert_device_id_hex(device_id: int):

Not sure ... midea-ac-py works fine with Home Assistant locally.

Also media-discover is unable to find any device at all when used on my x86 router

Timeout by getting response

Hi @mac-zhou,

I am very glad that you try to connect locally!
I try to connect with a normal python script with my comfee ac (Midea build)

When I try to connect I get always in lan.py line 40
response = sock.recv(512)
I get always an timeout.

2020-05-19 00:07:36,137 Finalize request data: aa20ac00000000000003410000ff03ff00020000000000000000000000000004e9
2020-05-19 00:08:02,701 Connect the Device 192.168.178.116:6444 TimeOut.

I checked my ac. IP and Port is open.

my script looks like this:

#!/usr/bin/env python3
from msmart.device import device as midea_device    

device_ip = "192.168.178.116"
device_id = "19791209312906"

client = midea_device(device_ip, int(device_id))
device = client.setup()
device.refresh()

Can you help me investigating?

easy use

Hello,

i try to use your local mode with the code from NeoAcheron in my own script. Function is like this (Wiki from NeoAcheron)

# Refresh the object with the actual state by querying it
device.refresh()
print({
    'id': device.id,
    'power_state': device.power_state,
    'audible_feedback': device.audible_feedback,
    'target_temperature': device.target_temperature,
    'operational_mode': device.operational_mode,
    'fan_speed': device.fan_speed,
    'swing_mode': device.swing_mode,
    'eco_mode': device.eco_mode,
    'turbo_mode': device.turbo_mode
})

# Set the state of the device and
device.power_state = True
device.audible_feedback = True
device.target_temperature = 21
device.operational_mode = ac.operational_mode_enum.auto
device.fan_speed = ac.fan_speed_enum.Auto
device.swing_mode = ac.swing_mode_enum.Off
device.eco_mode = False
device.turbo_mode = False
# commit the changes with apply()
device.apply()

i´ll geht all prints, but when i try to set new values with device.apply() they dont get into my AC..

Can you help me? my Code:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

from msmart.device import air_conditioning_device as ac
from msmart.device import device as midea_device
device_ip = '192.168.178.60'
device_id = '17592186057450'
    

client = midea_device(device_ip, int(device_id))
device = client.setup()

device.refresh()    
print({
    'id': device.id,
    #'name': device.name,
    'power_state': device.power_state,
    'audible_feedback': device.prompt_tone,
    'target_temperature': device.target_temperature,
    'operational_mode': device.operational_mode,
    'fan_speed': device.fan_speed,
    'swing_mode': device.swing_mode,
    'eco_mode': device.eco_mode,
    'turbo_mode': device.turbo_mode,
    'indoor_temperature': device.indoor_temperature,
    'outdoor_temperature': device.outdoor_temperature
    })

# Set the state of the device and
device.power_state = False
device.prompt_tone = False
device.target_temperature = 20
device.operational_mode = ac.operational_mode_enum.cool
device.fan_speed = ac.fan_speed_enum.Auto
device.swing_mode = ac.swing_mode_enum.Off
device.eco_mode = False
device.turbo_mode = False
device.apply()

log:

20.05 21:06 msmart.packet_builder DEBUG Finalize request data: aa20ac00000000000003410000ff03ff00020000000000000000000000000004e9
20.05 21:06 msmart.lan DEBUG Sending to 192.168.178.60:6444 5a5a011168002000000000000000000000000000ea32000000100000000000000000000000000000c7ec8e4276f8accc266a4648044169534ef900b4addf8808145b702d1c28520aec9d938eeaae3d871b99ce4b7e20a37bddb45a1aa884ea284866c4ca67537841.
20.05 21:06 msmart.lan DEBUG Received from 192.168.178.60:6444 5a5a011168002000000000000000000000000000ea32000000100000000000000000000000000000c7ec8e4276f8accc266a4648044169534ef900b4addf8808145b702d1c28520aec9d938eeaae3d871b99ce4b7e20a37bddb45a1aa884ea284866c4ca67537841.
20.05 21:06 msmart.device DEBUG refresh - Recieved from 192.168.178.60, ea3200000010: aa22ac00000000000303c00057667f7f00300000005e56000000000000000000e9d90b
20.05 21:06 msmart.command DEBUG Appliance response data: c00057667f7f00300000005e56000000000000000000e9d90b

but the values will not change...
i use the id i got from the script from NeoAcheron (MideaCloud)

[midea_ac -> msmart] home assistant error logs contains lots of throw errors.

2022-02-08 14:52:05 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.midea_ac_163827236973635 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 512, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 716, in async_device_update
raise exc
File "/config/custom_components/midea_ac/climate.py", line 133, in async_update
await self.hass.async_add_executor_job(self._device.refresh)
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 198, in refresh
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 120, in encode_8370
data = self.aes_cbc_encrypt(data, self._tcp_key) + sign
File "/usr/local/lib/python3.9/site-packages/msmart/security.py", line 57, in aes_cbc_encrypt
return AES.new(key, AES.MODE_CBC, iv=self.iv).encrypt(raw)
File "/usr/local/lib/python3.9/site-packages/Cryptodome/Cipher/AES.py", line 232, in new
return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/Cryptodome/Cipher/__init__.py", line 79, in _create_cipher
return modes[mode](factory, **kwargs)
File "/usr/local/lib/python3.9/site-packages/Cryptodome/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
cipher_state = factory._create_base_cipher(kwargs)
File "/usr/local/lib/python3.9/site-packages/Cryptodome/Cipher/AES.py", line 92, in _create_base_cipher
if len(key) not in key_size:
TypeError: object of type 'NoneType' has no len()

I guess maybe home assistant failed to communicate with air conditioner, the key got empty.

Discovery issue which looks like API login problem

Running midea-discover it looks like it find the device IPs but then never logs in to mapp.appsmb.com with or without my login credentials.

~ % midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:msmart.scanner:Broadcast message sent: 0
DEBUG:msmart.scanner:Midea Local Data 192.168.241.153 837000c8200f00005a5a0111b8007a80000000002c790e0b120c1514cd560400001c00000000000000000180000000001189237061b973a5db9cf33b2665f99b16918decdcc33dc1b76c771bb25f5bc269ce91f35d21acf13fe3e91b0d7b0af4ddc9baf7bbd19816b6c1d78d23c930c796dcd768309a5241ef793df3a18c1eb54346a5e8f0a189a98f970f4fe798401a4bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a1310661e9829603c16c25d5892f3c8f7b581178815c55a0e4d61828e5648747846edd
DEBUG:msmart.scanner:Decrypt Reply: 192.168.241.153 99f1a8c02c19000030303030303050303030303030305131433433393630433232453134303030300b6e65745f61635f324531340000870002000000000000000000ac00acac00000000c43960c22e14150029082115000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Midea Local Data 192.168.241.147 837000c8200f00005a5a0111b8007a800000000068790e0b120c151409570400001c00000000000000000180000000006fc3648b157d5a93e0516706cf3472e116ed60e4c0dd901bd269241d8aa0269c729c9d7169ced0192e3e3cd2a7719b6cee2e26ffd1fdf826d06ce835a24cf0adef01fe9d8a31dc05c9580b657e0ecf8d4346a5e8f0a189a98f970f4fe798401a4bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a131062e8598d8eb28d3dbaf42682195179d269bb72d28cba29dc17bd5ac95e3950690
DEBUG:msmart.scanner:Decrypt Reply: 192.168.241.147 93f1a8c02c19000030303030303050303030303030305131433433393630424435413534303030300b6e65745f61635f354135340000870002000000000000000000ac00acac00000000c43960bd5a54150029082115000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Midea Local Data 192.168.241.149 837000c8200f00005a5a0111b8007a80000000006d790e0b120c15140b940000001e00000000000000000180000000003bb725badbe3bb7409b922d461e3668a16ed60e4c0dd901bd269241d8aa0269c82d80bb99599ea022044731285350a5694d25f9a181614146bb92df49e50018c959f05d1d1a584be4664413ba5cec9564346a5e8f0a189a98f970f4fe798401a4bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a13106cdaacec713d309756c54840e60c7efb5527b420ee1b052d33f704beb8ac88905
DEBUG:msmart.scanner:Decrypt Reply: 192.168.241.149 95f1a8c02c19000030303030303050303030303030305131433433393630424435393634303030300b6e65745f61635f353936340000870002000000000000000000ac00acac00000000c43960bd5964150029082115000300000000000000000000000000000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Socket timeout
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"88936897-bac7-4695-bef7-3a2f0cf3a205"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"bb1e751b-cf90-4565-8da7-8852d5e4672a"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"7e97618c-53cc-4248-b0d2-1b108f3989f9"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"password error,please enter again.","errorCode":"3101"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"d97dd55f-bca2-46ed-9509-3744c3bf471a"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"password error,please enter again.","errorCode":"3101"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"a151a518-00bb-482a-959c-9ede0e7a2f3e"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"e93f99bbab57451f94d6628c4d6d4ed720211218111514780","accessToken":"2e226e468449e01a8464b8e4c9609651b920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"cce3a5bc-d4da-49bb-8c30-a3f5ba44c622"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"9046944ec8e24ee5be07864d8b930df620211218111518434","accessToken":"1314a086230d9956f3b7a9dd550d4653b920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"7bb0b877-671c-410b-9e4f-b66c79e9ffe5"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"714b6b0471cc4412b75cafcff047327720211218111522177","accessToken":"bdc0150e36e99eac6b7c1809ce1b1b8cb920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"3344d178-81f9-417b-87b2-813326a7e133"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"54d4ceb91c6a447182e3584fc358e3f020211218111525781","accessToken":"fff8a8795c7e36d500ccacb344c176b4b920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"4e518388-927a-4d8a-b7f8-83f30764d626"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"a24de91beb45494eaa96894a0d6317b520211218111529554","accessToken":"394be1d3a07874694be9e1446ee779f0b920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"17e71d2a-27a9-49f7-b603-1ee00d4e799b"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"3331440c20344437951f80b4775e675220211218111533212","accessToken":"cc7f5458000688f58f3d367ac0252190b920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login/id/get HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"loginId":"6256b323-4360-4fad-bb2f-f9c0e9422c1a"},"errorCode":"0"}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","result":{"originPrivateVersion":"","nickname":"[email protected]","sessionId":"9c04ff93538c4465a951e53e6e5df5a520211218111536920","accessToken":"5318031dc51bd6095fca39efa2847c77b920ebb829d567559397ded751813801","userId":"4826094","versionCode":"","leftCount":""},"errorCode":"0"}
DEBUG:msmart.cloud:Retrying API call: 'user/login'

Midea AC not discovered

I have Midea unit with EU-OSK 103 tongle. I also know IP address of the unit but i'm not able to discover it.
I also scanned that IP address, but all ports, including UDP ports, are closed.
Midea Oasis, 2021 year model.
Output:

% midea-discover -a MY-EMAIL -p MY_PWD -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Broadcast message sent: 0
DEBUG:msmart.scanner:Socket timeout

Discover don't work

Hello,

I have Midea AC (rebranded by Rotenso and app that is recommended by them: NetHome Plus - it work ok) , the dongle I have is: EU-OSK 103 .

Unfortunately discover don't find my AC at all 😢 , here is output:

pi@raspberrypi:~/midea/midea-msmart $ ./discover.py -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.24
INFO:msmart.cli:Sending Device Scan Broadcast...
pi@raspberrypi:~/midea/midea-msmart $

Since I know the IP that it gets from DHCP server I wanted to try "example" (just reading part for reading info) but I have no idea how to get the device_id . I do have the QR code in "human text format" (it's just some link with code - the code is 22 char long: 10 first chars is some number starting with "P" letter, last 12 chars is MAC address of wifi dongle) - it's possible to extract the device ID from that code - how long it should be? I also missing communication port (looking at code, seems it's "random" 🤔 , but I think by the morning I should know which are ports open 😅 ... nmap 💪 -> found: 6444/tcp port open only).

The discover.py script (I have written it because I did not want to install another python package):

#!/usr/bin/python3
import msmart.cli
msmart.cli.discover()

Add support for 空气能热水器 type = CD

PS C:\Users\xp\Desktop> midea-discover
INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
INFO:charset_normalizer:ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
INFO:charset_normalizer:ascii should target any language(s) of ['Latin Based']
INFO:charset_normalizer:We detected language [('English', 0.9474), ('Dutch', 0.9474), ('Italian', 0.9474)] using ascii
INFO:charset_normalizer:ascii is most likely the one. Stopping the process.
INFO:charset_normalizer:ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
INFO:charset_normalizer:ascii should target any language(s) of ['Latin Based']
INFO:charset_normalizer:We detected language [('English', 0.9474), ('Dutch', 0.9474), ('Italian', 0.9474)] using ascii
INFO:charset_normalizer:ascii is most likely the one. Stopping the process.
ERROR:msmart.security:authentication failed
INFO:charset_normalizer:ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
INFO:charset_normalizer:ascii should target any language(s) of ['Latin Based']
INFO:charset_normalizer:We detected language [('English', 0.9474), ('Dutch', 0.9474), ('Italian', 0.8947)] using ascii
INFO:charset_normalizer:ascii is most likely the one. Stopping the process.
INFO:charset_normalizer:ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
INFO:charset_normalizer:ascii should target any language(s) of ['Latin Based']
INFO:charset_normalizer:We detected language [('English', 0.9474), ('Dutch', 0.9474), ('Italian', 0.8947)] using ascii
INFO:charset_normalizer:ascii is most likely the one. Stopping the process.
INFO:msmart.lan:Got TCP key for 192.168.31.247:57613 -> 192.168.31.41:6444 retries: 0 time: 0.92 4317f49a66f15ae1aa09f9091cba610af35283f3cfcb5e94cfe6950e313422bd
INFO:msmart.cli:*** Found a device: {'type': 'cd', 'support': False, 'version': 3, 'ip': '192.168.31.41', 'id': 162727724647083, 'port': 6444, 'token': 'xxxxxxxxxxxxxxxx', 'key': 'xxxxxxxxxxxxxxxxx', 'ssid': 'midea_cd_0164'}

Can't install

Hello! Has error:

Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (40.8.0)
iobroker@iobroker-x64:~/ac/midea-msmart$ sudo python setup.py install
Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    import setuptools
ImportError: No module named setuptools
iobroker@iobroker-x64:~/ac/midea-msmart$
iobroker@iobroker-x64:~/ac/midea-msmart$ pip3 list
Package             Version  
------------------- ---------
asn1crypto          0.24.0   
bottle              0.12.15  
certifi             2018.8.24
chardet             3.0.4    
cryptography        2.6.1    
cupshelpers         1.0      
cycler              0.10.0   
distro-info         0.21     
docker              3.4.1    
docker-pycreds      0.3.0    
entrypoints         0.3      
Glances             3.1.0    
idna                2.6      
influxdb            5.2.0    
keyring             17.1.1   
keyrings.alt        3.1.1    
kiwisolver          1.0.1    
matplotlib          3.0.2    
netifaces           0.10.4   
numpy               1.16.2   
nyx                 2.1.0    
olefile             0.46     
Pillow              5.4.1    
pip                 18.1     
ply                 3.11     
psutil              5.5.1    
pyasn1              0.4.2    
pycairo             1.16.2   
pycrypto            2.6.1    
pycryptodomex       3.6.1    
pycups              1.9.73   
pycurl              7.43.0.2 
PyGObject           3.30.4   
pyparsing           2.2.0    
pysmi               0.3.2    
pysnmp              4.4.6    
pystache            0.5.4    
python-apt          1.8.4.1  
python-dateutil     2.7.3    
python-debian       0.1.35   
pytz                2019.1   
pyxdg               0.25     
PyYAML              3.13     
requests            2.21.0   
SecretStorage       2.3.1    
setuptools          40.8.0   
six                 1.12.0   
stem                1.7.1    
unattended-upgrades 0.1      
urllib3             1.24.1   
websocket-client    0.53.0   
wheel               0.32.3   

What i do wrong?

Error discovering my AC

I got unsupported with 0.1.23

INFO:msmart.cli:msmart version: 0.1.23
INFO:msmart.cli:Sending Device Scan Broadcast...
INFO:msmart.cli:Midea Local Data 192.168.178.43 837000b8200f04015a5a0111a8007a800000000000000000000000008126020000110000000000000000000000000000c02e7166e5735f1508fea049738712508a9bc49215bf2ce50d454809bbd0dfe131f32923d9ba7fe971a61e61c6a22316670379385506558205de66e0560a7228795351754443b1b25b8b8d247e4fcada1fca94541303884c52e880ddefc03190f31443d17c3aac03a7656614ae1dca4490e86c8e25ff86ad653c8986f4ec8c500c200a47a7a7f01493a692787032e193
INFO:msmart.cli:Decrypt Reply: 192.168.178.43 2bb2a8c02c19000030303030303050303030303030305131353032444242343646434443303030300b6e65745f61635f464344430000000001000000040000000000ac00000000000000502dbb46fcdc069fcd0300080103000000000000000000000000000000000000000000
INFO:msmart.lan:Couldn't connect with Device 192.168.178.43:6444
INFO:msmart.cli:*** Found a unsupported device - type: '0xac' - version: V3 - ip: 192.168.178.43 - port: 6444 - id: 1869xxxxxxxxxx - sn: 000000P0000000Q1502DBBxxxxxxxxxx - ssid: net_ac_FCDC

updated to latest 0.1.35 and got this:

INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
ERROR:msmart.security:authentication failed
ERROR:msmart.security:authentication failed
ERROR:msmart.security:authentication failed
Traceback (most recent call last):
  File "/home/pi/.local/bin/midea-discover", line 10, in <module>
    sys.exit(discover())
  File "/home/pi/.local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/cli.py", line 43, in discover
    found_devices = loop.run_until_complete(discovery.get_all())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/scanner.py", line 179, in get_all
    [self.result.add(task.result()) for task in tasks]
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/scanner.py", line 179, in <listcomp>
    [self.result.add(task.result()) for task in tasks]
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/scanner.py", line 47, in support_test
    await loop.run_in_executor(None, _device.refresh)
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/device.py", line 198, in refresh
    self._send_cmd(cmd)
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/device.py", line 208, in _send_cmd
    responses = self._lan_service.appliance_transparent_send_8370(data)
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/lan.py", line 136, in appliance_transparent_send_8370
    data = self.security.encode_8370(data, msgtype)
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/security.py", line 117, in encode_8370
    data = self.aes_cbc_encrypt(data, self._tcp_key) + sign
  File "/home/pi/.local/lib/python3.7/site-packages/msmart/security.py", line 57, in aes_cbc_encrypt
    return AES.new(key, AES.MODE_CBC, iv=self.iv).encrypt(raw)
  File "/usr/local/lib/python3.7/dist-packages/Cryptodome/Cipher/AES.py", line 232, in new
    return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/Cryptodome/Cipher/__init__.py", line 79, in _create_cipher
    return modes[mode](factory, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/Cryptodome/Cipher/_mode_cbc.py", line 274, in _create_cbc_cipher
    cipher_state = factory._create_base_cipher(kwargs)
  File "/usr/local/lib/python3.7/dist-packages/Cryptodome/Cipher/AES.py", line 92, in _create_base_cipher
    if len(key) not in key_size:
TypeError: object of type 'NoneType' has no len()

Device is a Dimstal brand and has worked fine so far using the cloud, but is somehow not even reachable via the midea app anymore currently. I can still ping it locally and I hoped I could control it locally via msmart. Any help is appreciated!

Can't retrieve indoor or outdoor temperature for MAW12V1QWT (U Inverter Window A/C)

Msmart returns 0 degress for both indoor and outdoor temperature. Also returns an incorrect target temperature:

{'id': '1d0a0100000d', 'name': '192.168.4.6', 'power_state': True, 'prompt_tone': False, 'target_temperature': 25, 'operational_mode': <operational_mode_enum.cool: 2>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 0.0, 'outdoor_temperature': 0.0}

This is passing through to hass in a strange way, as well:

image

With current temperature showing up incorrectly (probably by converting 0C to 32F) and showing a weird temperature set number.

SyntaxError: invalid syntax when running midea-discover

Hi @mac-zhou

I get the following error when I try and run midea-discover:

Traceback (most recent call last):
  File "/usr/local/bin/midea-discover", line 7, in <module>
    from msmart.cli import discover
  File "/usr/local/lib/python3.5/dist-packages/msmart/cli.py", line 3, in <module>
    import click
  File "/usr/local/lib/python3.5/dist-packages/click/__init__.py", line 7, in <module>
    from .core import Argument as Argument
  File "/usr/local/lib/python3.5/dist-packages/click/core.py", line 95
    f"{hint}. Command {base_command.name!r} is set to chain and"
                                                               ^
SyntaxError: invalid syntax

This is running as root on Ubuntu 16.04.7 LTS with Python 3.5.2, installed using pip3 install msmart.

Please can you advise?

V3 protocol support

Do you plan to support v3 control protocol in the future?


未来是否计划支持 v3 控制协议?试了一下我已有的新风机用的是 v3 协议的。

Found a unsupported device - type: '0xce' - version: V3 - ip: 10.42.240.134 - port: 6444

error

My terminal shows
截屏2022-01-25 上午9 54 04
How can I solve that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.