[miio] Add support for Xiaomi Fan 1X (new model?)

Hi,

I’m trying to get a Xiaomi Fan 1X to work with the miio binding.
As stated in the docs, this device should already be supported, but it is not, at least my fan does not work. Maybe I got a new version (I bought it in 2022). How to seperate the (maybe) different versions for future users?

The fan is recognized in OH as “dmaker.fan.p5”. Sadly, the channels were not working correctly.
I spent two evenings to get things together, this is my state:

I tinkered with the dmaker.fan.p5.json file so most of the values can be read (there were some errors).
Well, I’m still not able to send commands.

I’m trying to understand how to send commands with the binding.
It is possible to send a command to the custom channel like “s_power [True]” to turn the fan on, but how to configure the binding to do that - instead of “on/off”. I checked the file CommandParameterType.java and searched for sth like TRUEFALSE.

I wonder, why the p5 json does not work. As I was not successful with OH, I tried “python-miio” which worked right ootb. This commit was very helpful Add dmaker.fan.p5 support (#513) · rytilahti/python-miio@b1cb9b3 · GitHub
It is from 2019 so I ask myself, if there are really different verions out there

Does anyone know more about that and can provide some hints?

regards

Indeed the trick would be to make a dedicated dmaker.fan.p5.json.
I think I marked it supported as it seemed very close to the other fan models.

Unfortunately the json format is still undocumented… I have made some documentation for it, but so far never published it. Anyway, I think you were looking for"

So if I understood your post I expect the type needs to be ONOFFBOOL or ONOFFBOOLSTRING

so the relevant channel would be like this:

{
				"property": "power",
				"friendlyName": "Power",
				"channel": "power",
				"type": "Switch",
				"refresh": true,
				"actions": [
					{
						"command": "s_power",
						"parameterType": "ONOFFBOOL"
					}
				],
				"category": "switch",
				"tags": [
					"Switch"
				]
			},
1 Like

Hi, thanks for your fast response. That was exactly, what I was searching for, great!

I will test that thing and create a MR/PR for that, when the weather gets hotter.