Issue found.
Please update the custom component.
OK speed works now child lock error
AttributeError: ‘Fan’ object has no attribute ‘set_child_lock’
2018-04-14 19:45:56 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-04-14 19:46:16 DEBUG (SyncWorker_16) [miio.device] 10.0.50.4:54321 >>: {‘id’: 113, ‘method’: ‘get_prop’, ‘params’: [‘power’, ‘bright’, ‘cct’, ‘snm’, ‘dv’]}
2018-04-14 19:46:16 DEBUG (SyncWorker_10) [miio.device] 10.0.50.2:54321 >>: {‘id’: 113, ‘method’: ‘get_prop’, ‘params’: [‘power’, ‘bright’, ‘cct’, ‘snm’, ‘dv’]}
2018-04-14 19:46:16 DEBUG (SyncWorker_19) [miio.device] 10.0.100.1:54321 >>: {‘id’: 117, ‘method’: ‘get_prop’, ‘params’: [‘power’]}
2018-04-14 19:46:16 DEBUG (SyncWorker_2) [miio.device] 10.0.100.1:54321 >>: {‘id’: 214, ‘method’: ‘get_prop’, ‘params’: [‘temp_dec’, ‘humidity’, ‘angle’, ‘speed’, ‘poweroff_time’, ‘power’, ‘ac_power’, ‘battery’, ‘angle_enable’, ‘speed_level’, ‘natural_level’, ‘child_lock’, ‘buzzer’, ‘led_b’, ‘led’]}
2018-04-14 19:46:16 DEBUG (SyncWorker_5) [miio.device] 10.0.50.3:54321 >>: {‘id’: 109, ‘method’: ‘get_prop’, ‘params’: [‘power’, ‘bright’, ‘cct’, ‘snm’, ‘dv’]}
2018-04-14 19:46:16 DEBUG (SyncWorker_10) [miio.device] 10.0.50.2:54321 (ts: 1970-01-01 03:44:33, id: 113) << {‘result’: [‘on’, 15, 1, 0, 0], ‘id’: 113}
2018-04-14 19:46:16 DEBUG (SyncWorker_16) [miio.device] 10.0.50.4:54321 (ts: 1970-01-01 03:44:25, id: 113) << {‘result’: [‘on’, 25, 1, 0, 0], ‘id’: 113}
2018-04-14 19:46:16 DEBUG (SyncWorker_2) [miio.device] 10.0.100.1:54321 (ts: 1970-01-08 04:49:07, id: 214) << {‘result’: [258, 72, 118, 367, 0, ‘on’, ‘on’, 100, ‘on’, 15, 42, ‘off’, ‘on’, 0, None], ‘id’: 214}
2018-04-14 19:46:16 DEBUG (SyncWorker_19) [miio.device] 10.0.100.1:54321 (ts: 1970-01-08 04:49:07, id: 117) << {‘result’: [‘on’], ‘id’: 117}
2018-04-14 19:46:16 DEBUG (SyncWorker_5) [miio.device] 10.0.50.3:54321 (ts: 1970-01-01 08:32:31, id: 109) << {‘result’: [‘off’, 100, 100, 0, 0], ‘id’: 109}
2018-04-14 19:46:16 DEBUG (MainThread) [custom_components.fan.xiaomi_miio_fan] Got new state: <FanStatus power=on, temperature=25.8, humidity=72, led=False, led_brightness=LedBrightness.Bright buzzer=True, child_lock=False, natural_level=42, speed_level=15, oscillate=True, battery=100, ac_power=True, poweroff_time=0, speed=15, angle=118
2018-04-14 19:46:16 DEBUG (SyncWorker_4) [miio.device] 10.0.100.1:54321 >>: {‘id’: 118, ‘method’: ‘miIO.info’, ‘params’: []}
Child lock and buzzer is broken by design and will be fixed in python-miio >0.3.9.
ok,
so what else did you want to know?
Take a look at the platform services: https://github.com/syssi/xiaomi_fan#platform-services
Please test:
-
fan.oscillate
{"oscillating":true}
/{"oscillating":false}
It’s possible the turning on doesn’t work because the oscillation angle is unknown. The Mi Home app turns the oscillation on by set_angle(30) f.e. and only uses the method above to disable the oscillation. -
fan.set_direction
{"direction":"left"}
/{"direction":"right"}
Does the fan move left/right? It’s required to turn of the oscillation beforehand? Does the service work fine if oscillation is enabled? -
fan.xiaomi_miio_set_oscillation_angle
{"angle": 30}
/{"angle": 60}
/{"angle": 90}
/{"angle": 120}
What happens if you use other values like: {“angle”: 0}, {“angle”: 1}, {“angle”: 15} and {“angle”: 130}? Please provide the homeassistant.log. -
fan.xiaomi_miio_set_natural_mode_on
/fan.xiaomi_miio_set_natural_mode_off
Does this service work fine? Please check the “natural_speed” attribute. Is the values stable or does it change over time (+/- a few values) -
fan.xiaomi_miio_set_led_brightness
{"brightness": 0}
/{"brightness": 1}
/{"brightness": 2}
Are you able to control the led brightness? -
fan.set_speed
{speed: 0}
/{speed: 1}
/{speed: 10}
/{speed: 100}
/{speed: 110}
Next to “Level 1…4” it should also be possible to provide an integer (0…100). What happens if you set the speed to a value of “0”? Does the device turn off? What’s the response of the device for values like 0, 1, 10, 100, 110?
Sorry I have been away for work for a few days might be able to help again tomorrow.
Did you guys manage to advance on this? Got a fan in the mail. Will be happy to help once it reaches me…
I would like to complete this component but I’m stuck without support.
@syssi I’m happy to help test. I have the same Xiaomi Smart-Fan (previously working via HomeBridge) and am in the process of transitioning to Home Assistant on a Raspberry Pi 3 (Model B).
Total newbie here to Hass.IO though, so bare with me! Tried to enable following the GitHub directions linked above, but get the following error:
starting version 3.2.4
Testing configuration at /config
Failed config
General Errors:
- Platform not found: fan.xiaomi_miio_fan
Successful config (partial)
Is there a way I can test my Token Key? I had saved (and working) from my Homebridge installation, but it might have changed? (Unsure how they work).
The fan isn’t officially supported by HA. You’ve to download/use this custom component:
https://developers.home-assistant.io/docs/en/creating_component_loading.html
Okay great, thank you! I have it working now (with a new token), and it’s responding as expected within HA.
Some observations:
- No ability to move the fan head left/right, as you can natively in the MiHome App
- Speed controls work in 4-steps. Possible to make this % based? Using Homebridge you could control the fan from 0-100% speed which was very useful
- Temperature/Humidity readings appear to be working
- Cannot control the oscillate angle (ie; only oscillate 60°, or 90°, etc)
What would you like me to test? Next step for me is to see how it translates using HA’s built-in Homebridge now, so I can add as a HomeKit accessory via my iPhone.
Are you aware of the services in Home Assistant? There are some feature which are controllable by some services and aren’t visible at the UI. The services are mentioned here:
The set_speed
service accepts individual fan speeds f.e.
@jimpower I am thinking about buying this fan myself. Do you have any information on its standby power consumption. This site (https://www.techreviewer.de/xiaomi-standventilator-test/) is reporting 8,76 watts in standby mode. Can you confirm this?
To be honest I’m not sure, I have this fan plugged into a smart power strip and have that strip turned off during the day it is only powered for 2 hours overnight to charge the fan vaccum and mop. The fan has a battery which I have run for over 2 hours without it running out.
That is what I would do as well. But if you turn off the socket, it is still draining the battery isn`t it? That is why I am concerned about the standby power consumption.
Any change you could measure the standby power consumption?
Certainly I’ll set it up over the weekend and let you know.
If the device is on mains power in standby it stays connected to wifi and if on battery it turns off wifi this may save on standby power consumed. I’ll test for 24hours on both for you.