Mi(Xiaomi) Smart home bindings?


(Cristian Toader) #730

Is it possible to add the functionality that would allow the Xiaomi Gateway to be defined/used as system speaker in openhab2? From my understanding, currently the device is only able to play one of the 30 predefined sounds.


(Carel Van Hemert) #731

Someone else can maybe correct me, but I have yet to find a way to use it as a general speaker.
The best I could do was to add a custom sound to the Gateway, and play the sound when applicable via OH.


(C4ETuK) #732

What the version of OH you use?
I downloaded 2.2 and it doesn’t work with mi home for me.
If I just download addon and try to send command to xiomi item - I get NPE because there is no gateway token in heartbeat anymore. But it still present into get_id_list_ack, but looks like the encryption alghoritm was changed too, because in this case I get invalid key message.
By the way, anybody know who’s author of mi home addon?


(Carel Van Hemert) #733

I’ve been using the newest version of OH without any trouble thus far.
Are you using “Xiaomi Mi Smart Home Binding” or “Xiaomi Mi IO Binding”?


(C4ETuK) #734

I use
Xiaomi Mi Smart Home Binding


(oppo1967p) #735

I have the same error:

2018-03-22 22:12:26.265 [WARN ] [me.handler.XiaomiActorGatewayHandler] - Can't handle command OFF on channel mihome:gateway:7811dcb38279:7811dcb38279:colorTemperature

Any solution?


(Tejo) #736

I set the log level for org.openhab.binding.xiaomigateway to DEBUG and I don’t have anything logged.
EDIT: I wrote wrong instance. I changed to org.openhab.binding.mihome and it is logging.

I also have this log entry on events

17:45:00.126 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Light_outdoor_1' received command ON
17:45:00.137 [ERROR] [andler.XiaomiAqaraActorSwitch1Handler] - Can't handle command ON on channel mihome:ctrl_neutral1:158d0001f503dc:ch1
17:45:00.154 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Light_outdoor_3' received command ON

I checked on mihome app and everything runs normally, no devices is in offline status. But for the past week, it is not working again like my previous post here
I’m quite sure that wifi signal is not the problem, it is receiving from outdoor beamer TP-Link CPE210 and set signal for receiver <1km and only separated by 2 glass walls with about 15m distance.

Controlling via mihome app also does not update button status on openhab.


(sunseaandpalms) #737

@kohlsalem, have you found an answer to your question? I’m thinking about buying that lamp, but not sure whether I will be able to integrate it with my Openhab.


(oppo1967p) #738

no solution yet.
For me, some items works and some not.
For exapmple, temperature sensors work, battery level too.
But the led color of the gateway no.


(Michael Kohl) #739

@sunseaandpalms i did not find any solution yet. But the Lamp is a great piece of hardware even without connectivety…


(Fastcar550) #740

The Philips Eyecare 2 now works with the MIIO addon.
https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.miio/2.3.0-SNAPSHOT/


(Konstantin Chigakov) #741

Me too experiencing the issue with action handling. I’m on the latest snapshot

2018-03-25 19:50:07.616 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.mihome.handler.XiaomiActorPlugHandler@56b4aa61': null
java.lang.NullPointerException: null
	at org.openhab.binding.mihome.internal.EncryptionHelper.encrypt(EncryptionHelper.java:69) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.openhab.binding.mihome.internal.EncryptionHelper.encrypt(EncryptionHelper.java:42) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.getEncryptedKey(XiaomiBridgeHandler.java:290) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.createDataJsonString(XiaomiBridgeHandler.java:276) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToDevice(XiaomiBridgeHandler.java:267) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.openhab.binding.mihome.handler.XiaomiActorPlugHandler.execute(XiaomiActorPlugHandler.java:47) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:104) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [97:org.eclipse.smarthome.core:0.10.0.201803241900]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [97:org.eclipse.smarthome.core:0.10.0.201803241900]
	at com.sun.proxy.$Proxy145.handleCommand(Unknown Source) [207:org.openhab.binding.mihome:2.3.0.201803101457]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [104:org.eclipse.smarthome.core.thing:0.10.0.201803241900]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [104:org.eclipse.smarthome.core.thing:0.10.0.201803241900]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [97:org.eclipse.smarthome.core:0.10.0.201803241900]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [97:org.eclipse.smarthome.core:0.10.0.201803241900]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	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) [?:?]

(C4ETuK) #742

Yep this error is absolutely like mine. And It’s very strange that nobody else faced it. Maybe some special gateway or gateway firmware version?


(Thomas Binder) #743

using OH2.2 (openHABian 1.4) with MiGateway 2nd gen with current Firmware 1.4.1_153.0143 without any problems:

  • Xiaomi Smart MiGateway v2 (with radio support)
  • four Xiaomi Aqara Temperature, Humidity and Pressure Sensor (square ones)
  • one Xiaomi Wireless Switch (round one)
  • one Xiaomi Aqara Motion Sensor (with light intensity support)

=> all working stable since December.


(oppo1967p) #744

Hi @binderth,
can you change the color or the brightness of the gateway led?


(C4ETuK) #745

Look’s like all things you have is a data provider. And you don’t send any command to them. You just reading they state. As for me I have wall-switch and I can’t turn on/off light, but can read it’s state.


(C4ETuK) #746

Can you try on/off gateway light?


(Hallo Ween) #747

I´m not @binderth but i can answer this:

I have nearly the same devices like binderth, and i can change and switch on/off the color of the gateway light. I can play sounds on the gateway too.


(oppo1967p) #748

Hi @halloween,
can you share your things and items file?
Also, can you inform us about the firmware version of the gateway?


(Thomas Binder) #749

I can turn on/off the light and I can change it. I don’t use PaperUI, so everything is in files:

Things:

Bridge  mihome:bridge:34cexxxxxxxx				"Xiaomi Gateway Bridge"				@ "Rossbuehel OG"			[serialNumber="34cexxxxxxxx", ipAddress="192.168.xx.xx", port=9898, key="yyyyyyyyyy", pollingInterval=1000 ] 
{
	Things:
		gateway				34cexxxxxxxx		"Xiaomi Mi Smart Home Gateway"		@ "Rossbuehel OG"			[itemId="34cexxxxxxxx"]
		sensor_motion_aq2	158dxxxxxxxxxx		"Xiaomi Motion Sensor"				@ "Rossbuehel WoZi"			[itemId="158dxxxxxxxxxx"]
		sensor_weather_v1	158dxxxxxxxxxx		"Xiaomi Temp/humid/baro Kitchen"	@ "Rossbuehel Küche"		[itemId="158dxxxxxxxxxx"]
		sensor_weather_v1	158dxxxxxxxxxx		"Xiaomi Temp/humid/baro outside"	@ "Rossbuehel Aussen"		[itemId="158dxxxxxxxxxx"]
		sensor_weather_v1	158dxxxxxxxxxx		"Xiaomi Temp/humid/baro matresses"	@ "Rossbuehel Matratzenl"	[itemId="158dxxxxxxxxxx"]
		sensor_weather_v1	158dxxxxxxxxxx		"Xiaomi Temp/humid/baro hallway"	@ "Rossbuehel Vorraum"		[itemId="158dxxxxxxxxxx"]
		sensor_switch		158dxxxxxxxxxx		"Xiaomi Mi Wireless Switch"			@ "Rossbuehel Eingang"		[itemId="158dxxxxxxxxxx"]
		smoke				158dxxxxxxxxxx		"Xiaomi Smoke Detector"				@ "Rossbuehel OG"			[itemId="158dxxxxxxxxxx"]
}

items:

// Xiaomi Gateway
Switch 		RB_MiGateway_LightSwitch 			"Gateway Licht"							<light> 			(xiaomi) 		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:brightness",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_LightSwitch:state:*:default]" }
Dimmer 		RB_MiGateway_Brightness 			"Gateway Licht Dimmer [%d %%]" 			<dimmablelight> 	(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:brightness",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_Brightness:state:*:default]" }
Color  		RB_MiGateway_Color 					"Gateway Licht Farbe"					<rgb> 				(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:color",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_Color:state:*:default]" }
Dimmer 		RB_MiGateway_ColorTemperature		"Gateway Licht Farbtemeratur [%d K]"	<heating> 			(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:colorTemperature",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_ColorTemperature:state:*:default]" }
Number 		RB_MiGateway_AmbientLight 			"Gateway Licht Ambient [%.1f]"			<sun> 				(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:illumination",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_AmbientLight:state:*:default]" }
Number		RB_MiGateway_Sound 					"Gateway Sound Lautstärke [%d]"			<soundvolume-0> 	(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:sound",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_Sound:state:*:default]" }
Switch 		RB_MiGateway_SoundSwitch 			"Gateway Sound"							<soundvolume_mute> 	(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:enableSound",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_SoundSwitch:state:*:default]" }
Dimmer		RB_MiGateway_SoundVolume 			"Gateway Sound Volume"					<soundvolume> 		(xiaomi)		{ channel="mihome:gateway:34cexxxxxxxx:34cexxxxxxxx:volume",mqtt=">[mqttcottage:huette/sensoren/RB_MiGateway_SoundVolume:state:*:default]" }

// Xiaomi Temperature and Humidity Sensor
Number 		RB_MiWeather_Temperature_Kitchen	"Temperatur Küche [%.1f C]"				<temperature> 		(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:temperature",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Temperature_Kitchen:state:*:default]" }
Number 		RB_MiWeather_Humidity_Kitchen 		"Feuchtigkeit Küche [%.2f %%]"			<humidity> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:humidity",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Humidity_Kitchen:state:*:default]" }
Number 		RB_MiWeather_Pressure_Kitchen 		"Luftdruck Küche [%.1f hP]"				<pressure> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:pressure",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Pressure_Kitchen:state:*:default]" }
Number 		RB_MiWeather_Battery_Kitchen 		"Tempsensor Küche Batterie [%d %%]"		<battery> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Battery_Kitchen:state:*:default]" }
Switch 		RB_MiWeather_BatteryLow_Kitchen		"Tempsensor Küche Batt leer"			<energy> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_BatteryLow_Kitchen:state:*:default]" }

// Xiaomi Temperature and Humidity Sensor
Number 		RB_MiWeather_Temperature_Outside	"Temperatur Aussen [%.1f C]"			<temperature> 		(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:temperature",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Temperature_Outside:state:*:default]" }
Number 		RB_MiWeather_Humidity_Outside 		"Feuchtigkeit Aussen [%.2f %%]"			<humidity> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:humidity",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Humidity_Outside:state:*:default]" }
Number 		RB_MiWeather_Pressure_Outside 		"Luftdruck Aussen [%.1f hP]"			<pressure> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:pressure",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Pressure_Outside:state:*:default]" }
Number 		RB_MiWeather_Battery_Outside 		"Tempsensor Aussen Batterie [%d %%]"	<battery> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Battery_Outside:state:*:default]" }
Switch 		RB_MiWeather_BatteryLow_Outside		"Tempsensor Aussen Batt leer"			<energy> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_BatteryLow_Outside:state:*:default]" }

// Xiaomi Temperature and Humidity Sensor
Number 		RB_MiWeather_Temperature_Hall		"Temperatur Vorraum [%.1f C]"			<temperature> 		(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:temperature",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Temperature_Hall:state:*:default]" }
Number 		RB_MiWeather_Humidity_Hall 			"Feuchtigkeit Vorraum [%.2f %%]"		<humidity> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:humidity",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Humidity_Hall:state:*:default]" }
Number 		RB_MiWeather_Pressure_Hall 			"Luftdruck Vorraum [%.1f hP]"			<pressure> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:pressure",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Pressure_Hall:state:*:default]" }
Number 		RB_MiWeather_Battery_Hall 			"Tempsensor Vorraum Batterie [%d %%]"	<battery> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Battery_Hall:state:*:default]" }
Switch 		RB_MiWeather_BatteryLow_Hall		"Tempsensor Vorraum Batt leer"			<energy> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_BatteryLow_Hall:state:*:default]" }

// Xiaomi Temperature and Humidity Sensor
Number 		RB_MiWeather_Temperature_Matresses	"Temperatur Matratzenlager [%.1f C]"	<temperature> 		(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:temperature",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Temperature_Matresses:state:*:default]" }
Number 		RB_MiWeather_Humidity_Matresses 	"Feuchtigkeit Matratzenlager [%.2f %%]"	<humidity> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:humidity",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Humidity_Matresses:state:*:default]" }
Number 		RB_MiWeather_Pressure_Matresses 	"Luftdruck Matratzenlager [%.1f hP]"	<pressure> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:pressure",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Pressure_Matresses:state:*:default]" }
Number 		RB_MiWeather_Battery_Matresses 		"Tempsensor Matratzen Batterie [%d %%]"	<battery> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_Battery_Matresses:state:*:default]" }
Switch 		RB_MiWeather_BatteryLow_Matresses	"Tempsensor Matratzen Batt leer"		<energy> 			(xiaomi)		{ channel="mihome:sensor_weather_v1:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/RB_MiWeather_BatteryLow_Matresses:state:*:default]" }

// Xiaomi Motion Sensor
Switch 		RB_MiMotionSensor_MotionStatus 		"Bewegung"								<motion>  			(xiaomi)		{ channel="mihome:sensor_motion_aq2:34cexxxxxxxx:158dxxxxxxxxxx:motion",mqtt=">[mqttcottage:huette/sensoren/RB_MiMotionSensor_MotionStatus:state:*:default]" }
Number		 RB_MiMotionsSensor_Illumination 	"Bewegung Helligkeit [%d]"				<sun>				(xiaomi)		{ channel="mihome:sensor_motion_aq2:34cexxxxxxxx:158dxxxxxxxxxx:illumination",mqtt=">[mqttcottage:huette/sensoren/RB_MiMotionsSensor_Illumination:state:*:default]" }
// minimum 5 seconds - remember that the sensor only triggers every minute to save energy
String 		RB_MiMotionSensor_MotionTimer 		"Bewegung Timer [%s]"					<clock> 			(xiaomi)		{ channel="mihome:sensor_motion_aq2:34cexxxxxxxx:158dxxxxxxxxxx:motionOffTimer",mqtt=">[mqttcottage:huette/sensoren/RB_MiMotionSensor_LastMotion:state:*:default]" }
DateTime 	RB_MiMotionSensor_LastMotion		"letzte Bewegung [%1$td.%1$tm %1$tH:%1$tM]" <clock-on>	(xiaomi)		{ channel="mihome:sensor_motion_aq2:34cexxxxxxxx:158dxxxxxxxxxx:lastMotion",mqtt=">[mqttcottage:huette/sensoren/RB_MiMotionSensor_LastMotion:state:*:default]" }
Number 		RB_MiMotionSensor_Battery 			"Bewegungssensor Batterie [%d %%]"		<battery> 			(xiaomi)		{ channel="mihome:sensor_motion_aq2:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiMotionSensor_Battery:state:*:default]" }
Switch 		RB_MiMotionSensor_BatteryLow 		"Bewegungssensor Batterie leer"			<energy> 			(xiaomi)		{ channel="mihome:sensor_motion_aq2:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/NiMotionSensor_BatteryLow:state:*:default]" }

// Xiaomi Firedetector
Number 		RB_MiSmokeDetector_Density			"Luftdichte Melder [%.1f]"				<sun>				(xiaomi)		{ channel="mihome:smoke:34cexxxxxxxx:158dxxxxxxxxxx:density",mqtt=">[mqttcottage:huette/sensoren/RB_MiSmokeDetector_Density:state:*:default]" }
Switch 		RB_MiSmokeDetector_Alarm			"FEUERALARM"							<fire>				(xiaomi)		{ channel="mihome:smoke:34cexxxxxxxx:158dxxxxxxxxxx:alarm",mqtt=">[mqttcottage:huette/sensoren/RB_MiSmokeDetector_Alarm:state:*:default]" }
String		RB_MiSmokeDetector_Status			"Rauchmelder Status [%s]"				<fire>				(xiaomi)		{ channel="mihome:smoke:34cexxxxxxxx:158dxxxxxxxxxx:status",mqtt=">[mqttcottage:huette/sensoren/RB_MiSmokeDetector_Status:state:*:default]" }
Number 		RB_MiSmokeDetector_Battery 			"Rauchmelder Batterie [%d %%]"			<battery> 			(xiaomi)		{ channel="mihome:smoke:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiSmokeDetector_Battery:state:*:default]" }
Switch 		RB_MiSmokeDetector_BatteryLow 		"Rauchmelder Batterie leer"				<energy> 			(xiaomi)		{ channel="mihome:smoke:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/RB_MiSmokeDetector_BatteryLow:state:*:default]" }

// Xiaomi Switch - see "xiaomi.rules" for action triggers
Number 		RB_MiSwitch_Battery 				"Button Batterie [%d %%]"				<battery> 			(xiaomi)		{ channel="mihome:sensor_switch:34cexxxxxxxx:158dxxxxxxxxxx:batteryLevel",mqtt=">[mqttcottage:huette/sensoren/RB_MiSwitch_Battery:state:*:default]" }
Switch 		RB_MiSwitch_BatteryLow 				"Button Batterie leer"					<energy> 			(xiaomi)		{ channel="mihome:sensor_switch:34cexxxxxxxx:158dxxxxxxxxxx:lowBattery",mqtt=">[mqttcottage:huette/sensoren/RB_MiSwitch_BatteryLow:state:*:default]" }

(hint: I send all item values via MQTT, don’t be confused)