-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Added support for Mi Scale V1 #13517
Conversation
As part is untested let's hold this for now. |
Tested the firmware with "MI Smart Scale 2" Model XMTZC04HM on Sonoff DUAL R3 It's showing Mi Scale V1, correctly reading Weight, Weight removed and Stabilized (I have 5 BLE devices and the inerface keeps switching between showing 4 ATC Thermometers and Mi Scale - but assuming that work as intended) I would love to see "When direct bridging is not enabled" supported, as "MI32Option2 1" is flooding with the sensory data |
https://tasmota.github.io/docs/Commands/#mi32page
Not sure to understand the point. |
Because currently telemetry is always sending "weight": 0", because that is the last data received, and the actual weight never get sent
Thanks, didn't notice that :) |
Understood, for normal usage, I would imagine that requires some state machine to send information only when someone get on/off and measure is stabilized. |
Sadly, it keeps sending data even when not used anymore, less frequently but still last message is weight 0, so the actual weighed value is lost (never send to Home Assistant) if direct bridging of BLE-data is not enabled. But yes, you can always filter it on PC like Author, so it's not really a problem if you know that. |
This is exactly what i ment with "room for improvements". Checking the code i think this can easily be extended with this:
I haven't tried it out yet. Basically it should drop the packet when direct bridging is not enabled and weight is not stabilized or removed. |
No, i am not planing to add this to the HM10 driver. I am only planing to update this PR when i have a bit more time with the additional code that i have posted above. Still need to test it. |
I create PR for HM10. |
Hi I would like to test it, but how can i make a firmware? can someone give me a firmware-file for ESP32? I have an ESP32-CAM board. Would be nice if someone could release it here. thx |
@atifan PR > Checks > Top Right "Artifacts" |
@kolorafa thx very much :) |
Hi I have it running now, works fine :) |
You can do this with "WeightRes 2" on the console |
I have updated the PR with the additional changes above. When directBridgeMode is disabled only stabilized weights will be used for MQTT and WebUI. Also the "stabilized" and "weight_removed" parameters are removed in that case. |
Hi @dcoder42 thank you very much for the fast answer :) |
Pls let me know if this PR is ready to merge. |
Hi, I have the problem that my settings always get resettet, maybe a bootloop problem. |
MI32Options are not persistent. You need to use startup rules to keep the settings: Example (run on console): rule1 on System#Boot do backlog MI32Option1 1;MI32Option2 1;MI32Option6 1 endon Can't really say why you get reboots. Which scale are you using? The one with or without impedance measurement? |
…abilized value from V1 and changed stabilized/has_impedance to weight_stabilized/impedance_stabilized
Hi. I am using the Xiaomi Smart Scale 2 (XMTZC04HM). Without this impedance measurement. |
I own the same device. I can only recommend to try another power supply or reflash the device again. |
OK thx, i will try :) |
This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions. |
p/s other thing - I think ESP internal temp need to be splitted from last sensor values block. |
Thanks for testing :) It might be related to line 1760: I commented out "impedance_stabilized" because i was not sure how it behaves. Maybe when stepping off the scale the weight values are locked for a couple of seconds while impedance might still be changing. Can you try to remove the comment to enable the additional "impedance_stabilized" check. Should be: I am also not sure if we should add "Ohms" as measurement unit to the impedance value. |
@dcoder42 tested. Think it is not best way - better to update weight and imp separately and check values
|
Maybe this will work. It should update weight and impedance independant from each other.
|
@dcoder42 sorry, not too fast. My board bad designed (i forgot about boot button and now need to use a set of wires))) now is better) With
works as expected Additionally I change
now ESP32 temp separated by line) p/s Code works fine in web GUI, but can't undestand how HOME assistant autodiscovery ('SO19 1') works with ble sensors on ESP32. It works on esp8266, but there It not working.. ( |
About Mqtt
must be changed to something like
because wait for tele period between measurements is ubnormal (I check my weight and then my wife need to wait 5 min (by default) to put both values to HA - it is terrible:) ) |
Thanks. I will update the PR with this change. Maybe next week, when i have a bit more time.
I think this should be changed in Esp32SensorShow() in xsns_127_esp32_sensors.ino and this should be done in another PR because it is not related to the Mi Scale
It's the MI32DiscoveryOneMISensor function but it is not compiled into the default firmware. To get SetOption19 to work i had to enable USE_HOME_ASSISTANT and disable USE_TASMOTA_DISCOVERY in tasmota_configurations_ESP32.h. |
Thanks! I'll check |
…e mode is enabled. Fixed impedance measurement on V2 scale.
IMO this is ready to be merged |
Description:
Not sure if it's useful but this PR adds support for the Xiaomi Mi Scale V1. I also added support for V2 but this is untested due to lack of hardware. The code is based on the Passive BLE monitor addon for Home Assistant.
There is probably room for optimizations. For example: In my setup i have MI32Option2 (direct bridging) enabled and all messages are directly pushed to Home Assistent where i have rules to handle "stabilized" and "weight_removed" properties. When direct bridging is not enabled the code could store weight only when stabilized=1 and weight_removed=0 so the MQTT message at the next TELEPERIOD would only transmit the stabilized weight.
Reference: https://github.com/custom-components/ble_monitor/blob/master/custom_components/ble_monitor/ble_parser/miscale.py
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass