ioBroker / ioBroker.zigbee

Zigbee communcation with Hue, Xiaomi, Lighttify... via TI CC2xxx USB stick
MIT License
313 stars 190 forks source link

battery stat from xiaomi #20

Closed arteck closed 6 years ago

arteck commented 6 years ago

can you check the xiaomi battery handling. my sensoers and switsches has wrong batt percent grafik

battery was removed and replaced.. same result

kirovilya commented 6 years ago

It come from min/max interval https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/fromZigbee.js#L12 and linear conversion of the current voltage https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/fromZigbee.js#L19 Look at the sensor voltage and understand how the percentage depends.

The question about the min and max value has already been discussed and so far we have stopped on this interval.

arteck commented 6 years ago

i think the problem is a different value from xiaomi and other devices here

const battery3V = { min: 2700, max: 3000, };

all my devices has a percentage value 100 .. this is wrong..

GermanBluefox commented 6 years ago

In debug you can see the voltage. What is the value do you have?

пт, 27 июл. 2018 г. в 13:36, arteck notifications@github.com:

i think the problem is a different value from xiaomi and other devices here

const battery3V = { min: 2700, max: 3000, };

all my devices has a percentage value 100 .. this is wrong..

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ioBroker/ioBroker.zigbee/issues/20#issuecomment-408393324, or mute the thread https://github.com/notifications/unsubscribe-auth/AEXqgKa4LJTF1s39UiE1kxmm8YeWULrbks5uKvtYgaJpZM4VIvxo .

arteck commented 6 years ago

my problem is not the voltage .. the percentage is wrong

GermanBluefox commented 6 years ago

I understand, but what the voltage delivers YOUR devices, if you think the percentage is wrong?

arteck commented 6 years ago

3012 is the voltage

GermanBluefox commented 6 years ago

And why you think that 100% is wrong? Elsewise can you suggest your formula? I have done long time ago the percent calculation and it was devil complex, because the ratio of the voltage and percents is not constant.

arteck commented 6 years ago

check this connect one battery device with a xioami gateway .... look for percentage battery.. now disconnect this and connect it with USB-Stick.. what can you see ?? is the percentage same or not ??? or almost the same ??

kirovilya commented 6 years ago

ok-ok. in dev branch I added new calculation battery percent value https://github.com/ioBroker/ioBroker.zigbee/blob/dev/lib/devstates.js#L132 we don't know how gateway calculate this percent. this may be a nonlinear relationship.