Skip to content

Unit of Measure in exported entity not correct #22

Closed
@benquan

Description

@benquan

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}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions