Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for leshow.fan.ss4 (xiaomi Rosou SS4 Ventilator) #806

Closed
hilde0407 opened this issue Aug 30, 2020 · 31 comments · Fixed by #871
Closed

Support for leshow.fan.ss4 (xiaomi Rosou SS4 Ventilator) #806

hilde0407 opened this issue Aug 30, 2020 · 31 comments · Fixed by #871

Comments

@hilde0407
Copy link

hilde0407 commented Aug 30, 2020

Model: leshow.fan.ss4
Hardware version: esp32
Firmware version: 2.1.3

@hilde0407
Copy link
Author

Is no help available for this device?

@syssi
Copy link
Collaborator

syssi commented Nov 27, 2020

Do you like to provide some testing?

@hilde0407
Copy link
Author

Of course!

@syssi
Copy link
Collaborator

syssi commented Nov 27, 2020

Could you install this library and provide some responses of miiocli calls?

@hilde0407
Copy link
Author

I have already installed the python-miio and can send the answers from miiocli!

@hilde0407
Copy link
Author

miiocli airpurifier --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a info
Model: leshow.fan.ss4
Hardware version: esp32
Firmware version: 2.1.4
Network: {'localIp': '192.168.178.44', 'mask': '255.255.255.0', 'gw': '192.168.178.1'}
AP: {'ssid': 'Anja & Volker', 'bssid': '34:31:C4:43:A1:9F', 'rssi': -52, 'primary': 1}

@hilde0407
Copy link
Author

miiocli airpurifier --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a status
Error: Unable to parse message payload

@hilde0407
Copy link
Author

miiocli airpurifier --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a on
Powering on
['ok']

However, the fan does not start, but the display lights up with the number 0, i.e. fan off.

@syssi
Copy link
Collaborator

syssi commented Nov 27, 2020

Please try to retrieve the supported properties of the device:

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

Please try to explain the different meanings for the properties. Which modes are supported? What happens if "blow" is active? Does the device has key tones which can disabled and are off if sound is false and so on.

Try to control the following method via the miiocli:

set_power
set_mode
set_blow
set_timer
set_lamp
set_sound
set_yaw
get_device_status

It looks like the device is a miot device. This are the miot specs:

https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:leshow-ss4:1

Service: siid 2: (Fan): 4 props, 0 actions
  * Property piid: 1 (Switch Status): (bool, unit: None) (acc: ['read', 'write'], value-list: [], value-range: None)
  * Property piid: 2 (Fan Level): (uint8, unit: None) (acc: ['read', 'write'], value-list: [], value-range: [1, 100, 1])
  * Property piid: 3 (Horizontal Swing): (bool, unit: None) (acc: ['read', 'write'], value-list: [], value-range: None)
  * Property piid: 4 (Mode): (uint8, unit: None) (acc: ['read', 'write'], value-list: [{'value': 0, 'description': 'None'}, {'value': 1, 'description': 'Sleep'}, {'value': 2, 'description': 'Strong'}, {'value': 3, 'description': 'Natural Wind'}], value-range: None)
Service: siid 3: (Alarm): 1 props, 0 actions
  * Property piid: 0 (Alarm): (bool, unit: None) (acc: ['read', 'write'], value-list: [], value-range: None)

I will provide some concrete miiocli calls tomorrow for testing.

@syssi
Copy link
Collaborator

syssi commented Nov 27, 2020

Please provide the output of every command.

# try to turn the device on and off
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": True,"siid": 2,"piid": 1}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": False,"siid": 2,"piid": 1}]'

# try to change the fan speed
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 1,"siid": 2,"piid": 2}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 10,"siid": 2,"piid": 2}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 50,"siid": 2,"piid": 2}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 100,"siid": 2,"piid": 2}]'
# error?
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 101,"siid": 2,"piid": 2}]'

# enable/disable horizontal swing mode
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": True,"siid": 2,"piid": 3}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": False,"siid": 2,"piid": 3}]'

# switch operation modes
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 1,"siid": 2,"piid": 4}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 2,"siid": 2,"piid": 4}]'
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 3,"siid": 2,"piid": 4}]'
# errror?
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 4,"siid": 2,"piid": 4}]'


# Retrieve the different properties

# power
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 1}]'

# fan speed
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 2}]'

# swing mode
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 3}]'

# operation mode
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 4}]'

@hilde0407
Copy link
Author

hilde0407 commented Nov 28, 2020

I have executed all commands! No reaction at the fan:

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[0, 0, 0, 0, 1, 0, 0]

# try to turn the device on and off
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": True,"siid": 2,"piid": 1}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": True,"siid": 2,"piid": 1}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}
	
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": False,"siid": 2,"piid": 1}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": False,"siid": 2,"piid": 1}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

# try to change the fan speed
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 1,"siid": 2,"piid": 2}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 1,"siid": 2,"piid": 2}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 10,"siid": 2,"piid": 2}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 10,"siid": 2,"piid": 2}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 50,"siid": 2,"piid": 2}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 50,"siid": 2,"piid": 2}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 100,"siid": 2,"piid": 2}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 100,"siid": 2,"piid": 2}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}
# error?
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 101,"siid": 2,"piid": 2}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 101,"siid": 2,"piid": 2}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

# enable/disable horizontal swing mode
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": True,"siid": 2,"piid": 3}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": True,"siid": 2,"piid": 3}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": False,"siid": 2,"piid": 3}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": False,"siid": 2,"piid": 3}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

# switch operation modes
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 1,"siid": 2,"piid": 4}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 1,"siid": 2,"piid": 4}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 2,"siid": 2,"piid": 4}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 2,"siid": 2,"piid": 4}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 3,"siid": 2,"piid": 4}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 3,"siid": 2,"piid": 4}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}

# errror?
miiocli device --ip IP --token TOKEN raw_command set_properties '[{"value": 4,"siid": 2,"piid": 4}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_properties '[{"value": 4,"siid": 2,"piid": 4}]'
	Running command raw_command
	Error: {'code': -9999, 'message': 'user ack timeout'}


# Retrieve the different properties

# power
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 1}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_properties '[{"siid": 2,"piid": 1}]'
	Running command raw_command
	[{'did': '125182077', 'siid': 2, 'piid': 1, 'code': -4004}]

# fan speed
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 2}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_properties '[{"siid": 2,"piid": 2}]'
	Running command raw_command
	[{'did': '125182077', 'siid': 2, 'piid': 2, 'code': -4004}]

# swing mode
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 3}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_properties '[{"siid": 2,"piid": 3}]'
	Running command raw_command
	[{'did': '125182077', 'siid': 2, 'piid': 3, 'code': -4004}]

# operation mode
miiocli device --ip IP --token TOKEN raw_command get_properties '[{"siid": 2,"piid": 4}]'
	miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_properties '[{"siid": 2,"piid": 4}]'
	Running command raw_command
	[{'did': '125182077', 'siid': 2, 'piid': 4, 'code': -4004}]

@hilde0407
Copy link
Author

hilde0407 commented Nov 28, 2020

By the way, you can switch off the fan with this command! This works!

miiocli airpurifier --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a off
Powering off
['ok']
miiocli airpurifier --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a on
Powering on
['ok']

This command switches the fan on, but sets the speed to 0, so the motor will not start!

@syssi
Copy link
Collaborator

syssi commented Nov 28, 2020

Okay, lets play around with some miio commands. Try to retrieve all properties after each command to check something has changed:

# If True/False doesn't work please try 0 and 1 and "on" and "off"
miiocli device --ip IP --token TOKEN raw_command set_power "[False]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip IP --token TOKEN raw_command set_power "[True]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"


# sleep mode
miiocli device --ip IP --token TOKEN raw_command set_mode "[1]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# strong mode
miiocli device --ip IP --token TOKEN raw_command set_mode "[2]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# naturla mode
miiocli device --ip IP --token TOKEN raw_command set_mode "[3]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"


# fan speed 10%
miiocli device --ip IP --token TOKEN raw_command set_blow "[10]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# fan speed 50%
miiocli device --ip IP --token TOKEN raw_command set_blow "[50]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# fan speed 100%
miiocli device --ip IP --token TOKEN raw_command set_blow "[100]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# try to turn on and off the LED
miiocli device --ip IP --token TOKEN raw_command set_lamp "[True]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip IP --token TOKEN raw_command set_lamp "[False]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# try to turn on and off the buzzer
miiocli device --ip IP --token TOKEN raw_command set_sound "[True]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip IP --token TOKEN raw_command set_sound "[False]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# try to retrieve the device status whatever it is
miiocli device --ip IP --token TOKEN raw_command get_device_status "[]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

# try to enable the swing mode
miiocli device --ip IP --token TOKEN raw_command set_yaw "[True]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip IP --token TOKEN raw_command set_yaw "[False]"
miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

@hilde0407
Copy link
Author

Power On/ Off

miiocli device --ip IP --token TOKEN raw_command set_power "[False]" <--- False do not work and 0 is working

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_power "[0]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
	Running command raw_command
	[0, 0, 0, 0, 0, 0, 0]]

miiocli device --ip IP --token TOKEN raw_command set_power "[True]" <--- True do not work and 1 is working

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_power "[1]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 11, 0, 0, 0, 0]

sleep mode

miiocli device --ip IP --token TOKEN raw_command set_mode "[1]" <--- WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_mode "[1]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 1, 1, 0, 1, 0, 0]

strong mode

miiocli device --ip IP --token TOKEN raw_command set_mode "[2]" <--- WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_mode "[2]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 2, 100, 0, 1, 0, 0]

naturla mode

miiocli device --ip IP --token TOKEN raw_command set_mode "[3]" <--- WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_mode "[3]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 3, 55, 0, 1, 0, 0]

fan speed 10%

miiocli device --ip IP --token TOKEN raw_command set_blow "[10]" <--- WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_blow "[10]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 10, 0, 1, 0, 0]

fan speed 50%

miiocli device --ip IP --token TOKEN raw_command set_blow "[50]" <--- WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_blow "[50]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 50, 0, 1, 0, 0]

fan speed 100%

miiocli device --ip IP --token TOKEN raw_command set_blow "[100]" <--- WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_blow "[100]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 2, 100, 0, 1, 0, 0]

try to turn on and off the LED

miiocli device --ip IP --token TOKEN raw_command set_lamp "[True]" <--- NOT WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_lamp "[True]"
Running command raw_command
Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 10, 0, 1, 0, 0]

miiocli device --ip IP --token TOKEN raw_command set_lamp "[False]" <--- NOT WORKING

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_lamp "[False]"
Running command raw_command
Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 10, 0, 1, 0, 0]

try to turn on and off the buzzer

miiocli device --ip IP --token TOKEN raw_command set_sound "[True]" <--- True do not work and 1 is working

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_sound "[1]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 11, 0, 1, 0, 0]

miiocli device --ip IP --token TOKEN raw_command set_sound "[False]" <--- False do not work and 0 is working

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_sound "[0]"
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 11, 0, 0, 0, 0]

try to retrieve the device status whatever it is

miiocli device --ip IP --token TOKEN raw_command get_device_status "[]"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_device_status "[]"
Running command raw_command
Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 11, 0, 0, 0, 0]

try to enable the swing mode

miiocli device --ip IP --token TOKEN raw_command set_yaw "[True]" <--- True do not work and 1 is working

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_yaw "[1"]
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 11, 0, 0, 1, 0]

miiocli device --ip IP --token TOKEN raw_command set_yaw "[False]" <--- False do not work and 0 is working

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_yaw "[0"]
Running command raw_command
['ok']

miiocli device --ip IP --token TOKEN raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']"
Running command raw_command
[1, 0, 11, 0, 0, 0, 0]

@syssi
Copy link
Collaborator

syssi commented Nov 28, 2020

Last step: Could you try to control the LED (set_led) by 0 and 1. Does it work? It's missing at your post.

@hilde0407
Copy link
Author

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_lamp [0] Running command raw_command Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_led [0] Running command raw_command Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_led [1] Running command raw_command Error: {'code': -9999, 'message': 'user ack timeout'}

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_lamp [1] Running command raw_command Error: {'code': -9999, 'message': 'user ack timeout'}

@hilde0407
Copy link
Author

But

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_timer [120] Running command raw_command ['ok']

is working!

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command get_prop "['power', 'mode', 'blow', 'timer', 'sound', 'yaw', 'fault']" Running command raw_command [1, 0, 30, 120, 1, 0, 0]

@syssi
Copy link
Collaborator

syssi commented Nov 28, 2020

Perfect. It's possible to reset the timer by set_timer [0]?

@hilde0407
Copy link
Author

yes!

@hilde0407
Copy link
Author

Why does it not work?

miiocli device --ip 192.168.178.44 --token 2312f9556355a647d717cc38fba3641a raw_command set_prop [1,4,30,60,0,1,0]

@syssi
Copy link
Collaborator

syssi commented Nov 28, 2020

Could you try to find the upper bound of the timer? 100 minutes? 999 minutes? The device firmware doesn't support/know a ´set_prop` command.

syssi added a commit to syssi/python-miio that referenced this issue Nov 28, 2020
@syssi
Copy link
Collaborator

syssi commented Nov 28, 2020

I've implemented a first draft:

$ miiocli fanleshow
Usage: miiocli fanleshow [OPTIONS] COMMAND [ARGS]...

Options:
  --ip TEXT     [required]
  --token TEXT  [required]
  --help        Show this message and exit.

Commands:
  delay_off      Set delay off minutes.
  info           Get miIO protocol information from the device.
  off            Power off.
  on             Power on.
  raw_command    Send a raw command to the device.
  set_buzzer     Set buzzer on/off.
  set_mode       Set mode.
  set_oscillate  Set oscillate on/off.
  set_speed      Set natural level.
  status         Retrieve properties.

@hilde0407
Copy link
Author

The highest value is 540

@hilde0407
Copy link
Author

Thank you so much!

@syssi syssi added the miio label Nov 28, 2020
@hilde0407
Copy link
Author

One last question! How can I install the new version? I have tried pip3 install phyton-miio, previously uninstall. But I can't choose the new device yet?

Thanks again!

Volker

@syssi
Copy link
Collaborator

syssi commented Nov 28, 2020

I prepared a pull request. As soon the PR is merged and a new version of python-miio is release the new device will be available. You could download my feature branch and install this development version by pip install . (the dot indicates the current directory). @rytilahti do you have an better approach to install a feature branch?

@rytilahti
Copy link
Owner

rytilahti commented Nov 28, 2020

Alas, no.

Here's a flow I usually use for testing (requires git-extras installation: https://github.com/tj/git-extras/blob/master/Installation.md):

git clone https://github.com/rytilahti/python-miio.git  # clone this repository
git pr 871  # get the given PR
poetry install 

and then using poetry run to execute the miiocli (as poetry creates a separate virtual environment during install):

$ poetry run miiocli fanleshow
Usage: miiocli fanleshow [OPTIONS] COMMAND [ARGS]...

Options:
  --ip TEXT     [required]
  --token TEXT  [required]
  --help        Show this message and exit.

Commands:
  delay_off      Set delay off minutes.
  info           Get miIO protocol information from the device.
  off            Power off.
  on             Power on.
  raw_command    Send a raw command to the device.
  set_buzzer     Set buzzer on/off.
  set_mode       Set mode.
  set_oscillate  Set oscillate on/off.
  set_speed      Set a speed level between 0 and 100.
  status         Retrieve properties.

@hilde0407
Copy link
Author

Many thanks for the instructions! I am not that deep into the matter! I just wanted to get the fan running with the IOBroker! Fortunately this is now possible!

Many thanks again!

@syssi
Copy link
Collaborator

syssi commented Nov 29, 2020

@hilde0407 Thanks for you support!

@djmalin
Copy link

djmalin commented Dec 1, 2020

hello @syssi can you add this working code for integration (Xiaomi Mi Air Purifier & Xiaomi Mi Air Humidifier) with HACS?

@syssi
Copy link
Collaborator

syssi commented Dec 1, 2020

@djmalin Just track the progress here: syssi/xiaomi_airpurifier#112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants