Closed
Description
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
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