Skip to content

Commit

Permalink
Tilt addition & correction (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiH authored Apr 25, 2024
1 parent e2f0f3c commit 8db9446
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/devices/TILT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
|Communication|BLE broadcast|
|Frequency|2.4Ghz|
|Power Source|CR123A|
|Exchanged Data|color, temperature, specific gravity|
|Exchanged Data|color, temperature, specific gravity, txpower @ 1 m|
|Encrypted|No|
14 changes: 11 additions & 3 deletions src/devices/TILT_json.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const char* _TILT_json = "{\"brand\":\"Tilt\",\"model\":\"Brewing Hydro- Thermometer\",\"model_id\":\"TILT\",\"tag\":\"0201\",\"condition\":[\"manufacturerdata\",\"=\",50,\"index\",0,\"4c000215a495bb\",\"&\",\"manufacturerdata\",\"index\",16,\"c5b14b44b5121370f02d74de004403f8c5\"],\"properties\":{\"color\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",14,2],\"lookup\":[\"10\",\"red\",\"20\",\"green\",\"30\",\"black\",\"40\",\"purple\",\"50\",\"orange\",\"60\",\"blue\",\"70\",\"yellow\",\"80\",\"pink\"]},\"tempf\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",40,4,false,true]},\"gravity\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",44,4,false,false],\"post_proc\":[\"/\",1000]}}}";
const char* _TILT_json = "{\"brand\":\"Tilt\",\"model\":\"Brewing Hydro- Thermometer\",\"model_id\":\"TILT\",\"tag\":\"0201\",\"condition\":[\"manufacturerdata\",\"=\",50,\"index\",0,\"4c000215a495bb\",\"&\",\"manufacturerdata\",\"index\",16,\"c5b14b44b5121370f02d74de\"],\"properties\":{\"color\":{\"decoder\":[\"string_from_hex_data\",\"manufacturerdata\",14,2],\"lookup\":[\"10\",\"red\",\"20\",\"green\",\"30\",\"black\",\"40\",\"purple\",\"50\",\"orange\",\"60\",\"blue\",\"70\",\"yellow\",\"80\",\"pink\"]},\"tempf\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",40,4,false,true]},\"gravity\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",44,4,false,false],\"post_proc\":[\"/\",1000]},\"txpower\":{\"condition\":[\"manufacturerdata\",48,\"bit\",3,1],\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",48,2,false,true]}}}";

/*R""""(
{
"brand":"Tilt",
"model":"Brewing Hydro- Thermometer",
"model_id":"TILT",
"tag":"0201",
"condition":["manufacturerdata", "=", 50, "index", 0, "4c000215a495bb", "&", "manufacturerdata", "index", 16, "c5b14b44b5121370f02d74de004403f8c5"],
"condition":["manufacturerdata", "=", 50, "index", 0, "4c000215a495bb", "&", "manufacturerdata", "index", 16, "c5b14b44b5121370f02d74de"],
"properties":{
"color":{
"decoder":["string_from_hex_data", "manufacturerdata", 14, 2],
Expand All @@ -25,11 +25,15 @@ const char* _TILT_json = "{\"brand\":\"Tilt\",\"model\":\"Brewing Hydro- Thermom
"gravity":{
"decoder":["value_from_hex_data", "manufacturerdata", 44, 4, false, false],
"post_proc":["/", 1000]
},
"txpower":{
"condition":["manufacturerdata", 48, "bit", 3, 1],
"decoder":["value_from_hex_data","manufacturerdata", 48, 2, false, true]
}
}
})"""";*/

const char* _TILT_json_props = "{\"properties\":{\"color\":{\"unit\":\"string\",\"name\":\"color\"},\"tempf\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"gravity\":{\"unit\":\"SG\",\"name\":\"specific_gravity\"}}}";
const char* _TILT_json_props = "{\"properties\":{\"color\":{\"unit\":\"string\",\"name\":\"color\"},\"tempf\":{\"unit\":\"°C\",\"name\":\"temperature\"},\"gravity\":{\"unit\":\"SG\",\"name\":\"specific_gravity\"},\"txpower\":{\"unit\":\"dBm\",\"name\":\"signal_strength\"}}}";
/*R""""(
{
"properties":{
Expand All @@ -44,6 +48,10 @@ const char* _TILT_json_props = "{\"properties\":{\"color\":{\"unit\":\"string\",
"gravity":{
"unit":"SG",
"name":"specific_gravity"
},
"txpower":{
"unit":"dBm",
"name":"signal_strength"
}
}
})"""";*/
2 changes: 1 addition & 1 deletion tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const char* expected_mfg[] = {
"{\"brand\":\"Govee\",\"model\":\"Smart Thermo-Hygrometer\",\"model_id\":\"H5100/01/02/04/05/74/77\",\"type\":\"THB\",\"cidc\":false,\"acts\":true,\"tempc\":22.7,\"tempf\":72.86,\"hum\":44.6,\"batt\":100}",
"{\"brand\":\"iTAG\",\"model\":\"Smart Tracker\",\"model_id\":\"ITAG\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"cont\":true,\"track\":true,\"device\":\"iTAG Tracker\"}",
"{\"brand\":\"iTAG\",\"model\":\"Smart Tracker\",\"model_id\":\"ITAG\",\"type\":\"TRACK\",\"cidc\":false,\"acts\":true,\"cont\":true,\"track\":true,\"device\":\"iTAG Tracker\"}",
"{\"brand\":\"Tilt\",\"model\":\"Brewing Hydro- Thermometer\",\"model_id\":\"TILT\",\"type\":\"THBX\",\"cidc\":false,\"color\":\"red\",\"tempf\":68,\"tempc\":20,\"gravity\":1.016}",
"{\"brand\":\"Tilt\",\"model\":\"Brewing Hydro- Thermometer\",\"model_id\":\"TILT\",\"type\":\"THBX\",\"cidc\":false,\"color\":\"red\",\"tempf\":68,\"tempc\":20,\"gravity\":1.016,\"txpower\":-59}",
};

const char* expected_name_uuid_mfgsvcdata[] = {
Expand Down

0 comments on commit 8db9446

Please sign in to comment.