Are you guys thinking into making this an official component? Would be easier to use. Were you able to make it works? Would love to see my data sent to my Home assistant directly instead of having to bring my mobile with me all the time
no idea if anyone is doing this. only thing is that the component would need to know what type/version of scale is being linked. I personally don’t have the knowledge of skill to create a component I’m afraid.
Hi,
If it can help anybody here, I’ve recently created https://github.com/Wingjam/ReverseMiScale mostly a Python port of https://github.com/perillamint/node-xiaomi-scale.
This Python code run perfectly on my Raspberry Pi.
Jonathan
Hi! I was install your add-on. For command sudo python3 example.py
I see this out:
{
“UUID”: “181b”,
“address”: “c6:da:34:3c:ae:cc”,
“isStabilized”: false,
“loadRemoved”: false,
“manufacturerData”: “5701c6da343caecc”,
“rawData”: “02a4e2070b1d152c1dfdff043d”,
“sequence”: 7677,
“unit”: “kg”,
“weight”: 290.1
}
How I can use it for Home Assistant? And my weight is not correct.
Hi,
Currently this project does not support Home Assistant (and is not plan to). If you want to create a port for Home Assistant (let’s say exampleHomeAssistant.py), feel free to do it because i’m not an expert with Home Assistant.
The weight is not correct … that’s strange, my weight is good for me. I will investigate some time in this. Which unit did you choose under the scale (there is a toggle button beside batteries)?
Jonathan
if it helps anyone I’ve loaded a copy of my script here:
https://github.com/lolouk44/xiaomi_mi_scale/blob/master/Xiaomi_Scale.py
Hi,
Is it possible to use Xiaomi Mi scale in Home assistant under Hass.io ?
If I understand correctly, the solutions here required to run sudo with is not supported in Hass.io.
Can anyone help ?
Hi.
Yes, this would be interesting to have an easy integration with hassio.
Thanks.
Hi,
Also very interested in integrating this with Hassio.
Thanks!
If anyone is interested on contributing, please, check my github:
https://github.com/tiagofreire-pt/xiaomi_mi_scale
Regards.
I’m using my gateway for miscale integratoin, and other ble devices: https://github.com/zewelor/bt-mqtt-gateway
Can I just ask how does you miscale communicate with your machine running HA? Surely the bluetooth range between the 2 has to be minimum in order to achieve any connection? Is that correct? And what are the ranges we are talking about?
Can I have my miscale in the bathroom and pi running HA in another room and expect them to talk via bluetooth?
Thanks
It’s Bluetooth si you’re looking at standard 10m / 3 feet I guess. My scale is in the bathroom which happens to be on first floor almost right above the ha server that’s on the ground floor
I’m using raspberry pi zero w, which runs my gateway. My HA server is in the basement so no BLE range from there In your scenario ( bathroom and next room, or 2 rooms next ). Bluetooth on rpi with HA, it should work without any problems.
@Michal_Ciemiega @lolouk44 Right thanks for that. I want to get one from aliexpress do you guys recommend mi scale 1 or 2? And which one would work with HA via the BLE mqtt integration?
Also is there a docker image for the BLE MQTT integration?
Thanks
I got mi scale 1, and it works
Thanks guys.
Do you know if there is a docker image for the BLE MQTT integration?
sorry I don’t know any, though above script has everything
If MQTT integration doesn’t work, you can try a bash command instead.
You’d basically need to remove:
- replace
import paho.mqtt.client as mqtt
withimport subprocess
- remove the mqtt bits (
def __init__(self):
anddef _start_client(self):
) - replace
self.mqtt_client.publish(prefix, weight, qos=1, retain=True)
with
MQTT_Command = ["mosquitto_pub", "-h", MQTT_HOST, "-p", MQTT_PORT, "-u", MQTT_USER, "-P", MQTT_PASSWORD, "-t", prefix, "-r", "-m", weight, "-q", "1"]
ps = subprocess.Popen(MQTT_Command)
- replace
self.mqtt_client.publish(prefix, mitdatetime, qos=1, retain=True)
with
MQTT_Command = ["mosquitto_pub", "-h", MQTT_HOST, "-p", MQTT_PORT, "-u", MQTT_USER, "-P", MQTT_PASSWORD, "-t", prefix, "-r", "-m", mitdatetime, "-q", "1"]
ps = subprocess.Popen(MQTT_Command)
- replace
self.mqtt_client.publish(prefix, miimpedance, qos=1, retain=True)
with
MQTT_Command = ["mosquitto_pub", "-h", MQTT_HOST, "-p", MQTT_PORT, "-u", MQTT_USER, "-P", MQTT_PASSWORD, "-t", prefix, "-r", "-m", miimpedance, "-q", "1"]
ps = subprocess.Popen(MQTT_Command)
So let me get this right:
- you connect your mi scale to your raspberry via bluetooth permanently
- the raspberry is running your script 24/7 as a cron job in the background.
- the data obtained from the scale is transferred to raspberry via bluetooth and to mqtt via your script.
- the mqtt data can then be linked to HA.
Is that how it works?