on the first ones i modify the entry and add Battery and now it works great.
it seems that the state of report isn´t in sync via database entry because i see on log that battery as type is reporting correctly but doesnt write on readResponse.
if ((type === 'readResponse' || type === 'attributeReport') && data.powerSource && !device.get('powerSource')) {
await device.set('powerSource', data.powerSource);
}
but this looks really hacky to me.
maybe we could add something like loop on values and check if empty or unknown and check if value exists by Response-Return and write them back instant.
Hi @Koenkk i´m see on different device types like Konke that the request themeselve isnt in sync with database entry.
this two entrys show what i´m mean by Konke Devices:
{"id":9,"type":"EndDevice","ieeeAddr":"0x00158d00024a48c6","nwkAddr":53008,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.sensor_cube.aqgl01","epList":[1,2,3],"endpoints":{"1":{"epId":1,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"epId":2,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"epId":3,"inClusterList":[],"outClusterList":[],"clusters":{}}},"interviewCompleted":true,"meta":{},"_id":"aw0NAXV02RjNllon"}
{"id":21,"type":"EndDevice","ieeeAddr":"0x086bd7fffee972e8","nwkAddr":54718,"manufId":4098,"manufName":"Konke","powerSource":"Unknown","modelId":"3AFE130104020015","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":1026,"inClusterList":[0,1,3,1280],"outClusterList":[3],"clusters":{}}},"appVersion":19,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":false,"meta":{},"_id":"lZtnvDFf0qJI5w9W"}
on the first ones i modify the entry and add Battery and now it works great.
it seems that the state of report isn´t in sync via database entry because i see on log that battery as type is reporting correctly but doesnt write on readResponse.
for simple hack we could do something like: https://github.com/Koenkk/zigbee-herdsman/blob/master/src/controller/controller.ts#L432
but this looks really hacky to me.
maybe we could add something like loop on values and check if empty or unknown and check if value exists by Response-Return and write them back instant.
Hope you could follow :)