Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linear battery voltage #208

Merged
merged 10 commits into from
Dec 22, 2019
Merged

Conversation

roblandry
Copy link
Contributor

@roblandry roblandry commented Dec 1, 2019

Initial implementation of linear battery voltages.

Fixes: #199
Potential fix: #176

Reported values:

  • Existing batteries:
    • [zhaquirks] CentraLite 3321-S Voltage [RAW]:29 [Max]:2.8 [Min]:1.5, Battery Percent: 100.0
    • [zhaquirks] CentraLite 3325-S Voltage [RAW]:29 [Max]:2.8 [Min]:1.5, Battery Percent: 100.0
  • New batteries:
    • [zhaquirks] SmartThings tagv4, Voltage [RAW]:30 [Max]:2.8 [Min]:1.5, Battery Percent: 100.0

zhaquirks/__init__.py Outdated Show resolved Hide resolved
zhaquirks/__init__.py Outdated Show resolved Hide resolved
@dmulcahey
Copy link
Collaborator

@Adminiuga wanna give this a peek when you have a moment? LMK if you think the strategy is good and if so i'll merge it in. Thanks.

log_msg = (
f"{self.endpoint.device.manufacturer} {self.endpoint.device.model}, "
f"Voltage [RAW]:{raw_value} [Max]:{self.MAX_VOLTS} "
f"[Min]:{self.MIN_VOLTS}, Battery Percent: {percent/2}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't use F-Strings for logging, ie no need to format something that might not see the light of the day at all.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roblandry wanna change this so it can be merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Adminiuga
Copy link
Contributor

other than debug log formatting looks good to me.

@roblandry roblandry changed the title [WIP] Linear battery voltage Linear battery voltage Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants