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

Unit of Measure in exported entity not correct #22

Closed
1 task done
benquan opened this issue Oct 31, 2020 · 3 comments
Closed
1 task done

Unit of Measure in exported entity not correct #22

benquan opened this issue Oct 31, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@benquan
Copy link

benquan commented Oct 31, 2020

Select Add-On (place a lowercase x for the relevant add-on)

  • Xiaomi Mi Scale

Describe the bug
A clear and concise description of what the bug is.
My scale is set to lbs. And the reading is properly done in lbs but the entity's unit_of_measurement is hardcoded to kg.

To Reproduce
Steps to reproduce the behaviour, including error message if any.
Set a scale to lbs and link to this plugin

Expected behaviour
A clear and concise description of what you expected to happen.
Expected unit_of_measure to be lbs

Screenshots
Screen Shot 2020-10-31 at 3 56 53 PM

Scale (please complete the following information):
My Body Composition Scale
Firmware: 0.3.2

Device running Home Assistant (please complete the following information):
Rapsberri Pi 4 (built in bluetooth)

Additional context

This is where kg gets hardcoded...

def discovery():
    for MQTTUser in (USER1_NAME,USER2_NAME,USER3_NAME):
        message = '{"name": "' + MQTTUser + ' Weight",'
        message+= '"state_topic": "miscale/' + MQTTUser + '/weight","value_template": "{{ value_json.weight }}","unit_of_measurement": "kg",'
        message+= '"json_attributes_topic": "miscale/' + MQTTUser + '/weight","icon": "mdi:scale-bathroom"}'
        publish.single(
                        MQTT_DISCOVERY_PREFIX + '/sensor/' + MQTT_PREFIX + '/' + MQTTUser + '/config',
                        message,
                        retain=True,
                        hostname=MQTT_HOST,
                        port=MQTT_PORT,
                        auth={'username':MQTT_USERNAME, 'password':MQTT_PASSWORD}
@benquan benquan added the bug Something isn't working label Oct 31, 2020
@lolouk44
Copy link
Owner

lolouk44 commented Nov 1, 2020

Can you confirm which version you're using? This was solved in 0.1.8
Latest version is 0.1.10

@benquan
Copy link
Author

benquan commented Nov 1, 2020

Using 0.1.10

@lolouk44
Copy link
Owner

lolouk44 commented Nov 4, 2020

sorry I get it now. It's an issue in the discovery indeed, however you do have the weight_unit attribute which is the correct one.
Unfortunately it is not possible to template a unit of measurement in HA so it's not that relevant anyway
This is a minor aesthetic change so I probably won't create a new version just for this...

@lolouk44 lolouk44 closed this as completed Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants