IDK, he is right, on my side I never had 0 value for battery, so using a filter for them is an idea to test.
It’s only I have no idea what the content of the DDF should be to suppress/ignore the 0 % value only for the battery values for the „lumi.sen_ill.mgl01“ device
Can try this DDF, based on deconz-rest-plugin/devices/xiaomi/xiaomi_gzcgq01lm_light_sensor.json at master · dresden-elektronik/deconz-rest-plugin · GitHub
{
"schema": "devcap1.schema.json",
"doc:path": "xiaomi/xiaomi_gzcgq01lm_light_sensor.md",
"doc:hdr": "Light sensor GZCGQ01LM",
"manufacturername": ["$MF_XIAOMI", "$MF_LUMI"],
"modelid": ["lumi.sen_ill.mgl01", "lumi.sen_ill.mgl01"],
"vendor": "Xiaomi",
"product": "Mijia Light Sensor GZCGQ01LM",
"status": "Gold",
"md:known_issues": [ ],
"sleeper": true,
"subdevices": [
{
"type": "$TYPE_LIGHT_LEVEL_SENSOR",
"restapi": "/sensors",
"uuid": [
"$address.ext",
"0x01",
"0x0400"
],
"fingerprint": {
"profile": "0x0104",
"device": "0x0106",
"endpoint": "0x01",
"in": [
"0x0001",
"0x0400"
]
},
"items": [
{
"name": "attr/lastseen"
},
{
"name": "attr/manufacturername"
},
{
"name": "attr/modelid",
"awake": true
},
{
"name": "attr/name"
},
{
"name": "attr/swversion",
"awake": true,
"parse": {
"at": "0x00f7",
"ep": 1,
"fn": "xiaomi:special",
"idx": "0x08",
"script": "xiaomi_swversion.js"
},
"read": {
"fn": "none"
}
},
{
"name": "attr/type"
},
{
"name": "attr/uniqueid"
},
{
"name": "config/on"
},
{
"name": "config/battery",
"awake": true,
"parse": {
"at": "0x00f7",
"ep": 1,
"fn": "xiaomi:special",
"idx": "0x01",
"eval": "const vmin = 2700; const vmax = 3000; const v = Math.max(vmin, Math.min(Attr.val, vmax)); const bat = Math.round(((v - vmin) / (vmax - vmin)) * 100); if (bat>0){Item.val = Math.max(0, Math.min(bat, 100));}"
}
},
{
"name": "config/reachable"
},
{
"name": "config/tholddark"
},
{
"name": "config/tholdoffset"
},
{
"name": "state/lightlevel",
"parse": {
"at": "0x0000",
"cl": "0x0400",
"ep": 1,
"script": "../generic/illuminance_cluster/sml_light_level.js"
}
},
{
"name": "state/dark"
},
{
"name": "state/daylight"
},
{
"name": "state/lux"
},
{
"name": "state/lastupdated"
}
],
"example": {
"config": {
"battery": 100,
"on": true,
"reachable": true,
"tholddark": 12000,
"tholdoffset": 7000
},
"ep": 1,
"etag": "761fff5a33ee73a8b9e4ec2e8ee5dac2",
"lastseen": "2021-01-13T12:07Z",
"manufacturername": "XIAOMI",
"modelid": "lumi.sen_ill.mgl01",
"name": "Light Sensor",
"state": {
"dark": false,
"daylight": false,
"lastupdated": "2021-01-13T12:07:27.511",
"lightlevel": 13425,
"lux": 22
},
"swversion": "0.0.0_0027",
"type": "ZHALightLevel",
"uniqueid": "04:cf:8c:df:3c:7f:1f:80-01-0400"
}
}
],
"bindings": [
{
"bind": "unicast",
"src.ep": 1,
"cl": "0x0400",
"report": [
{
"at": "0x0000",
"dt": "0x21",
"min": 10,
"max": 3600,
"change": "0x0064"
}
]
}
]
}
The magic is here
{
"name": "config/battery",
"awake": true,
"parse": {
"at": "0x00f7",
"ep": 1,
"fn": "xiaomi:special",
"idx": "0x01",
"eval": "const vmin = 2700; const vmax = 3000; const v = Math.max(vmin, Math.min(Attr.val, vmax)); const bat = Math.round(((v - vmin) / (vmax - vmin)) * 100); if (bat>0){Item.val = Math.max(0, Math.min(bat, 100));}"
}
},