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

Failed with Mi Scale 1 #1

Closed
qbzwbtf46xtw1zod opened this issue Jun 2, 2019 · 2 comments
Closed

Failed with Mi Scale 1 #1

qbzwbtf46xtw1zod opened this issue Jun 2, 2019 · 2 comments

Comments

@qbzwbtf46xtw1zod
Copy link

I tried to run code with Mi Scale 1 and it errored out. I believe that line 73 in Xiaomi_Scale.py should be
self._publish(round(measured, 2), unit, "", "")
instead of
self._publish(round(measured, 2, "", ""), unit)

@lolouk44
Copy link
Owner

lolouk44 commented Jun 5, 2019

Thanks. As per the README I don't have a V1 scale so never gave it much attention, but more than happy to work with you to get it up to the same level as the V2 Scale.
Did you test and confirm your code is working?
Had a quick look and the publish function:
def _publish(self, weight, unit, mitdatetime, miimpedance):

Therefore the function call should actually be:
self._publish(round(measured, 2), unit, "", "")

I've amended the code to reflect this

Last but not least, is this the only thing that needs fixing to make it work with a V1 scale?

@qbzwbtf46xtw1zod
Copy link
Author

I'm no coder but after i moved the empty strings behind the unit variable the code did work without problems.
Other than that, I didn't have any problems. The code work perfectly with the V1 scale. I'm using your sensor block template for Home Assistant too and everything is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants