Mi Connector and Xiaomi

@bobbles

Any idea for this polling error log flooding?

After a while, it fixed by itself

1 Like

I've not seen this I'm afraid so cannot really advise. Sorry.

@olddoggy and I have been chatting about this one. But we cant seem to stop it :expressionless:

I'll check my logs again but I can't say I've seen it before.

@Royski I have blocked gateway IP address on the router and would like to see if it is getting better. Last two days, I have added one line into config,json, which is network: docker IP address. Seems after this, it will heal itself after a while when polling error.

BTW, what is the following token from IP address:30000 used for? I can turn it off...

All I see in the logs is for actions to the hub like turn siren/light on/off. Nothing else.

1 Like

This is the docker IP and port.

I will disable it to see if problem is gone..

@bobbles, do you disable this token from your config,json?

I've left everything at the default values when I configured it.
Just checked and the token is set to off.

I'm just posting this for information for anyone else using this method to pair Xiaomi/Aqara devices.
With the device drivers for HE you can define a battery replaced date.
I wanted to do this with the drivers using this method.
To do this you have to add the following in the drivers code.

In the attribute section insert this line.
attribute "batteryLastReplaced", "String"

In the command section insert this line.
command "resetBatteryReplacedDate"

At the end of the driver code inset this.
//Reset the batteryLastReplaced date to current date
def resetBatteryReplacedDate(paired) {
def newlyPaired = paired ? " for newly paired sensor" : ""
sendEvent(name: "batteryLastReplaced", value: new Date())
displayInfoLog("Setting Battery Last Replaced to current date${newlyPaired}")
}
def init() {
if (!device.currentState('batteryLastReplaced')?.value)
resetBatteryReplacedDate(true)
}

2 Likes

I've also updated the drivers to allow changing of the MI-Controller.
I added prefrences so you can update the IP and code, and the index.

So if you move the controller to another device (rPI or docker etc) you can just update the IP and save it. If anyone wants this, let me know :+1:

1 Like

Oohhh. Yes please sir. :blush:

Add this to the metadata

preferences     {
    input "app_url", "text", title: "Xiaomi Hub URL", required: false
    input "id", "text", title: "Device ID (without mi-connector-)", required: false
    input "deviceIndex", "text", title: "deviceIndex ", required: false
}

Change updated() to this

def updated()   {
	log.debug "${app_url}, ${id}, ${deviceIndex}"
	state.app_url = settings.app_url
	state.id = settings.id
	state.deviceIndex = settings.deviceIndex   
}

For devices which have no index (TBH I think only the double switches have this) you can leave out the Index lines :+1:

1 Like

Thanks.

1 Like

I've changed my controller 3 times now, this saved me a lot of time :wink:

1 Like

Thanks @Royski for the guide and helpful answers in this thread! Finally managed to set this up.

Did anyone manage to pair Aqara water leak sensors to a lumi.gateway.v3 (Mijia Control Hub v2) ?

I've tried through the Mi App as well as the 3 quick button clicks on the Hub itself with every combination of pressing the button on the water leak sensor, but the Hub never sees it. (these sensors successfully paired to Hubitat using @veeceeoh driver in the past).

I'm wondering if I need to update the Hub firmware? Currently on 1.3.1_141.0220 and haven't done the update to 1.4.1_175.0220 for fear of losing connectivity to the Hub as seems to happen to certain people above 1.4.1_159.

No problem, glad its working.

Yeah they should work fine, I have several here. They took a little while to pair, but did finally.
I'm running 1.4.1_175.0220 here. So yeah could be an update issue?

1 Like

Updated the firmware to 1.4.1_175 and the water sensors paired in no time. Thank you so much! :slight_smile:

1 Like

Well Thank You. I can't believe it. I posted on this many months back but could never get it to work and the author wasn't much help.
I DID THE SAME THING YOU DID, renamed the drivers to differentiate, never thought that would cause an issue. And never realized the couple devices that were showing, had originally named drivers.
I think before I add this back , I'm going to start pairing the Xiaomi devices to ST, since it's still running(better than HE actually) and despite the outages, the automations are more reliable.

Hi, I have pile of Xiaomi devices and so far relegated them to the parts bin because they were not reliable. I have purchased the hub you recommended. While I await for delivery, the only thing that has me stumped is Docker. I have a Windows 10 PC that is on all the time that manages by Blue Iris cameras*(and also performs double duty for playing Netflix and sNetwork storage for my family).

Can I put Docker on this PC and install the connector or do I need a RPi?