Some backround to the battery level of the sub devices:
Every Aqara sub-device provides a voltage property:
[xiaomi_gateway] _send_cmd resp << {'sid': '158d00016dc0d8', 'cmd': 'read_ack', 'short_id': 14573, 'model': 'sensor_motion.aq2', 'data': '{"voltage":3005,"lux":"72"}'}
[xiaomi_gateway] read_ack << {'sid': '158d00016dc0d8', 'cmd': 'read_ack', 'short_id': 14573, 'model': 'sensor_motion.aq2', 'data': '{"voltage":3005,"lux":"72"}'}
[homeassistant.components.xiaomi_aqara] PUSH >> <Entity Illumination_158d00016dc0d8: 72.0>: {'lux': '72', 'voltage': 3005}
[homeassistant.components.xiaomi_aqara] PUSH >> <Entity Motion Sensor_158d00016dc0d8: on>: {'lux': '72', 'voltage': 3005}
[xiaomi_gateway] _send_cmd >> b'{ "cmd":"read","sid":"158d0001871038"}'
[xiaomi_gateway] _send_cmd resp << {'sid': '158d0001871038', 'cmd': 'read_ack', 'short_id': 21065, 'model': 'magnet', 'data': '{"voltage":3025,"status":"open"}'}
[xiaomi_gateway] read_ack << {'sid': '158d0001871038', 'cmd': 'read_ack', 'short_id': 21065, 'model': 'magnet', 'data': '{"voltage":3025,"status":"open"}'}
[homeassistant.components.xiaomi_aqara] PUSH >> <Entity Door Window Sensor_158d0001871038: on>: {'status': 'open', 'voltage': 3025}
This voltage is mapped to a new range: [2.8V...3.3V] -> [0...100]
: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/xiaomi_aqara.py#L292-L303
>>> max_volt = 3300
>>> min_volt = 2800
>>> voltage = 3005
>>> voltage = min(voltage, max_volt)
>>> voltage
3005
>>> voltage = max(voltage, min_volt)
>>> voltage
3005
>>> ((voltage - min_volt) / (max_volt - min_volt))
0.41
>>> percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100
>>> percent
41.0
>>>
I would be happy if somebody tries to run a sensor with a laboratory power supply. Is the measurement of the sub device accurate?