0x5e / homebridge-tuya-platform

Make homebridge-tuya-platform great again.
MIT License
206 stars 58 forks source link

Tesla PIR Battery camera - percentage of battery not correct #387

Open Kositch opened 8 months ago

Kositch commented 8 months ago

Prerequisite

Cache

Version

v1.7.0-beta.51

Device Infomation JSON File

No response

Device Control Mode

None

Logs

No response

Other Infomations

Camera shows much lower battery level in Home app (5% of battery) even though battery level is 45% in Tuya app. I have found out that when charging the camera, battery - percentage in Home app got higher and it seems that it show real battery percentage divided by 10 - when Tuya shows 60% it shows 6%, when Tuya app shows 45% it shows 5%, when Tuya app shows 70% it shows 7% in the Home app. I have removed it from Cached accessories, it added itself again but still showing 5% percentage of battery. Not sure since when it does not show correct %, but at the beginning it worked correctly. Stream from camera works flawlessly. Not able to paste .json files or log, sorry for understanding. 2023-10-11_08-29-56

Kositch commented 8 months ago

So I can confirm, that after charging camera to 100% it shows 10% in Home app. So it shows battery percentage divided by 10.

0x5e commented 8 months ago

there's options to fix this, please see advanced options. it can't be fixed automatically for all products because some product like yours are wrong configured by manufacture :(

Kositch commented 8 months ago

there's options to fix this, please see advanced options. it can't be fixed automatically for all products because some product like yours are wrong configured by manufacture :(

Hi, not sure what Advanced option you are refering to - I have only this option in Advance plugin settings. 2023-10-20_07-15-03

0x5e commented 8 months ago

similar like this example: https://github.com/0x5e/homebridge-tuya-platform/blob/develop_1.7.0/ADVANCED_OPTIONS.md#adjust-integer-dp-ranges

try this:

{
  code: 'battery_code_of_yours',
  mode: 'ro',
  type: 'Integer',
  property: { unit: '%', min: 0, max: 100, scale: 0, step: 1 }
}