Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
#include "devices/SBHT_003C_json.h"
#include "devices/SBHT_003C_ENCR_json.h"
#include "devices/VCH6003_json.h"
#include "devices/T9146_json.h"


const char* _devices[][2] = {
Expand Down Expand Up @@ -289,4 +290,5 @@ const char* _devices[][2] = {
{_SBHT_003C_json, _SBHT_003C_json_props},
{_SBHT_003C_ENCR_json, _SBHT_003C_ENCR_json_props},
{_VCH6003_json, _VCH6003_json_props},
{_T9146_json, _T9146_json_props},
};
45 changes: 45 additions & 0 deletions src/devices/T9146_json.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const char* _T9146_json = "{\"brand\":\"eufy\",\"model\":\"Smart Scale C1\",\"model_id\":\"T9146\",\"tag\":\"05\",\"condition\":[\"manufacturerdata\",\"index\",0,\"cfe50c\",\"&\",\"name\",\"contain\",\"eufy T9146\"],\"properties\":{\"weighing_mode\":{\"decoder\":[\"static_value\",\"person\"]},\"unit\":{\"decoder\":[\"static_value\",\"kg\"]},\"weight\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",18,4,true,false],\"post_proc\":[\"/\",100]}}}";
/*R""""(
{
"brand":"eufy",
"model":"Smart Scale C1",
"model_id":"T9146",
"tag":"05",
"condition":["manufacturerdata", "index", 0, "cf", "manufacturerdata", "index", 12, "cf", "&", "name", "contain", "eufy T9146"],
"properties":{
"weighing_mode":{
"decoder":["static_value", "person"]
},
"unit":{
"decoder":["static_value", "kg"]
},
"weight":{
"decoder":["value_from_hex_data", "manufacturerdata", 18, 4, true, false],
"post_proc":["/", 100]
}
}
})"""";*/
// manufacturerdata starts with the mac address (6 bytes / 12 hex chars)
// then constant "cf" plus 13 more bytes / 26 more chars
// total length is 40 chars / 20 bytes
// weight is encoded in hex char position 18 to 22, little endian, as 100ths of kg
// for example, cfe50c0301eccfa2128c232624540100874a9146 => 8c23 => 0x238c => 91.00 kg

const char* _T9146_json_props = "{\"properties\":{\"weighing_mode\":{\"unit\":\"string\",\"name\":\"weighing_mode\"},\"unit\":{\"unit\":\"string\",\"name\":\"unit\"},\"weight\":{\"unit\":\"kg\",\"name\":\"weight\"}}}";
/*R""""(
{
"properties":{
"weighing_mode":{
"unit":"string",
"name":"weighing_mode"
},
"unit":{
"unit":"string",
"name":"unit"
},
"weight":{
"unit":"kg",
"name":"weight"
}
}
})"""";*/
10 changes: 9 additions & 1 deletion tests/python_ble/decoder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
import json

x = {"servicedata":"712098004a63b6658d7cc40d071003f32600"}
x = {
"id": "CF:E5:0C:03:01:EC",
"mac_type": 0,
"adv_type": 0,
"name": "eufy T9146",
"manufacturerdata": "cfe50c0301eccfa2128c232624540100874a9146",
"rssi": -61
}
z = dble(json.dumps(x))
print(z, "\n")

Expand All @@ -16,4 +24,4 @@
y = {}
z = dble(json.dumps(y))
print("decoder result (None expected): ", z)
print("Done")
print("Done")
Loading