mirror of https://github.com/arendst/Tasmota.git
Zigbee support for air sensors (#18665)
* Zigbee support for air sensors * ppm
This commit is contained in:
parent
951b9b4682
commit
98bfc172c1
|
@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Support for GM861 1D and 2D bar code reader (#18399)
|
- Support for GM861 1D and 2D bar code reader (#18399)
|
||||||
- Berry `re` (regex) add `match2` and optional offset
|
- Berry `re` (regex) add `match2` and optional offset
|
||||||
- Support for PCA9557 8-bit I/O expander (#18632)
|
- Support for PCA9557 8-bit I/O expander (#18632)
|
||||||
|
- Zigbee support for air sensors
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
- Change command ``FileUpload`` index binary data detection from >199 to >299
|
- Change command ``FileUpload`` index binary data detection from >199 to >299
|
||||||
|
|
|
@ -111,10 +111,10 @@ public:
|
||||||
// Bit #9 is `0` command is cluster specific, or `1` general_command
|
// Bit #9 is `0` command is cluster specific, or `1` general_command
|
||||||
uint8_t key_suffix; // append a suffix to key (default is 1, explicitly output if >1)
|
uint8_t key_suffix; // append a suffix to key (default is 1, explicitly output if >1)
|
||||||
uint8_t attr_type; // [opt] type of the attribute, default to Zunk (0xFF)
|
uint8_t attr_type; // [opt] type of the attribute, default to Zunk (0xFF)
|
||||||
uint16_t attr_multiplier; // [opt] multiplier for attribute, defaults to 0x01 (no change)
|
|
||||||
uint16_t attr_divider; // [opt] divider
|
|
||||||
int16_t attr_base; // [opt] base for conversion
|
|
||||||
uint16_t manuf; // manufacturer id (0 if none)
|
uint16_t manuf; // manufacturer id (0 if none)
|
||||||
|
uint32_t attr_multiplier; // [opt] multiplier for attribute, defaults to 0x01 (no change)
|
||||||
|
uint32_t attr_divider; // [opt] divider
|
||||||
|
int32_t attr_base; // [opt] base for conversion
|
||||||
|
|
||||||
// Constructor with all defaults
|
// Constructor with all defaults
|
||||||
Z_attribute():
|
Z_attribute():
|
||||||
|
|
|
@ -318,9 +318,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t type; // zigbee type, Zunk by default
|
uint8_t type; // zigbee type, Zunk by default
|
||||||
uint16_t multiplier; // multiply by x (ignore if 0 or 1)
|
uint32_t multiplier; // multiply by x (ignore if 0 or 1)
|
||||||
uint16_t divider; // divide by x (ignore if 0 or 1)
|
uint32_t divider; // divide by x (ignore if 0 or 1)
|
||||||
int16_t base; // add x (ignore if 0)
|
int32_t base; // add x (ignore if 0)
|
||||||
uint16_t cluster; // cluster number
|
uint16_t cluster; // cluster number
|
||||||
uint16_t attribute; // attribute number
|
uint16_t attribute; // attribute number
|
||||||
uint16_t manuf; // manufacturer code, 0 if none
|
uint16_t manuf; // manufacturer code, 0 if none
|
||||||
|
@ -338,7 +338,7 @@ public:
|
||||||
{};
|
{};
|
||||||
|
|
||||||
void set(uint16_t cluster, uint16_t attribute, uint16_t new_cluster, uint16_t new_attribute,
|
void set(uint16_t cluster, uint16_t attribute, uint16_t new_cluster, uint16_t new_attribute,
|
||||||
int8_t multiplier = 1, int8_t divider = 1, int16_t base = 0) {
|
uint32_t multiplier = 1, uint32_t divider = 1, int32_t base = 0) {
|
||||||
this->cluster = cluster;
|
this->cluster = cluster;
|
||||||
this->attribute = attribute;
|
this->attribute = attribute;
|
||||||
this->new_cluster = new_cluster;
|
this->new_cluster = new_cluster;
|
||||||
|
@ -354,9 +354,9 @@ public:
|
||||||
uint16_t attribute; // attribute to match
|
uint16_t attribute; // attribute to match
|
||||||
uint16_t new_cluster; // replace with this cluster
|
uint16_t new_cluster; // replace with this cluster
|
||||||
uint16_t new_attribute; // replace with this attribute
|
uint16_t new_attribute; // replace with this attribute
|
||||||
uint16_t multiplier; // multiply by x (ignore if 0 or 1)
|
uint32_t multiplier; // multiply by x (ignore if 0 or 1)
|
||||||
uint16_t divider; // divide by x (ignore if 0 or 1)
|
uint32_t divider; // divide by x (ignore if 0 or 1)
|
||||||
int16_t base; // add x (ignore if 0)
|
int32_t base; // add x (ignore if 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -530,9 +530,9 @@ public:
|
||||||
uint16_t cluster = 0xFFFF;
|
uint16_t cluster = 0xFFFF;
|
||||||
uint16_t attribute = 0xFFFF;
|
uint16_t attribute = 0xFFFF;
|
||||||
const char * name = nullptr;
|
const char * name = nullptr;
|
||||||
uint16_t multiplier = 1;
|
uint32_t multiplier = 1;
|
||||||
uint16_t divider = 1;
|
uint32_t divider = 1;
|
||||||
int16_t base = 0;
|
int32_t base = 0;
|
||||||
uint8_t zigbee_type = Znodata;
|
uint8_t zigbee_type = Znodata;
|
||||||
uint8_t map_offset = 0;
|
uint8_t map_offset = 0;
|
||||||
Z_Data_Type map_type = Z_Data_Type::Z_Unknown;
|
Z_Data_Type map_type = Z_Data_Type::Z_Unknown;
|
||||||
|
|
|
@ -1000,9 +1000,9 @@ void ZCLFrame::parseReadConfigAttributes(uint16_t shortaddr, Z_attribute_list& a
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the multiplier
|
// find the multiplier
|
||||||
uint16_t multiplier = 1;
|
uint32_t multiplier = 1;
|
||||||
uint16_t divider = 1;
|
uint32_t divider = 1;
|
||||||
int16_t base = 0;
|
int32_t base = 0;
|
||||||
Z_attribute_match matched_attr = Z_findAttributeMatcherById(shortaddr, cluster, attrid, false);
|
Z_attribute_match matched_attr = Z_findAttributeMatcherById(shortaddr, cluster, attrid, false);
|
||||||
if (matched_attr.found()) {
|
if (matched_attr.found()) {
|
||||||
attr_2.addAttribute(matched_attr.name, true).setBool(true);
|
attr_2.addAttribute(matched_attr.name, true).setBool(true);
|
||||||
|
|
|
@ -214,9 +214,9 @@ bool ZbLoad_inner(const char *filename, File &fp) {
|
||||||
uint16_t attr_id = 0xFFFF;
|
uint16_t attr_id = 0xFFFF;
|
||||||
uint16_t cluster_id = 0xFFFF;
|
uint16_t cluster_id = 0xFFFF;
|
||||||
uint8_t type_id = Zunk;
|
uint8_t type_id = Zunk;
|
||||||
uint16_t multiplier = 1;
|
uint32_t multiplier = 1;
|
||||||
uint16_t divider = 1;
|
uint32_t divider = 1;
|
||||||
int16_t base = 0;
|
int32_t base = 0;
|
||||||
char * name = nullptr;
|
char * name = nullptr;
|
||||||
uint16_t manuf = 0;
|
uint16_t manuf = 0;
|
||||||
|
|
||||||
|
@ -281,9 +281,9 @@ bool ZbLoad_inner(const char *filename, File &fp) {
|
||||||
char * delimiter_slash2 = strchr(tok2, '/');
|
char * delimiter_slash2 = strchr(tok2, '/');
|
||||||
uint16_t new_cluster_id = strtoul(tok2, &delimiter_slash2, 16);
|
uint16_t new_cluster_id = strtoul(tok2, &delimiter_slash2, 16);
|
||||||
uint16_t new_attr_id = strtoul(delimiter_slash2+1, nullptr, 16);
|
uint16_t new_attr_id = strtoul(delimiter_slash2+1, nullptr, 16);
|
||||||
uint16_t multiplier = 1;
|
uint32_t multiplier = 1;
|
||||||
uint16_t divider = 1;
|
uint32_t divider = 1;
|
||||||
int16_t base = 0;
|
int32_t base = 0;
|
||||||
|
|
||||||
// ADDITIONAL ELEMENTS?
|
// ADDITIONAL ELEMENTS?
|
||||||
while (token = strtok_r(rest, ",", &rest)) {
|
while (token = strtok_r(rest, ",", &rest)) {
|
||||||
|
@ -386,7 +386,7 @@ bool ZbUnload(const char *filename_raw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// append modifiers like mul/div/manuf
|
// append modifiers like mul/div/manuf
|
||||||
void Z_AppendModifiers(char * buf, size_t buf_len, uint16_t multiplier, uint16_t divider, int16_t base, uint16_t manuf) {
|
void Z_AppendModifiers(char * buf, size_t buf_len, uint32_t multiplier, uint32_t divider, int32_t base, uint16_t manuf) {
|
||||||
if (multiplier != 0 && multiplier != 1) {
|
if (multiplier != 0 && multiplier != 1) {
|
||||||
ext_snprintf_P(buf, buf_len, "%s,%s%i", buf, Z_MUL, multiplier);
|
ext_snprintf_P(buf, buf_len, "%s,%s%i", buf, Z_MUL, multiplier);
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ void zigbeeZCLSendCmd(class ZCLFrame &zcl) {
|
||||||
// I.e. multipliers and dividers are inversed
|
// I.e. multipliers and dividers are inversed
|
||||||
// multiplier == 0: ignore
|
// multiplier == 0: ignore
|
||||||
// multiplier == 1: ignore
|
// multiplier == 1: ignore
|
||||||
void ZbApplyMultiplierForWrites(double &val_d, uint16_t multiplier, uint16_t divider, int16_t base) {
|
void ZbApplyMultiplierForWrites(double &val_d, uint32_t multiplier, uint32_t divider, int32_t base) {
|
||||||
if (0 != base) {
|
if (0 != base) {
|
||||||
val_d = val_d - base;
|
val_d = val_d - base;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#Z2Tv1
|
||||||
|
# Extension for Air Quality - clusters from Concentration Measurement
|
||||||
|
: # apply to all devices
|
||||||
|
040D/0000,CO2,mul:1000000 # concentration in ppm
|
||||||
|
040D/0001,CO2Min,mul:1000000
|
||||||
|
040D/0002,CO2Max,mul:1000000
|
||||||
|
040D/0003,CO2Tolerance,mul:1000000
|
Loading…
Reference in New Issue