mirror of https://github.com/arendst/Tasmota.git
Zigbee ``SetOption144 1`` includes a timestamp in `ZbReceived` messages
This commit is contained in:
parent
a8ee9e0d16
commit
2a087f40f9
|
@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
||||||
- Zigbee include "BatteryPercentage" in all messages
|
- Zigbee include "BatteryPercentage" in all messages
|
||||||
- Commands ``WifiScan`` and ``WifiTest`` (#16141)
|
- Commands ``WifiScan`` and ``WifiTest`` (#16141)
|
||||||
- Support for Catalan language translations by Albert Gonzalez (#16145)
|
- Support for Catalan language translations by Albert Gonzalez (#16145)
|
||||||
|
- Zigbee ``SetOption144 1`` includes a timestamp in `ZbReceived` messages
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- ESP32 LVGL library from v8.2.0 to v8.3.0 (#16019)
|
- ESP32 LVGL library from v8.2.0 to v8.3.0 (#16019)
|
||||||
|
|
|
@ -171,7 +171,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
||||||
uint32_t gui_module_name : 1; // bit 27 (v11.1.0.3) - SetOption141 - (GUI) Disable display of GUI module name (1)
|
uint32_t gui_module_name : 1; // bit 27 (v11.1.0.3) - SetOption141 - (GUI) Disable display of GUI module name (1)
|
||||||
uint32_t wait_for_wifi_result : 1; // bit 28 (v11.1.0.4) - SetOption142 - (Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)
|
uint32_t wait_for_wifi_result : 1; // bit 28 (v11.1.0.4) - SetOption142 - (Wifi) Wait 1 second for wifi connection solving some FRITZ!Box modem issues (1)
|
||||||
uint32_t zigbee_no_batt_autoprobe : 1; // bit 29 (v12.0.2.4) - SetOption143 - (Zigbee) Disable Battery auto-probe and using auto-binding
|
uint32_t zigbee_no_batt_autoprobe : 1; // bit 29 (v12.0.2.4) - SetOption143 - (Zigbee) Disable Battery auto-probe and using auto-binding
|
||||||
uint32_t spare30 : 1; // bit 30
|
uint32_t zigbee_include_time : 1; // bit 30 (v12.0.2.4) - SetOption144 - (Zigbee) include time in `ZbReceived` messages like other sensors
|
||||||
uint32_t spare31 : 1; // bit 31
|
uint32_t spare31 : 1; // bit 31
|
||||||
};
|
};
|
||||||
} SOBitfield5;
|
} SOBitfield5;
|
||||||
|
|
|
@ -828,7 +828,7 @@ public:
|
||||||
void jsonAddDataAttributes(Z_attribute_list & attr_list) const;
|
void jsonAddDataAttributes(Z_attribute_list & attr_list) const;
|
||||||
void jsonAddDeviceAttributes(Z_attribute_list & attr_list) const;
|
void jsonAddDeviceAttributes(Z_attribute_list & attr_list) const;
|
||||||
void jsonDumpSingleDevice(Z_attribute_list & attr_list, uint32_t dump_mode, bool add_name) const;
|
void jsonDumpSingleDevice(Z_attribute_list & attr_list, uint32_t dump_mode, bool add_name) const;
|
||||||
void jsonPublishAttrList(const char * json_prefix, const Z_attribute_list &attr_list) const;
|
void jsonPublishAttrList(const char * json_prefix, const Z_attribute_list &attr_list, bool include_time = false) const;
|
||||||
void jsonLightState(Z_attribute_list & attr_list) const;
|
void jsonLightState(Z_attribute_list & attr_list) const;
|
||||||
|
|
||||||
// dump device attributes to ZbData
|
// dump device attributes to ZbData
|
||||||
|
|
|
@ -522,14 +522,22 @@ void Z_Devices::jsonAppend(uint16_t shortaddr, const Z_attribute_list &attr_list
|
||||||
//
|
//
|
||||||
// internal function to publish device information with respect to all `SetOption`s
|
// internal function to publish device information with respect to all `SetOption`s
|
||||||
//
|
//
|
||||||
void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_list &attr_list) const {
|
void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_list &attr_list, bool include_time) const {
|
||||||
bool use_fname = (Settings->flag4.zigbee_use_names) && (friendlyName); // should we replace shortaddr with friendlyname?
|
bool use_fname = (Settings->flag4.zigbee_use_names) && (friendlyName); // should we replace shortaddr with friendlyname?
|
||||||
|
|
||||||
ResponseClear(); // clear string
|
ResponseClear(); // clear string
|
||||||
|
|
||||||
// Do we prefix with `ZbReceived`?
|
// Do we prefix with `ZbReceived`?
|
||||||
if (!Settings->flag4.remove_zbreceived && !Settings->flag5.zb_received_as_subtopic) {
|
if (!Settings->flag4.remove_zbreceived && !Settings->flag5.zb_received_as_subtopic) {
|
||||||
Response_P(PSTR("{\"%s\":"), json_prefix);
|
if (include_time && Rtc.utc_time >= START_VALID_TIME) {
|
||||||
|
// Add time if needed (and if time is valide)
|
||||||
|
ResponseAppendTimeFormat(Settings->flag2.time_format);
|
||||||
|
ResponseAppend_P(PSTR(",\"%s\":"), json_prefix);
|
||||||
|
} else {
|
||||||
|
ResponseAppend_P(PSTR("{\"%s\":"), json_prefix);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// What key do we use, shortaddr or name?
|
// What key do we use, shortaddr or name?
|
||||||
if (!Settings->flag5.zb_omit_json_addr) {
|
if (!Settings->flag5.zb_omit_json_addr) {
|
||||||
if (use_fname) {
|
if (use_fname) {
|
||||||
|
@ -609,7 +617,7 @@ void Z_Devices::jsonPublishFlush(uint16_t shortaddr) {
|
||||||
attr_list.setBattPercent(device.batt_percent);
|
attr_list.setBattPercent(device.batt_percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
device.jsonPublishAttrList(PSTR(D_JSON_ZIGBEE_RECEIVED), attr_list);
|
device.jsonPublishAttrList(PSTR(D_JSON_ZIGBEE_RECEIVED), attr_list, Settings->flag5.zigbee_include_time);
|
||||||
attr_list.reset(); // clear the attributes
|
attr_list.reset(); // clear the attributes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue