Xiaomi Humidifier support

Thanks @bezkod for the initial work. I didn’t know your custom_component and did the same like you as proof of concept:

If the component works fine I will merge the code into fan/xiaomi_miio soon in order to support the Xiaomi Air Humidifier officially in future.

1 Like

@bezkod Our code differs in one feature: Is the LED of the Air Humidifier controllable? Did you remove set_led_on and set_led_off on purpose? Could someone (@af950833, @itchaboy) test all exposed services of the component? Thanks in advance!

Another request: Could someone provide the output of following mirobo (cli, part of python-miio) calls for the air humidifier:

# ip and token needs to be adapted

bin/mirobo --ip 192.168.1.71 --token 3d5f7ae53b51aa312e464b150b37453b -d info

bin/mirobo --ip 192.168.1.71 --token 3d5f7ae53b51aa312e464b150b37453b get_prop '["power", "mode", "temp_dec", "humidity", "buzzer","led_b", "led"]'

how do I go about adding a custom component? Would I add the following folder to my config folder? custom_components/fan/custom_component.py

(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba -d info
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {‘seq’: 2, ‘manual_seq’: 0}
DEBUG:miio.vacuum_cli:Connecting to 192.168.0.25 with token 689c4056fe28ebb3a2e8c2fe350e51ba
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b’’
DEBUG:miio.device:Got a response: Container:
data = Container:
length = 0
value = (total 0)
offset2 = 32
offset1 = 32
data = (total 0)
header = Container:
length = 16
value = Container:
length = 32
unknown = 0
device_id = 047c3fd9 (total 8)
ts = 1970-01-07 15:54:21
offset2 = 16
offset1 = 0
data = !1\x00 \x00\x00\x00\x00\x04|?\xd9\x00\x08\xc8\xad (total 16)
checksum = h\x9c@V\xfe(\xeb\xb3\xa2\xe8\xc2\xfe5\x0eQ\xba (total 16)
DEBUG:miio.device:Discovered b’047c3fd9’ with ts: 1970-01-07 15:54:21, token: b’689c4056fe28ebb3a2e8c2fe350e51ba’
DEBUG:miio.device:192.168.0.25:54321 >>: {‘method’: ‘miIO.info’, ‘params’: [], ‘id’: 3}
DEBUG:miio.device:192.168.0.25:54321 (ts: 1970-01-07 15:54:21, id: 3) << {‘id’: 3, ‘result’: {‘fw_ver’: ‘1.2.9_5033’, ‘token’: ‘689c4056fe28ebb3a2e8c2fe350e51ba’, ‘otu_stat’: [101, 74, 5343, 0, 5327, 407], ‘mmfree’: 228248, ‘netif’: {‘gw’: ‘192.168.0.1’, ‘localIp’: ‘192.168.0.25’, ‘mask’: ‘255.255.255.0’}, ‘ott_stat’: [0, 0, 0, 0], ‘model’: ‘zhimi.humidifier.v1’, ‘cfg_time’: 0, ‘life’: 575661, ‘ap’: {‘rssi’: -35, ‘ssid’: ‘Tommy’, ‘bssid’: ‘AC:9E:17:A1:DF:F8’}, ‘wifi_fw_ver’: ‘SD878x-14.76.36.p84-702.1.0-WM’, ‘hw_ver’: ‘MW300’, ‘ot’: ‘otu’, ‘mac’: ‘78:11:DC:8E:00:E7’}}
zhimi.humidifier.v1 v1.2.9_5033 (78:11:DC:8E:00:E7) @ 192.168.0.25 - token: 689c4056fe28ebb3a2e8c2fe350e51ba
DEBUG:miio.vacuum_cli:Full response: {‘ap’: {‘bssid’: ‘AC:9E:17:A1:DF:F8’, ‘rssi’: -35, ‘ssid’: ‘Tommy’},
‘cfg_time’: 0,
‘fw_ver’: ‘1.2.9_5033’,
‘hw_ver’: ‘MW300’,
‘life’: 575661,
‘mac’: ‘78:11:DC:8E:00:E7’,
‘mmfree’: 228248,
‘model’: ‘zhimi.humidifier.v1’,
‘netif’: {‘gw’: ‘192.168.0.1’,
‘localIp’: ‘192.168.0.25’,
‘mask’: ‘255.255.255.0’},
‘ot’: ‘otu’,
‘ott_stat’: [0, 0, 0, 0],
‘otu_stat’: [101, 74, 5343, 0, 5327, 407],
‘token’: ‘689c4056fe28ebb3a2e8c2fe350e51ba’,
‘wifi_fw_ver’: ‘SD878x-14.76.36.p84-702.1.0-WM’}
DEBUG:miio.vacuum_cli:Writing {‘seq’: 3, ‘manual_seq’: 0} to /tmp/python-mirobo.seq
(homeassistant) homeassistant@Tommy:/home/pi $
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“power”, “mode”, “temp_dec”, “humidity”, “buzzer”,“led_b”, “led”]’
Sending cmd get_prop with params [‘power’, ‘mode’, ‘temp_dec’, ‘humidity’, ‘buzzer’, ‘led_b’, ‘led’]
[‘off’, ‘high’, 294, 33, ‘on’, 0, None]
(homeassistant) homeassistant@Tommy:/home/pi $

“”"
Support for Xiaomi Mi Air Humidifier

“”"
import asyncio
from functools import partial
import logging
import os

import voluptuous as vol

from homeassistant.helpers.entity import ToggleEntity
from homeassistant.components.fan import (FanEntity, PLATFORM_SCHEMA,
SUPPORT_SET_SPEED, DOMAIN)
from homeassistant.config import load_yaml_config_file
from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_TOKEN,
ATTR_ENTITY_ID, )
from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv

_LOGGER = logging.getLogger(name)

DEFAULT_NAME = ‘Xiaomi Air Humidifier’
PLATFORM = ‘xiaomi_airhumidifier’

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_TOKEN): vol.All(cv.string, vol.Length(min=32, max=32)),
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})

REQUIREMENTS = [‘python-miio==0.3.3’]

ATTR_TEMPERATURE = ‘temperature’
ATTR_HUMIDITY = ‘humidity’
ATTR_MODE = ‘mode’

SUCCESS = [‘ok’]

pylint: disable=unused-argument

@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
“”“Set up the air humidifier from config.”""
from miio import AirHumidifier, DeviceException
if PLATFORM not in hass.data:
hass.data[PLATFORM] = {}

host = config.get(CONF_HOST)
name = config.get(CONF_NAME)
token = config.get(CONF_TOKEN)

_LOGGER.info("Initializing with host %s (token %s...)", host, token[:5])

try:
    air_humidifier = AirHumidifier(host, token)

    xiaomi_air_humidifier = XiaomiAirHumidifier(name, air_humidifier)
    hass.data[PLATFORM][host] = xiaomi_air_humidifier
except DeviceException:
    raise PlatformNotReady

async_add_devices([xiaomi_air_humidifier], update_before_add=True)

class XiaomiAirHumidifier(FanEntity):
“”“Representation of a Xiaomi Air Humidifier.”""

def __init__(self, name, air_humidifier):
    """Initialize the air humidifier."""
    self._name = name

    self._air_humidifier = air_humidifier
    self._state = None
    self._state_attrs = {
        ATTR_TEMPERATURE: None,
        ATTR_HUMIDITY: None,
        ATTR_MODE: None,
    }

@property
def supported_features(self):
    """Flag supported features."""
    return SUPPORT_SET_SPEED

@property
def should_poll(self):
    """Poll the fan."""
    return True

@property
def name(self):
    """Return the name of the device if any."""
    return self._name

@property
def available(self):
    """Return true when state is known."""
    return self._state is not None

@property
def device_state_attributes(self):
    """Return the state attributes of the device."""
    return self._state_attrs

@property
def is_on(self):
    """Return true if fan is on."""
    return self._state

@asyncio.coroutine
def _try_command(self, mask_error, func, *args, **kwargs):
    """Call a air humidifier command handling error messages."""
    from miio import DeviceException
    try:
        result = yield from self.hass.async_add_job(
            partial(func, *args, **kwargs))

        _LOGGER.debug("Response received from air humidifier: %s", result)

        return result == SUCCESS
    except DeviceException as exc:
        _LOGGER.error(mask_error, exc)
        return False

@asyncio.coroutine
def async_turn_on(self: ToggleEntity, speed: str=None, **kwargs) -> None:
    """Turn the fan on."""
    if speed:
        # If operation mode was set the device must not be turned on.
        yield from self.async_set_speed(speed)
        return

    yield from self._try_command(
        "Turning the air humidifier on failed.", self._air_humidifier.on)

@asyncio.coroutine
def async_turn_off(self: ToggleEntity, **kwargs) -> None:
    """Turn the fan off."""
    yield from self._try_command(
        "Turning the air humidifier off failed.", self._air_humidifier.off)

@asyncio.coroutine
def async_update(self):
    """Fetch state from the device."""
    from miio import DeviceException

    try:
        state = yield from self.hass.async_add_job(
            self._air_humidifier.status)
        _LOGGER.debug("Got new state: %s", state)

        self._state = state.is_on
        self._state_attrs = {
            ATTR_TEMPERATURE: state.temperature,
            ATTR_HUMIDITY: state.humidity,
            ATTR_MODE: state.mode.value
        }

    except DeviceException as ex:
        _LOGGER.error("Got exception while fetching the state: %s", ex)

@property
def speed_list(self: ToggleEntity) -> list:
    """Get the list of available speeds."""
    from miio.airhumidifier import OperationMode
    return [mode.name for mode in OperationMode]

@property
def speed(self):
    """Return the current speed."""
    if self._state:
        from miio.airhumidifier import OperationMode

        return OperationMode(self._state_attrs[ATTR_MODE]).name

    return None

@asyncio.coroutine
def async_set_speed(self: ToggleEntity, speed: str) -> None:
    """Set the speed of the fan."""
    _LOGGER.debug("Setting the operation mode to: " + speed)
    from miio.airhumidifier import OperationMode

    yield from self._try_command(
        "Setting operation mode of the air humidifier failed.",
        self._air_humidifier.set_mode, OperationMode[speed])

from HA 0.61.0 the servicess are not working, so I removed all service in the code and using upper code as custom_components.
Also I wanna let you know that there is no LED Brigtness in Air Purifier Pro. I am also using it after removing the service"LED Brightness" in HA 0.61.1

It looks like there is not attribute “led_b” or “led” for the Air Humidifier. Could you execute this two commands for testing:

mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["power", "mode", "temp_dec", "humidity", "buzzer","led"]'
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["power", "mode", "temp_dec", "humidity", "buzzer","led_b"]'

One of the outputs will contain a “null” value.

Just copy the file

https://raw.githubusercontent.com/syssi/xiaomi_airhumidifier/master/custom_components/fan/xiaomi_airhumidifier.py

to custom_components/fan/xiaomi_airhumidifier.py and add the configuration to your

# configurations.yaml

fan:
  - platform: xiaomi_airhumidifier
    name: Xiaomi Air Humidifier
    host: 192.168.130.71
    token: b7c4a758c251955d2c24b1d9e41ce47d

pi@Tommy:~ $ sudo su -s /bin/bash homeassistant
homeassistant@Tommy:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“power”, “mode”, “temp_dec”, “humidity”, “buzzer”,“led”]’
Sending cmd get_prop with params [‘power’, ‘mode’, ‘temp_dec’, ‘humidity’, ‘buzzer’, ‘led’]
[‘off’, ‘high’, 268, 37, ‘on’, None]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“power”, “mode”, “temp_dec”, “humidity”, “buzzer”,“led_b”]’
Sending cmd get_prop with params [‘power’, ‘mode’, ‘temp_dec’, ‘humidity’, ‘buzzer’, ‘led_b’]
[‘off’, ‘high’, 268, 37, ‘on’, 0]
(homeassistant) homeassistant@Tommy:/home/pi $

In the Xiaomi App’s Air Humidifier, there is no LED on/off but there is the LED brightness.
In the LED brightness, 2 is off, 1 is Dim light and 0 is Bright light.
I used it as a sevice in HA 0.60.1 and it worked well.

Perfect! I updated the component.

I always thank you :slight_smile:

Your screenshots are showing some missing features:

  1. Target humidity
  2. Sounds (Volume?)
  3. Parental controls

We can extend the component if you provide some further testing. :slight_smile:

I miscommented for LED level.
2 is off, 1 is Dim light and 0 is Bright light.(These are corrent)

What test do I have to do for extend component?
Please let me know it and I will follow it up~

Please provide the feedback of:

# target humidity?
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["limit_hum"]'
# parental controls?
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["child_lock"]'
# sounds?
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["volume"]'

pi@Tommy:~ $ sudo su -s /bin/bash homeassistant
homeassistant@Tommy:/home/pi $ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@Tommy:/home/pi $ # target humidity?
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“limit_hum”]’

parental controls?

mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“child_lock”]’

sounds?

(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“limit_hum”]’
Sending cmd get_prop with params [‘limit_hum’]
[40]
(homeassistant) homeassistant@Tommy:/home/pi $ # parental controls?
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“child_lock”]’
Sending cmd get_prop with params [‘child_lock’]
[‘off’]
(homeassistant) homeassistant@Tommy:/home/pi $ # sounds?
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“volume”]’
Sending cmd get_prop with params [‘volume’]
[None]
(homeassistant) homeassistant@Tommy:/home/pi $

if you need more, pls let me konw it.

Okay. We are able to retrieve the child_lock and target humidity. Could you try to change the values by:


# error
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[30]'
# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[40]'
# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[50]'
# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[60]'
# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[70]'
# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[80]'
# error
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[90]'

# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_child_lock '["on"]'
# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_child_lock '["off"]'

What’s the response? I found another property I’m interested in:

mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

Do you know the meaning of trans_level? Does this value show up at the MiHome app?

(homeassistant) homeassistant@Tommy:/home/pi $ # error
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[30]’
ERROR:miio.vacuum_cli:Unable to read the stored msgid: [Errno 2] No such file or directory: ‘/tmp/python-mirobo.seq’
Sending cmd set_limit_hum with params [30]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[40]’
Sending cmd set_limit_hum with params [40]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[50]’
Sending cmd set_limit_hum with params [50]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[60]’
Sending cmd set_limit_hum with params [60]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[70]’
Sending cmd set_limit_hum with params [70]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[80]’
Sending cmd set_limit_hum with params [80]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # error
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[90]’
Sending cmd set_limit_hum with params [90]
{‘id’: 7, ‘error’: {‘message’: ‘invaild_arg’, ‘code’: -5001}}
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_child_lock ‘[“on”]’
Sending cmd set_child_lock with params [‘on’]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_child_lock ‘[“off”]’
Sending cmd set_child_lock with params [‘off’]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[30]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[55]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[85]

Although limit_hum 30 is OK, there is no change in Mi Home app because there is no 30% for target.
And child lock’s name in the Mi Home is “parental controls”
The trans_level is the speed.(right side of power button in Mi Home)
Speed 1 - trans_level 30
Speed 2 - trans_level 55
Speed 3 - trans_level 85

Can we control the trans_level?

# error
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level '[10]'
# what's the new value?
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level '[30]'
# 30
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

# error
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level '[45]'
# 45? vs. no change
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level '[55]'
# 55
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level '[85]'
# 85
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

# ok
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level '[95]'
# 95 vs. no change
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["trans_level"]'

And can you explain the correlation between “Speed” and “Operation Mode” (Auto, Silent, Favorite)? Speed it’s something like the favorite level of the Air Purifier, right? It affects the Operation Mode “Favorite” only.

Another question: If you set the target humidity to 30 by

mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum '[30]'

Does the property “limit_hum” return the correct value (30) afterwards?

# should return 30
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop '["limit_hum"]'

@af950833 Ping? :wink:

No, we can’t control the trans level.

(homeassistant) homeassistant@Tommy:/home/pi $ # error
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level ‘[10]’
Sending cmd set_trans_level with params [10]
{‘error’: {‘code’: -32601, ‘message’: ‘Method not found.’}, ‘id’: 5}
(homeassistant) homeassistant@Tommy:/home/pi $ # what’s the new value?
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[85]
(homeassistant) homeassistant@Tommy:/home/pi $ # ok
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_trans_level ‘[30]’
Sending cmd set_trans_level with params [30]
{‘error’: {‘code’: -32601, ‘message’: ‘Method not found.’}, ‘id’: 7}
(homeassistant) homeassistant@Tommy:/home/pi $ # 30
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[85]
(homeassistant) homeassistant@Tommy:/home/pi $

The below is the trans level of Speed 1, 2 and 3.
Speed 2 is 50 or 55 & Speed 3 is 80 or 85(I don’t know the deference)

(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[30]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[50]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“trans_level”]’
Sending cmd get_prop with params [‘trans_level’]
[80]

The mode is same with the speed. The speed of Humidifier is diferent with Air Purifier. There is no favorite level in Humidifier.

Mi Home : Speed 1 - Speed 2 - Speed 3
Python-miio : Silent - Medium - High (Operation Mode)
(Speed is same with the mode)

(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command set_limit_hum ‘[30]’
Sending cmd set_limit_hum with params [30]
[‘ok’]
(homeassistant) homeassistant@Tommy:/home/pi $ mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command get_prop ‘[“limit_hum”]’
Sending cmd get_prop with params [‘limit_hum’]
[30]
(homeassistant) homeassistant@Tommy:/home/pi $

The limit_hum 30 returned correct value but It was not reflected in the MI Home (bcz there is no 30% icon)
The current humidity of my home is 36% and the Humidifier is on state.
When I sent raw_command set_limit_hum ‘[30]’, the Humidifier was turned off.
I think that limit_hum 30 is working properly but it just doesn’t have own icon in the Mi Home App.

Did I understand it correctly: The trans_level changes if you change the operation mode?