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

swing_mod can not be set, only read #10

Closed stamak closed 3 years ago

stamak commented 4 years ago

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: mac.zfl@gmail.com
License: UNKNOWN
Location: /home/hass/venv/lib/python3.7/site-packages
Requires:
Required-by:
mac-zhou commented 4 years ago

yes known issue. i will fix it later

mac_zhou

在 2020年6月15日,20:59,Stanislav Makar notifications@github.com 写道:



I am surprised it works and its very good 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': '6d2800000011', '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': '6d2800000011', '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': '6d2800000011', '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 verson

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: mac.zfl@gmail.com License: UNKNOWN Location: /home/hass/venv/lib/python3.7/site-packages Requires: Required-by:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mac-zhou/midea-msmart/issues/10, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4KC73YGDZXOTLSAIC3NNDRWYLLZANCNFSM4N6E43OA.

mac-zhou commented 3 years ago

Is it still like this now?