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

MQTT discovery issue? #65

Closed
1 task done
btehan opened this issue Oct 4, 2022 · 10 comments
Closed
1 task done

MQTT discovery issue? #65

btehan opened this issue Oct 4, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@btehan
Copy link

btehan commented Oct 4, 2022

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

  • Xiaomi Mi Scale

Describe the bug
I am running HAOS in a VM and have installed Xiaomi Mi Scale v0.3.3 as an add-on. Here's my config:

HCI_DEV: hci0
BLUEPY_PASSIVE_SCAN: false
MISCALE_MAC: xx:xx:xx:xx:xx:xx
MISCALE_VERSION: 1
MQTT_PREFIX: miscale
MQTT_HOST: 192.168.4.19
MQTT_USERNAME: username
MQTT_PASSWORD: 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: true
TIME_INTERVAL: 30
USERS:

  • NAME: Brian
    SEX: male
    GT: 160
    LT: 200
    HEIGHT: 180
    DOB: "year-month-day"

The add-on starts and the logs after I weigh myself look good:


2022-10-04 14:54:31 - Starting Xiaomi mi Scale...
2022-10-04 14:54:31 - Loading Config From Add-On Options...
2022-10-04 14:54:31 - Config Loaded...

2022-10-04 14:54:31 - Initialization Completed, Waiting for Scale...
2022-10-04 14:54:39 - Publishing data to topic miscale/Brian/weight: {"weight":173.30,"weight_unit":"lbs","bmi":24.26,"basal_metabolism":1551.53,"visceral_fat":14.32,"timestamp":"2022-10-04T14:54:39+00:00"}
2022-10-04 14:54:39 - Data Published ...
2022-10-04 14:54:51 - Publishing data to topic miscale/Brian/weight: {"weight":168.50,"weight_unit":"lbs","bmi":23.59,"basal_metabolism":1519.01,"visceral_fat":13.24,"timestamp":"2022-10-04T14:54:51+00:00"}
2022-10-04 14:54:51 - Data Published ...
2022-10-04 14:55:01 - Publishing data to topic miscale/Brian/weight: {"weight":173.00,"weight_unit":"lbs","bmi":24.22,"basal_metabolism":1549.44,"visceral_fat":14.25,"timestamp":"2022-10-04T14:55:01+00:00"}
2022-10-04 14:55:01 - Data Published ...

I am able to see the data in my MQTT broker (EMQX) when I go to Configuration >> MQTT >> Retainer >> miscale/Brian/weight >> Show Payload:

{
"weight": 173,
"weight_unit": "lbs",
"bmi": 24.22,
"basal_metabolism": 1549.44,
"visceral_fat": 14.25,
"timestamp": "2022-10-04T14:55:01+00:00"
}

Using MQTT explorer connected to the broker, I am able to see the same three entries as the add-on logs:

{"weight":173.00,"weight_unit":"lbs","bmi":24.22,"basal_metabolism":1549.44,"visceral_fat":14.25,"timestamp":"2022-10-04T14:55:01+00:00"}
{"weight":168.50,"weight_unit":"lbs","bmi":23.59,"basal_metabolism":1519.01,"visceral_fat":13.24,"timestamp":"2022-10-04T14:54:51+00:00"}
{"weight":173.30,"weight_unit":"lbs","bmi":24.26,"basal_metabolism":1551.53,"visceral_fat":14.32,"timestamp":"2022-10-04T14:54:39+00:00"}

However, what I'm not seeing are weight sensors in HA via MQTT discovery. I always struggle with MQTT, so I feel that this is a config issue on my end, but I could use a hand in figuring this out, please.

To Reproduce
Install the add-on, point it at MQTT broker, weigh yourself.

Expected behaviour
From the docs, I had expected an entity in HAOS for my weight. I'm not seeing any when I go to HAOS >> Developer Tools >> States and look for any of the above info.

Scale (please complete the following information):

  • xiaomi
  • 1st gen

Device running Home Assistant (please complete the following information):

  • HAOS VM on proxmox 7.2
  • USB Dongle
@btehan btehan added the bug Something isn't working label Oct 4, 2022
@radek-kafka
Copy link

radek-kafka commented Oct 4, 2022

I can see the same.. the function for MQTT_Discovery is not called so new sensors after adding/changing of new user is not called.. I do not see any messages adding of sensor to be published in mqtt ..

@lolouk44
Copy link
Owner

lolouk44 commented Oct 5, 2022

Thanks for bringing this up. Fixed in 0.3.4 which should be built in 10-15 min

@twangraus
Copy link

@lolouk44 is the BLUEPY_PASSIVE_SCAN option still relevant, as the bluepy is no longer supported?

@lolouk44
Copy link
Owner

lolouk44 commented Oct 5, 2022

@twangraus no, not at this stage. I'm still investigating if and how to bring this functionality, but it feels like it was a workaround to make bluepy work / to bypass some of bluepy flaws.
I've not had any reports of either add-on or standalone container failing while using bleak in active mode.

@lolouk44
Copy link
Owner

lolouk44 commented Oct 5, 2022

@btehan @radek-kafka can you confirm MQTT Discovery is working and close this issue if applicable?

@radek-kafka
Copy link

@btehan @radek-kafka can you confirm MQTT Discovery is working and close this issue if applicable?

I did re-install .. Readme is version 0.3.4 but the code is the old one 0.3.3 .. Also version shown is still 0.3.3.. Shall be patient and wait till image is ready .. :) Many thanks

@lolouk44
Copy link
Owner

lolouk44 commented Oct 5, 2022

Code in 0.3.4 is defo updated. You may need to reboot your HA instance to it can catch up with the update

@btehan
Copy link
Author

btehan commented Oct 5, 2022

0.3.4 fixed this. Thank you @lolouk44 :⁠-⁠)

@btehan btehan closed this as completed Oct 5, 2022
@radek-kafka
Copy link

Shall be ok:) Thx ..
022-10-05 13:56:53 - Starting Xiaomi mi Scale...
2022-10-05 13:56:53 - Loading Config From Add-On Options...
2022-10-05 13:56:53 - Config Loaded...
2022-10-05 13:56:53 - MQTT Discovery Setup Completed...

2022-10-05 13:56:53 - Initialization Completed, Waiting for Scale...

@RestOp
Copy link

RestOp commented Jan 17, 2023

I have this problem till now, version 0.3.6
No sensors are created...

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

5 participants