Xiaomi Mi IO Binding - Mi Air Monitor v1 (zhimi.airmonitor.v1) - missing channels

I have updated my openhab from 2.3 to 2.4 (on Raspberry Pi 3, with raspbarian) and I have noticed an issue with Xiaomi Mi IO Binding regarding Mi Air Monitor v1 (zhimi.airmonitor.v1) device.

Long story short - the Paper UI does show only the following channels:

while it does not shows any other as mentioned in documentation:


In Paper UI the device is in active state, there is a correct token provided.

Also in openhab.log I have noticed the following warning:

        2018-12-21 12:21:00.442 [WARN ] [inding.miio.handler.MiIoBasicHandler] - Error creating channel structure
java.lang.IllegalArgumentException: ID segment 'system.battery-level' contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.
	at org.eclipse.smarthome.core.common.AbstractUID.validateSegment(AbstractUID.java:97) ~[?:?]
	at org.eclipse.smarthome.core.common.AbstractUID.<init>(AbstractUID.java:75) ~[?:?]
	at org.eclipse.smarthome.core.common.AbstractUID.<init>(AbstractUID.java:58) ~[?:?]
	at org.eclipse.smarthome.core.thing.UID.<init>(UID.java:57) ~[?:?]
	at org.eclipse.smarthome.core.thing.type.ChannelTypeUID.<init>(ChannelTypeUID.java:50) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoBasicHandler.addChannel(MiIoBasicHandler.java:358) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoBasicHandler.buildChannelStructure(MiIoBasicHandler.java:328) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoBasicHandler.checkChannelStructure(MiIoBasicHandler.java:255) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoBasicHandler.updateData(MiIoBasicHandler.java:200) ~[?:?]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.lambda$1(MiIoAbstractHandler.java:100) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

What seems like a problem with channel creation.

All other xiaomi devicess using this bundle ( air purifier, vacuum, wifi repeater and IR remote seems to have all channels working)

What I have already tried:

  • reinstalling binding
  • clearing OH cache in folders /var/lib/openhab2/tmp/* and /var/lib/openhab2/cache/*

Does anyone has a similar issue ?

Same issue at my place (openHAB 2.4.0, running at docker).

2018-12-24 07:01:32.046 [WARN ] [inding.miio.handler.MiIoBasicHandler] - Error creating channel structure
java.lang.IllegalArgumentException: ID segment 'system.battery-level' contains invalid characters. Each segment of the ID must match the pattern [A-Za-z0-9_-]*.

Hey Tim, were you able to figure this out ?

I have found some other topic from last year, where similar issue happend

and they mention that

I was still having the problem, but figured out the issue. some of my device names had brackets " ( " " ) " in the names.

However I was not able to find anything in my configuration that would match the description.

@Presses this is a bug… this channel was recently changed from the custom battery channel type to the system channel type. It seems that is not working well.
Unfortunately that also prevents the other channels from being created :frowning:

Hi J,
As I can read from Marcel’s post it is a bug. Reading log it looks like that dot in name is not allowed (system.battery-level). As Marcel is saying it has been changed to system wide variable.
I am not sure if we can do anything about it. Binding most probably should be updated (or definition of the thing?).

I’ll try to find a proper fix for it this weekend. In the mean time I compiled a version with this change reverted.
Find it here http://verpaalen.com/openhab2/org.openhab.binding.miio_2.5.0.201901181724.jar

30-1: The fix is now in the snapshot

Thanks Marcel for fix, and Tim for your help here too.

p.s. fix works like a charm :slight_smile:

Proper fix is now included in the latest snapshot