hassio-addons: Addon terminates right away (Mi Composition Scale 2)

Describe the bug Add-on starts but terminates immediately. Does not seem to detect my scale (not sure if it does, see log below). Also tried with BLUEPY_PASSIVE_SCAN set to true without success. I’ve set the MISCALE_VERSION to 2.

This is my config:

HCI_DEV: hci0
BLUEPY_PASSIVE_SCAN: false
MISCALE_MAC: "!secret xiaomi_mi_scale_mac"
MISCALE_VERSION: 2
MQTT_PREFIX: miscale
MQTT_HOST: localhost
MQTT_USERNAME: "!secret default_username"
MQTT_PASSWORD: "!secret default_password"
MQTT_PORT: 1883
MQTT_RETAIN: true
MQTT_DISCOVERY: true
MQTT_DISCOVERY_PREFIX: homeassistant
MQTT_TLS_CACERTS: Path to CA Cert File
MQTT_TLS_INSECURE: false
TIME_INTERVAL: 30
USERS:
  - NAME: ...
    SEX: ...
    GT: ...
    LT: ...
    HEIGHT: ...
    DOB: "..."

To Reproduce Reproducible by (re-)starting the addon. Unfortunately, there are no errors and there seems to be no logging scheme that prints more (no “verbose” option). If I refresh the addon page in HA, it says “Start” again (indicating that it has terminated).

Expected behaviour I expect that it remains started and “searches” for the scale.

Scale:

  • Name: Mi Body Composition Scale 2
  • Model: XMTZC05HM

Device running Home Assistant:

  • Raspberry Pi 4B
  • USB Dongle for Bluetooth (with a dedicated cable)

Additional context Here’s the log:

-------------------------------------
2022-10-02 19:20:37 - Starting Xiaomi mi Scale...
2022-10-02 19:20:37 - Loading Config From Add-On Options...
2022-10-02 19:20:37 - Config Loaded...
-------------------------------------
2022-10-02 19:20:37 - Initialization Completed, Waiting for Scale...

Please let me know if you need more information or if there’s something where I can help you with. 😃

Edit: My bluetooth device seems to be detected fine:

$ hcitool dev
Devices:
	hci0	XX:XX:XX:XX:XX:XX

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 39 (22 by maintainers)

Most upvoted comments

Same problem here. I’m using MISCALE_VERSION: 1

@MariusHerget Xiaomi have a weird way of naming their scales. They have ( to my knowledge) released 4 scales, 2 x V1, 2 x V2. What’s generally considered a V2 scale is the Body Composition Scale (the one that reads impedance via metal pads). You have the 2nd model of the V1 range.

Same problem here (after update)

Hi

I still have this issue.

Tried both HC0 and HC1 (I have raspberry pi and one external dongle)

My Log :

Xiaomi Mi Scale


2022-10-09 08:13:44 - Starting Xiaomi mi Scale… 2022-10-09 08:13:44 - Loading Config From Add-On Options… 2022-10-09 08:13:44 - Config Loaded… 2022-10-09 08:13:44 - MQTT Discovery Setup Completed…

2022-10-09 08:13:44 - Initialization Completed, Waiting for Scale…

v0.3.3 is working fine for me, thank you SO MUCH! 😃

Closing this now. 😃

@lolouk44 please elaborate - Everywhere I look (e.g. Zepp Life App) or search the model number it says “Mi Smart Scale 2”. Is it just a dumb naming schema or am I missing something?

and btw: thanks for helping us out so quickly!

Thanks @MariusHerget and @jgalerap. I know what the issue is and you’ll be glad to know it’s not your fault 😄 I’ll try and fix it later tonight.

You are a hero! Thanks 😃

(And thanks for indirectly forcing me to test my backup and recovery structure. Found some flaws 😅)

Thanks @MariusHerget and @jgalerap. I know what the issue is and you’ll be glad to know it’s not your fault 😄 I’ll try and fix it later tonight.

@CodeFinder2 The issue was the missing dbus sharing from HA to the add-on (required for bleak to work) MQTT is only connected to when sending a new measure, it’s not connected otherwise. So you should see a log entry before and after trying to connect to the MQTT Broken when weight is received. Can you try and get the batteries out and back in to reset the scale, then steo on the scale to see if you get anything?

Do me a favour, create a new issue asking for V1 support. Bleak works differently than bluepy used to and not sure what data is actually sent and under what service on a V1 scale, so I’ll need your help toubleshooting this…

@jgalerap @MariusHerget do you both have a V1 scale?

I have a v1, YES.

@MariusHerget seems to have a V2. See this comment https://github.com/lolouk44/hassio-addons/issues/63#issuecomment-1265165058

Can’t install lolouk44/xiaomi-mi-scale-ha-add-on:0.3.2

it’s being built (see here), give it 10-15 min

If you need any help to investigate or debug, please do not hesitate to reach out!

Think I’ve just figured out why. Combination of github sync fail and missing option for the add-on. About to publish latest revision which should fix the issue

There are issues with the add-on specifically unfortunately (working fine on the stand-alone container). Investigating…

If you need any help to investigate or debug, please do not hesitate to reach out!