Closed ibanmda closed 2 years ago
It looks like an issue connecting to mqtt. Check your config to ensure you have the correct mqtt details
Ok. I was wrong in ip address of MQTT server... But now only return this:
-------------------------------------
2022-01-03 23:53:00 - Starting Xiaomi mi Scale...
2022-01-03 23:53:00 - Loading Config From Add-On Options...
2022-01-03 23:53:00 - Config Loaded...
2022-01-03 23:53:00 - Discovery Completed...
2022-01-04 00:45:54 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
2022-01-04 00:46:24 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
2022-01-04 00:46:54 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
2022-01-04 00:47:24 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
2022-01-04 00:48:29 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
2022-01-04 00:48:59 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
2022-01-04 00:49:29 - Bluetooth connection error: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
sensor.iban_weightiban weight | unknown |
---|
HCI_DEV: hci0
BLUEPY_PASSIVE_SCAN: true
MISCALE_MAC: XX:XX:XX:XX:XX:XX
MQTT_PREFIX: miscale
MQTT_HOST: 192.168.1.2
MQTT_USERNAME: user
MQTT_PASSWORD: password
MQTT_PORT: 1883
TIME_INTERVAL: 30
MQTT_DISCOVERY: true
MQTT_DISCOVERY_PREFIX: homeassistant
USERS:
- NAME: iban
SEX: male
GT: 60
LT: 80
HEIGHT: 177
DOB: '1980-01-01'
Now you need to step on the scale to get a measurement
After I step on the scale:
-------------------------------------
2022-01-04 16:28:44 - Starting Xiaomi mi Scale...
2022-01-04 16:28:44 - Loading Config From Add-On Options...
2022-01-04 16:28:44 - Config Loaded...
2022-01-04 16:28:44 - Discovery Completed...
Results from Log Viewer (HA):
2022-01-04 16:28:44 INFO (MainThread) [homeassistant.components.mqtt.discovery] Component has already been discovered: sensor miscale iban, sending update
2022-01-04 16:28:44 INFO (MainThread) [homeassistant.components.mqtt.mixins] Got update for entity with hash: ('sensor', 'miscale iban') '{'name': 'iban Weight', 'state_topic': 'miscale/iban/weight', 'value_template': '{{ value_json.weight }}', 'json_attributes_topic': 'miscale/iban/weight', 'icon': 'mdi:scale-bathroom', 'platform': 'mqtt'}'
2022-01-04 16:28:44 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.iban_weight_3
However, in developer tools (HA), all states from sensors are "unknow"
sensor.iban_weight iban weight | unknown | unit_of_measurement: kg icon: mdi:scale-bathroom friendly_name: iban weight
sensor.iban_weight_2 Iban Weight | unknown | icon: mdi:scale-bathroom friendly_name: Iban Weight
sensor.iban_weight_3 iban Weight | unknown | icon: mdi:scale-bathroom friendly_name: iban Weight
sensor.yaml
- platform: mqtt
name: "iban Weight"
state_topic: "miscale/iban/weight"
value_template: "{{ value_json['weight'] }}"
unit_of_measurement: "kg"
json_attributes_topic: "miscale/iban/weight"
icon: mdi:scale-bathroom
- platform: mqtt
name: "iban BMI"
state_topic: "miscale/iban/weight"
value_template: "{{ value_json['bmi'] }}"
icon: mdi:human-pregnant
unit_of_measurement: "kg/m2"
I'm very lossed. Excuse me :|
After I step on the scale:
------------------------------------- 2022-01-04 16:28:44 - Starting Xiaomi mi Scale... 2022-01-04 16:28:44 - Loading Config From Add-On Options... 2022-01-04 16:28:44 - Config Loaded... 2022-01-04 16:28:44 - Discovery Completed...
if this is all you see from the add-on logs, your scale is not communicating correctly. 1) do you have the Xiaomi App running on your phone? If so kill it, the scale can only communicate with 1 bluetooth device simultaneously 2) are you sure you have the correct MAC address for your scale in the settings? 3) are you sure your scale is close enough to the Raspberry Pi? 4) can you share your sensor templates?
if this is all you see from the add-on logs, your scale is not communicating correctly.
- do you have the Xiaomi App running on your phone? If so kill it, the scale can only communicate with 1 bluetooth device simultaneously
No. I don't have Xiaomi App in my smartphone. Never has been installed. Bluetooth OFF in my phone. Not Bluetooth devices near. Only a zigbee devices. Its a problem?
- are you sure you have the correct MAC address for your scale in the settings?
[bluetooth]# scan on
Discovery started
[NEW] Device 5X:XX:XX:XX:XX:X1 MIBFS
Confirmated. Same MAC address.
- are you sure your scale is close enough to the Raspberry Pi?
In this question i have to say it that is a bit far from Raspberry Pi (about ~6m), because this devices are in differents rooms. I did but it still doesn't work. Logs are similary to the previous messages
Maybe my mistake be the mqtt settings?
MQTT_HOST = 192.168.1.2 (Adress IP of (HA) Mosquitto broker?) My Hassio runs over Raspberry Pi 3b with ip 192.168.1.2
ok that's odd...
[bluetooth]# scan on Discovery started [NEW] Device 5X:XX:XX:XX:XX:X1 MIBFS
If you get this then the scale is within range. Try and take the batteries out then back in again, wait for it to initialise and step on. Once your weight is registered on the scale, logs should show something like this:
2021-12-30 08:50:42 - Publishing data to topic miScale/Lolo/weight: {"weight":72.90,"weight_unit":"kg","bmi":23.80,"basal_metabolism":1453.24,"visceral_fat":13.04,"timestamp":"2021-12-30 08:50:42.140029"}
2021-12-30 08:50:42 - Data Published ...
Would show more if you stepped barefeet and your scale has biometic capabilities. this may take a few seconds depending on your settings. Can you try a tool like MQTT Explorer to confirm what get sent to the broker? can you share your sensor templates?
Finally it works! I taked out the batteries. Then I upgraded and rebooted the HA with succesfuly!
A lot of thanks for your help!
Why can it happen???
Thanks in advance!