[SOLVED] Battery and BatteryLow for Xiaomi Mi Motion Sensor and Xiaomi Mi Wireless Switch not working

Hi everybody,

I have a lot of Xiaomi devices connected through the Xiaomi Mi Gateway and the Xiaomi Mi Smart Home Binding mihome binding.

Everything works perfect, also the Motion Sensor and the Wireless Switch (Button).

But: I cannot get the Battery state and BatteryLow state from these two devices which I do not understand.

I used the examples I found here, this are the items I created in /etc/openhab2/items/xiaomi.items (as I cannot create these items in Paper UI):

Number XiaomiMiMotionSensor_Battery "Batterieladung [%s %%]" <battery> { channel="mihome:sensor_motion:xxx:batteryLevel" }
Switch XiaomiMiMotionSensor_BatteryLow "Niedriger Batteriestand [MAP(xiaomi.map):%s]" <energy> { channel="mihome:sensor_motion:xxx:lowBattery" }

Number XiaomiMiWirelessSwitch1_Battery "Batterieladung [%s %%]" <battery> { channel="mihome:sensor_switch:xxx:batteryLevel" }
Switch XiaomiMiWirelessSwitch1_BatteryLow "Niedriger Batteriestand [MAP(xiaomi.map):%s]" <energy> { channel="mihome:sensor_switch:xxx:lowBattery" }

No idea what I am missing here. Maybe someone can point it out for me?

Thank you and regards,

Are the channels available for those two things in the paperUI ?

No, I cannot add these items through Paper UI.

That is not my question

Yes, sorry. This is what I see in the two things in Paper UI:

Have you tried deleting the things and rediscover?

Hi, I have four Wireless Switches and several Motion Sensors, all reporting the battery levels fine. Since it’s a number try [%d %%] for the value in the label.
• Also does your xxx mean, xxgatewayxx:xxitemxx or did you just enter the item ID?
• And are the wireless switches the Mi ones or the Aqara ones, which also have a gyro inside to recognise “SHAKE”? If they are the Aqara ones you should use sensor_switch_aq2, if they are Mi then your sensor_switch is fine.

Hope this helps.

P.S. Just saw that all your sensors only have their own device IDs showing in Paper UI. All my Xiaomi sensors have gatewayID:deviceID, e.g.



THis is also how it’s described in the binding docs which you linked to


How did you set the sensors up and link them to the gateway?

Thank you @vzorglub - deleting the things and items and recreating these worked! It seems that I have been on a pretty old version of these things and items for the two devices. Thank you again! :slight_smile:

@Hans_Lree: I am using the “old” devices, “Mi”, not “Aqara” here. I have lots of Aqara devices, but not these two. I was aware of the differences between the two versions. “xxx” was the ID of the Gateway thing plus the ID of the Motion/Switch thing.