Xiaomi Robot Vacuum Binding

Hello @marcel_verpaalen,

thank you very much for the great binding. I use it with several products and it works very reliably.

I have now bought a Qingping Air Monitor Lite (cgllc.airm.cgdn1) and would like to integrate it. This is not yet supported by the binding if I see it correctly. It also seems to work differently than cgllc.airmonitor.b1 or cgllc.airmonitor.s1, because it did not work to overwrite the model in the paper UI with cgllc.airmonitor.s1 or cgllc.airmonitor.b1.

Now I tried creating a cgllc.airm.cgdn1.json in the openhab configuration under ./misc/miio. I can see the file is used, because openhab creates the channels accordingly. Unfortunately no values arrive in the channels…

With a bit of googling I found that python-miio (GitHub - rytilahti/python-miio: Python library & console tool for controlling Xiaomi smart appliances) already supports the Qingping Air Monitor Lite (cgllc.airm.cgdn1). Here are the corresponding commits Add Qingping Air Monitor Lite support (cgllc.airm.cgdn1) (#900) · rytilahti/python-miio@78f8bee · GitHub

The Miot specs: https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:air-monitor:0000A008:cgllc-cgdn1:1

Can you give me a hint how to proceed here to customize the database file in the Openhab binding?

Here is my current cgllc.airm.cgdn1.json:

{
"deviceMapping": {
	"id": [
		"cgllc.airm.cgdn1"
	],
	"propertyMethod": "get_value",
	"maxProperties": 6,
	"channels": [{
			"property": "battery",
			"friendlyName": "Battery",
			"channel": "battery",
			"channelType": "system:battery-level",
			"type": "Number",
			"refresh": true,
			"ChannelGroup": "Status",
			"actions": []
		},
		{
			"property": "pm2.5",
			"friendlyName": "PM2.5",
			"channel": "pm25",
			"channelType": "pm25",
			"type": "Number",
			"refresh": true,
			"ChannelGroup": "Status",
			"actions": []
		},
		{
			"property": "pm10",
			"friendlyName": "PM210",
			"channel": "pm10",
			"channelType": "pm10",
			"type": "Number",
			"refresh": true,
			"ChannelGroup": "Status",
			"actions": []
		},
		{
			"property": "carbonDioxide",
			"friendlyName": "CO2e",
			"channel": "co2",
			"channelType": "co2",
			"type": "Number",
			"refresh": true,
			"ChannelGroup": "Status",
			"actions": []
		},
		{
			"property": "humidity",
			"friendlyName": "Humidity",
			"channel": "humidity",
			"channelType": "humidity",
			"type": "Number",
			"refresh": true,
			"ChannelGroup": "Status",
			"actions": []
		},
		{
			"property": "temperature",
			"friendlyName": "Temperature",
			"channel": "temperature",
			"channelType": "temperatureC",
			"type": "Number:Temperature",
			"unit": "CELCIUS",
			"refresh": true,
			"ChannelGroup": "Status",
			"actions": [],
			"category": "temperature",
			"tags": [
				"Measurement",
				"Temperature"
			]
		}
	]
}

}

Thank you very much.

kind regards Jörg

got it ,thnx

so i use at paperui :

set_scene["cf",0,0,"20000,1,255,5,20000,1,5292678,5,20000,1,11673869,5,20000,1,16776960,5,20000,1,7733248,5"]

and i get a nice color flow at my lamp.But when i try to use the same command in a rule

YeelightColorBulb2_Actions_ExecuteCommand.sendCommand("set_scene["cf",0,0,"20000,1,255,5,20000,1,5292678,5,20000,1,11673869,5,20000,1,16776960,5,20000,1,7733248,5"]")

i get a rule error like

2021-02-14 17:59:46.126 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'livingroom_switch.rules' has errors, therefore ignoring it: [10,68]: missing ')' at 'cf'

[10,82]: mismatched input ',' expecting 'end'

what am i doing wrong?
edit: nevermind got it,i must use a \ before every "

Hi Joerg,
Your device is a miot device, indeed is bit more cryptic in adding support.

Can you make a GitHub issue, ill add your device coming week

You can do it in a rule by using single quote at the outer quotes
YeelightColorBulb2_Actions_ExecuteCommand.sendCommand('set_scene["cf",0,0,"20000,1,255,5,20000,1,5292678,5,20000,1,11673869,5,20000,1,16776960,5,20000,1,7733248,5"]')

Hi Marcel,

thank you. I created Issue #10152. [miio] Please support Qingping Air Monitor Lite (cgllc.airm.cgdn1) · Issue #10152 · openhab/openhab-addons · GitHub

It was the first issue I created. Please excuse if something is not expected.

Kind regards.

Sorry for the delayed answer, but you solved my problem :slight_smile:

A big thanks!!!

1 Like

Own now a Xiaomi Vaccum 1C. Using OH3.1M. My vaccum will be found in two versions. Generic and Basic. I must activate cloud and i get all channels. I dont have a clue which one is the well one.
Some buttons are missing. I get at vaccum action without buttons:
grafik
How can i activate this buttons? And which are the right commands?

Thanx.

Is there an easier way to get the token yet?
The old fashioned way to extract the mihome app, backup - SQLite etc. is working fine but is always a bit laborious…
And can someone recommend some power switches (EU - 230V)?
Thanks in advantage!

2 Likes

For my 3 devices (2 purifiers and 1 vacuum) the binding automatically got the token. Otherwise there is the extractor posted before.

Enter your cloud userId/password in the binding details and your devices will be discovered with token.
The PiotrMachowski/Xiaomi-cloud-tokens-extractor is actually based on the openHAB code (obviously re-written in python)

1 Like

You can select both, the result is the same. In future revisions of the binding only the generic will remain.

Is this your model dreame.vacuum.mc1808 Mi Robot Vacuum Mop 1C STYTJ01ZHM?
Don’t know why they are not appearing for you (maybe you have early 3.1 version?).
The right values should be :

"options": [
					{
						"value": "vacuum",
						"label": "Vacuum"
					},
					{
						"value": "stop",
						"label": "Stop"
					},
					{
						"value": "sweep",
						"label": "Sweep"
					},
					{
						"value": "stopsweep",
						"label": "Stop Sweep"
					},
					{
						"value": "dock",
						"label": "Goto Dock"
					}

Hello Marcel,

thanks for your reply. Yes its exactly this kind of device. As my post before at the moment i use 3.1.0 Milestone 1.
It’s not clear for me where to add this options.
Otherwise i’m missing the options to control how wet the robot clean floor. Via App i can choose three different levels: low, medium, high. But i can’t find an item for this. Via documentation there is also no option.
Thanks for your support. This are small issues, i’m very happy with binding itself.

If they don’t show up automatically, I think you can add these kind of mappings as openHAB value maps… you can see the examples in section for your device in the readme Xiaomi Mi IO - Bindings | openHAB

In the (published) channels the mode channel comes most close as it has [“0”=“quiet”,“1”=“standard”,“2”=“medium”,“3”=“strong”] I don’t see anything similar

That is not what i mean. I can swipe with water and can set low wet or heavy wet. That is what i missing. What you mean is strange of suction from vacuum cleaner. At my picture you can see that this work out of the box. Maybe clean-workmode?

In the meanwhile i created a sitemap with selection and this works very well.

Can you try to add this file locally (see readme on how to add local database files)
I think this will have working water channel
dreame.vacuum.mc1808-miot.json (15.7 KB)

My path maybe other openhabian has this path here:
grafik
I hope that is right. The documentation is not totally clear for me sorry. Debug log is a log what i don’t know. I know only openhab.log. I get a new device after reboot i thing.


But i don’t get any channel. I switch over to cloud in thing settings. But i have only hidden channels:

To enable debug logging, you can type in the console log:set debug org.openhab.binding.miio

The right folder is printed during the startup of the binding.
You may need to restart OH if the path was not existant when OH was started.

In the log you should see something like using etc\openhab\misc\miio\dreame.vacuum.mc1808-miot.json see Xiaomi Mi Air Purifier (Xiaomi Mi IO) - #330 by chrismast for a screenshot of how it would loook like.

After you’ve added your thing, it may take 1 to 2 minutes to communicate with the device and initialize the thing in the right way.

Hello Marcel,

i restart openhab and nothing happends. I switch debug mode on and restart only the binding. Now WaterMode is there. Thank you very much! Sometimes openhab is a little bit silly…

I create selection via Sitemap but there is no effect if i choose something:

But read out of item works.

´´´

2021-02-27 15:25:43.416 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":186,"method":"set_properties","params":[{"did":"water-mode","siid":18,"piid":20,"value":2}]} -> 192.168.179.158 (Device: 16D5DC17 token: 494D4C44XXXXXXXXXXXXXXXX51724E31 Queue: 1). Send via cloudserver: de
2021-02-27 15:25:43.515 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":186,"method":"set_properties","params":[{"did":"water-mode","siid":18,"piid":20,"value":2}]} to https://de.api.io.mi.com/app/home/rpc/383114263
2021-02-27 15:25:43.664 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/383114263. Response: {"code":0,"exe_time":2,"id":186,"otlocalts":1614435943649473,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18}]}
2021-02-27 15:25:43.667 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":2,"id":186,"otlocalts":1614435943649473,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18}]}
2021-02-27 15:25:43.670 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":186,"method":"set_properties","params":[{"did":"water-mode","siid":18,"piid":20,"value":2}]} send via cloudserver de
2021-02-27 15:25:43.674 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for RobbyBubbleGeneric type: SET_PROPERTIES, result: [{"code":0,"did":"water-mode","piid":20,"siid":18}], fullresponse: {"code":0,"exe_time":2,"id":186,"otlocalts":1614435943649473,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18}]}
2021-02-27 15:25:43.971 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":188,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} -> 192.168.179.158 (Device: 16D5DC17 token: 494D4C44XXXXXXXXXXXXXXXX51724E31 Queue: 2). Send via cloudserver: de
2021-02-27 15:25:44.093 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":188,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} to https://de.api.io.mi.com/app/home/rpc/383114263
2021-02-27 15:25:44.163 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/383114263. Response: {"code":0,"exe_time":21,"id":188,"otlocalts":1614435944147189,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:25:44.166 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":21,"id":188,"otlocalts":1614435944147189,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:25:44.170 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":188,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} send via cloudserver de
2021-02-27 15:25:44.176 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for RobbyBubbleGeneric type: GET_PROPERTIES, result: [{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}], fullresponse: {"code":0,"exe_time":21,"id":188,"otlocalts":1614435944147189,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:25:44.592 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Skip refresh of channel water-mode for miio:basic:RobbyBubbleBasic as it is not linked
2021-02-27 15:25:46.425 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":204,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} -> 192.168.179.158 (Device: 16D5DC17 token: 494D4C44XXXXXXXXXXXXXXXX51724E31 Queue: 2). Send via cloudserver: de
2021-02-27 15:25:46.515 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":204,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} to https://de.api.io.mi.com/app/home/rpc/383114263
2021-02-27 15:25:46.567 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/383114263. Response: {"code":0,"exe_time":3,"id":204,"otlocalts":1614435946551850,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:25:46.570 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":3,"id":204,"otlocalts":1614435946551850,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:25:46.574 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":204,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} send via cloudserver de
2021-02-27 15:25:46.579 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for RobbyBubbleGeneric type: GET_PROPERTIES, result: [{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}], fullresponse: {"code":0,"exe_time":3,"id":204,"otlocalts":1614435946551850,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:14.079 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":220,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} -> 192.168.179.158 (Device: 16D5DC17 token: 494D4C44XXXXXXXXXXXXXXXX51724E31 Queue: 2). Send via cloudserver: de
2021-02-27 15:26:14.298 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":220,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} to https://de.api.io.mi.com/app/home/rpc/383114263
2021-02-27 15:26:14.350 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/383114263. Response: {"code":0,"exe_time":3,"id":220,"otlocalts":1614435974333034,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:14.353 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":3,"id":220,"otlocalts":1614435974333034,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:14.355 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":220,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} send via cloudserver de
2021-02-27 15:26:14.359 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for RobbyBubbleGeneric type: GET_PROPERTIES, result: [{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}], fullresponse: {"code":0,"exe_time":3,"id":220,"otlocalts":1614435974333034,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:14.646 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Skip refresh of channel water-mode for miio:basic:RobbyBubbleBasic as it is not linked
2021-02-27 15:26:44.129 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":237,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} -> 192.168.179.158 (Device: 16D5DC17 token: 494D4C44XXXXXXXXXXXXXXXX51724E31 Queue: 2). Send via cloudserver: de
2021-02-27 15:26:44.299 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":237,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} to https://de.api.io.mi.com/app/home/rpc/383114263
2021-02-27 15:26:44.404 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/383114263. Response: {"code":0,"exe_time":3,"id":237,"otlocalts":1614436004373303,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:44.410 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":3,"id":237,"otlocalts":1614436004373303,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:44.413 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":237,"method":"get_properties","params":[{"did":"water-mode","siid":18,"piid":20},{"did":"fault","siid":3,"piid":1}]} send via cloudserver de
2021-02-27 15:26:44.421 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for RobbyBubbleGeneric type: GET_PROPERTIES, result: [{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}], fullresponse: {"code":0,"exe_time":3,"id":237,"otlocalts":1614436004373303,"result":[{"code":0,"did":"water-mode","piid":20,"siid":18,"value":2},{"code":0,"did":"fault","piid":1,"siid":3,"value":0}]}
2021-02-27 15:26:44.715 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Skip refresh of channel water-mode for miio:basic:RobbyBubbleBasic as it is not linked

Xiaomi app will not update and stay on low.