Skip to content
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

Sensirion adjustments #286

Merged
merged 1 commit into from
Feb 13, 2023
Merged
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
4 changes: 2 additions & 2 deletions src/devices/SCD4X_json.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const char* _SCD4X_json = "{\"brand\":\"Sensirion\",\"model\":\"MyCO₂/CO₂ Gadget\",\"model_id\":\"SCD4X\",\"tag\":\"0f\",\"condition\":[\"manufacturerdata\",\"=\",28,\"index\",0,\"d5060008\",\"|\",\"manufacturerdata\",\"=\",24,\"index\",0,\"d506000a\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",12,4,true,true],\"post_proc\":[\"*\",175,\"/\",65535,\"-\",45]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",16,4,true,false],\"post_proc\":[\"*\",100,\"/\",65535]},\"co2\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true,false]}}}";
const char* _SCD4X_json = "{\"brand\":\"Sensirion\",\"model\":\"MyCO₂/CO₂ Gadget\",\"model_id\":\"SCD4X\",\"tag\":\"0f\",\"condition\":[\"manufacturerdata\",\">=\",24,\"index\",0,\"d5060008\",\"|\",\"manufacturerdata\",\">=\",24,\"index\",0,\"d506000a\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",12,4,true,true],\"post_proc\":[\"*\",175,\"/\",65535,\"-\",45]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",16,4,true,false],\"post_proc\":[\"*\",100,\"/\",65535]},\"co2\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",20,4,true,false]}}}";

/* R""""(
{
"brand":"Sensirion",
"model":"MyCO₂/CO₂ Gadget",
"model_id":"SCD4X",
"tag":"0f",
"condition":["manufacturerdata", "=", 28, "index", 0, "d5060008", "|", "manufacturerdata", "=", 24, "index", 0, "d506000a"],
"condition":["manufacturerdata", ">=", 24, "index", 0, "d5060008", "|", "manufacturerdata", ">=", 24, "index", 0, "d506000a"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "manufacturerdata", 12, 4, true, true],
Expand Down
4 changes: 2 additions & 2 deletions src/devices/SHT4X_json.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "common_props.h"

const char* _SHT4X_json = "{\"brand\":\"Sensirion\",\"model\":\"TH Sensor\",\"model_id\":\"SHT4X\",\"tag\":\"01\",\"condition\":[\"manufacturerdata\",\"=\",20,\"index\",0,\"d5060006\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",12,4,true,true],\"post_proc\":[\"*\",175,\"/\",65535,\"-\",45]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",16,4,true,false],\"post_proc\":[\"*\",125,\"/\",65535,\"-\",6]}}}";
const char* _SHT4X_json = "{\"brand\":\"Sensirion\",\"model\":\"TH Sensor\",\"model_id\":\"SHT4X\",\"tag\":\"01\",\"condition\":[\"manufacturerdata\",\">=\",20,\"index\",0,\"d5060006\"],\"properties\":{\"tempc\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",12,4,true,true],\"post_proc\":[\"*\",175,\"/\",65535,\"-\",45]},\"hum\":{\"decoder\":[\"value_from_hex_data\",\"manufacturerdata\",16,4,true,false],\"post_proc\":[\"*\",125,\"/\",65535,\"-\",6]}}}";

/* R""""(
{
"brand":"Sensirion",
"model":"TH Sensor",
"model_id":"SHT4X",
"tag":"01",
"condition":["manufacturerdata", "=", 20, "index", 0, "d5060006"],
"condition":["manufacturerdata", ">=", 20, "index", 0, "d5060006"],
"properties":{
"tempc":{
"decoder":["value_from_hex_data", "manufacturerdata", 12, 4, true, true],
Expand Down
6 changes: 6 additions & 0 deletions tests/BLE/test_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ const char* expected_mfg[] = {
"{\"brand\":\"Sensirion\",\"model\":\"TH Sensor\",\"model_id\":\"SHT4X\",\"type\":\"THB\",\"tempc\":27.47005417,\"tempf\":81.44609751,\"hum\":43.37056535}",
"{\"brand\":\"Sensirion\",\"model\":\"TH Sensor\",\"model_id\":\"SHT4X\",\"type\":\"THB\",\"tempc\":-10,\"tempf\":14,\"hum\":90.00404364}",
"{\"brand\":\"Sensirion\",\"model\":\"TH Sensor\",\"model_id\":\"SHT4X\",\"type\":\"THB\",\"tempc\":-2.50171664,\"tempf\":27.49691005,\"hum\":65.00022889}",
"{\"brand\":\"Sensirion\",\"model\":\"TH Sensor\",\"model_id\":\"SHT4X\",\"type\":\"THB\",\"tempc\":27.47005417,\"tempf\":81.44609751,\"hum\":43.37056535}",
"{\"brand\":\"Sensirion\",\"model\":\"MyCO₂/CO₂ Gadget\",\"model_id\":\"SCD4X\",\"type\":\"AIR\",\"tempc\":-10,\"tempf\":14,\"hum\":76.80323491,\"co2\":745}",
"{\"brand\":\"Sensirion\",\"model\":\"MyCO₂/CO₂ Gadget\",\"model_id\":\"SCD4X\",\"type\":\"AIR\",\"tempc\":25.63286793,\"tempf\":78.13916228,\"hum\":36.16083009,\"co2\":1035}",
"{\"brand\":\"Sensirion\",\"model\":\"MyCO₂/CO₂ Gadget\",\"model_id\":\"SCD4X\",\"type\":\"AIR\",\"tempc\":28.14831769,\"tempf\":82.66697185,\"hum\":38.09872587,\"co2\":1434}",
"{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrometer\",\"model_id\":\"H5101/02/74/77\",\"type\":\"THB\",\"cidc\":false,\"tempc\":22,\"tempf\":71.6,\"hum\":69.1,\"batt\":100}",
"{\"brand\":\"Govee\",\"model\":\"Smart Thermo Hygrometer\",\"model_id\":\"H5101/02/74/77\",\"type\":\"THB\",\"cidc\":false,\"tempc\":-7.2,\"tempf\":19.04,\"hum\":90.3,\"batt\":100}",
"{\"brand\":\"Govee\",\"model\":\"Thermo Hygrometer\",\"model_id\":\"H5074\",\"type\":\"THB\",\"cidc\":false,\"tempc\":22.44,\"tempf\":72.392,\"hum\":74.59,\"batt\":100}",
Expand Down Expand Up @@ -351,8 +353,10 @@ const char* test_mfgdata[][3] = {
{"Sensirion SHT4X", "SHT4X", "d5060006e2e7036a1c65"},
{"Sensirion SHT4X", "SHT4X", "d5060006e2e733339dc4"},
{"Sensirion SHT4X", "SHT4X", "d5060006e2e72b3e6891"},
{"Sensirion SHT4X", "SHT4X", "d5060006e2e7036a1c650d09534854343020476164676574"},
{"Sensirion MyCO2", "SCD4X", "d506000ae2e733339dc4e902"},
{"Sensirion MyCO2", "SCD4X", "d506000867355367925c0b040609"},
{"Sensirion MyCO2", "SCD4X", "d506000ac543016b88619a05000000009a05000000000000"},
{"H5174", "GVH5174_1234", "01000101035e1364"},
{"H5174", "GVH5174_1234", "01000101811a6764"},
{"H5074", "Govee_H5074_1234", "88ec00c408231d6402"},
Expand Down Expand Up @@ -439,6 +443,8 @@ TheengsDecoder::BLE_ID_NUM test_mfgdata_id_num[]{
TheengsDecoder::BLE_ID_NUM::SHT4X,
TheengsDecoder::BLE_ID_NUM::SHT4X,
TheengsDecoder::BLE_ID_NUM::SHT4X,
TheengsDecoder::BLE_ID_NUM::SHT4X,
TheengsDecoder::BLE_ID_NUM::SCD4X,
TheengsDecoder::BLE_ID_NUM::SCD4X,
TheengsDecoder::BLE_ID_NUM::SCD4X,
TheengsDecoder::BLE_ID_NUM::H5102,
Expand Down