-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Extension of XMTZC05HM decoder - Pulled back _XMTZC05HM_json_props into XMTZC05HM_json.h - Renamed "model" to more informative "Mi_Body_Scale_2" and amended description in the docs - Implemented 'stabilised' only decoding for XMTZC05HM - Recognises 'stabilised' 2 (scale display active) and 'stabilised' a (scale display deactivated) to guarantee published 'stabilised' reading without the need for very short TimeBtwRead - New 'mode' attribute to indicate if the weighing was of a person or a small object (if this option is activated in the scale's settings). This allows filtering to only record person readings in HA or openHAB - Only publish 'impedance' attribute if the weighing of a person was done barefoot and the impedance value could be recorded correctly I suspect that the 1st version of the Mi Body Composition Scale (XMTZCO2HM) is also being recognised by this decoder, and should therefor be mentioned in the docs and published model_id, but without confirmation of XMTZCO2HM owners this is just a guess. * Extend properties conditions to use "OR" and "AND" params. * XMTZC05HM final adjustments Small final changes • abbreviated property names for discovery inclusion • decoder back to original _XMTZC05HM_json Co-authored-by: h2zero <[email protected]>
- Loading branch information
Showing
5 changed files
with
221 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Xiaomi MiScale V2 | ||
# Xiaomi Mi Body Composition Scale 2 | ||
|
||
|Model Id|[XMTZC05HM](https://github.com/theengs/decoder/blob/development/src/devices/XMTZC05HM_json.h)| | ||
|-|-| | ||
|Brand|Xiaomi| | ||
|Model|MiScale V2| | ||
|Short Description|Second version of the scale| | ||
|Model|Mi Body Scale 2| | ||
|Short Description|Second version of the Mi Body Composition Scale| | ||
|Communication|BLE broadcast| | ||
|Frequency|2.4Ghz| | ||
|Power source|3 AAA| | ||
|Exchanged data|unit, weight, impedance| | ||
|Power source|4 AAA| | ||
|Exchanged data|weighing_mode, unit, weight, impedance| | ||
|Encrypted|No| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,59 @@ | ||
#include "common_props.h" | ||
|
||
const char* _XMTZC05HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Miscale_v2\",\"model_id\":\"XMTZC05HM\",\"condition\":[\"uuid\",\"contain\",\"181b\"],\"properties\":{\"unit\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",200]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"lbs\"]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",100]},\"impedance\":{\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false]}}}"; | ||
const char* _XMTZC05HM_json = "{\"brand\":\"Xiaomi\",\"model\":\"Mi_Body_Scale_2\",\"model_id\":\"XMTZC05HM\",\"condition\":[\"servicedata\",\"index\",2,\"2\",\"|\",\"servicedata\",\"index\",2,\"a\",\"&\",\"uuid\",\"contain\",\"181b\"],\"properties\":{\"weighing_mode\":{\"condition\":[\"servicedata\",1,\"2\",\"|\",\"servicedata\",1,\"3\"],\"decoder\":[\"static_value\",\"person\"]},\"_weighing_mode\":{\"condition\":[\"servicedata\",1,\"6\",\"|\",\"servicedata\",1,\"7\"],\"decoder\":[\"static_value\",\"object\"]},\"unit\":{\"condition\":[\"servicedata\",1,\"2\",\"|\",\"servicedata\",1,\"6\"],\"decoder\":[\"static_value\",\"kg\"]},\"_unit\":{\"condition\":[\"servicedata\",1,\"3\",\"|\",\"servicedata\",1,\"7\"],\"decoder\":[\"static_value\",\"lbs\"]},\"weight\":{\"condition\":[\"servicedata\",1,\"2\",\"|\",\"servicedata\",1,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",200]},\"_weight\":{\"condition\":[\"servicedata\",1,\"3\",\"|\",\"servicedata\",1,\"7\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",22,4,true,false],\"post_proc\":[\"/\",100]},\"impedance\":{\"condition\":[\"servicedata\",3,\"6\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",18,4,true,false]}}}"; | ||
/*R""""( | ||
{ | ||
"brand":"Xiaomi", | ||
"model":"Miscale_v2", | ||
"model":"Mi_Body_Scale_2", | ||
"model_id":"XMTZC05HM", | ||
"condition":["uuid", "contain", "181b"], | ||
"condition":["servicedata", "index", 2, "2", "|", "servicedata", "index", 2, "a", "&", "uuid", "contain", "181b"], | ||
"properties":{ | ||
"weighing_mode":{ | ||
"condition":["servicedata", 1, "2", "|", "servicedata", 1, "3"], | ||
"decoder":["static_value", "person"] | ||
}, | ||
"_weighing_mode":{ | ||
"condition":["servicedata", 1, "6", "|", "servicedata", 1, "7"], | ||
"decoder":["static_value", "object"] | ||
}, | ||
"unit":{ | ||
"condition":["servicedata", 1, "2"], | ||
"condition":["servicedata", 1, "2", "|", "servicedata", 1, "6"], | ||
"decoder":["static_value", "kg"] | ||
}, | ||
"_unit":{ | ||
"condition":["servicedata", 1, "3", "|", "servicedata", 1, "7"], | ||
"decoder":["static_value", "lbs"] | ||
}, | ||
"weight":{ | ||
"condition":["servicedata", 1, "2"], | ||
"condition":["servicedata", 1, "2", "|", "servicedata", 1, "6"], | ||
"decoder":["value_from_hex_data", "servicedata", 22, 4, true, false], | ||
"post_proc":["/", 200] | ||
}, | ||
"_unit":{ | ||
"condition":["servicedata", 1, "3"], | ||
"decoder":["static_value", "lbs"] | ||
}, | ||
"_weight":{ | ||
"condition":["servicedata", 1, "3"], | ||
"condition":["servicedata", 1, "3", "|", "servicedata", 1, "7"], | ||
"decoder":["value_from_hex_data", "servicedata", 22, 4, true, false], | ||
"post_proc":["/", 100] | ||
}, | ||
"impedance":{ | ||
"condition":["servicedata", 3, "6"], | ||
"decoder":["value_from_hex_data", "servicedata", 18, 4, true, false] | ||
} | ||
} | ||
})"""";*/ | ||
|
||
const char* _XMTZC05HM_json_props = _common_weight_impedance_props; | ||
const char* _XMTZC05HM_json_props = "{\"properties\":{\"weighing_mode\":{\"unit\":\"string\",\"name\":\"weighing_mode\"},\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"},\"impedance\":{\"unit\":\"Ohm\",\"name\":\"impedance\"}}}"; | ||
/*R""""( | ||
{ | ||
"properties":{ | ||
"weighing_mode":{ | ||
"unit":"string", | ||
"name":"weighing_mode" | ||
}, | ||
"weight":{ | ||
"unit":"kg", | ||
"name":"weight" | ||
}, | ||
"impedance":{ | ||
"unit":"Ohm", | ||
"name":"impedance" | ||
} | ||
} | ||
})"""";*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.