mirror of
https://github.com/Utyff/Zintercom.git
synced 2026-01-12 09:17:41 +03:00
added TimeBell attribute than means time after last bell to finish ring
This commit is contained in:
@@ -138,15 +138,17 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
||||
|
||||
if (portAndAction & 0x01) { //P0 Ring //S1 P0_1
|
||||
|
||||
|
||||
|
||||
//exit old stop timer
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//start new stop timer (ring ends timer)
|
||||
//osal_start_timerEx(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||
//zclApp_Config.TimeRing
|
||||
uint32 TimeBell = (uint32)zclApp_Config.TimeBell *(uint32)1000;
|
||||
osal_start_timerEx(zclApp_TaskID, APP_RING_STOP_EVT, (uint32)TimeBell);
|
||||
if (portAndAction & HAL_KEY_PRESS) {
|
||||
|
||||
//exit old stop timer
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//start new stop timer (ring ends timer)
|
||||
osal_start_timerEx(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||
|
||||
|
||||
//start ring
|
||||
if (zclApp_State.RingRunStep == 0) {
|
||||
|
||||
@@ -53,6 +53,7 @@ extern "C" {
|
||||
#define ATTRID_TIMERING 0x0053
|
||||
#define ATTRID_TIMETALK 0x0054
|
||||
#define ATTRID_TIMEOPEN 0x0055
|
||||
#define ATTRID_TIMEBELL 0x0057
|
||||
#define ATTRID_TIMEREPORT 0x0056
|
||||
|
||||
#define LED_PIN HAL_LED_1
|
||||
@@ -107,6 +108,7 @@ typedef struct {
|
||||
uint8 TimeRing;
|
||||
uint8 TimeTalk;
|
||||
uint8 TimeOpen;
|
||||
uint8 TimeBell;
|
||||
uint8 TimeReport;
|
||||
} application_config_t;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
|
||||
#define DEFAULT_TimeRing 7 //seconds to ring, before answer
|
||||
#define DEFAULT_TimeTalk 3 //seconds to talk, before open
|
||||
#define DEFAULT_TimeOpen 2 //seconds to hold open
|
||||
|
||||
#define DEFAULT_TimeBell 3 //seconds after last bell to finish ring
|
||||
|
||||
application_config_t zclApp_Config = {
|
||||
.ModeOpen = DEFAULT_ModeOpen,
|
||||
@@ -75,6 +75,7 @@ application_config_t zclApp_Config = {
|
||||
.TimeRing = DEFAULT_TimeRing,
|
||||
.TimeTalk = DEFAULT_TimeTalk,
|
||||
.TimeOpen = DEFAULT_TimeOpen,
|
||||
.TimeBell = DEFAULT_TimeBell,
|
||||
.TimeReport = DEFAULT_TimeReport,
|
||||
};
|
||||
|
||||
@@ -122,6 +123,7 @@ CONST zclAttrRec_t zclApp_AttrsFirstEP[] = {
|
||||
{ZCL_INTERCOM, {ATTRID_TIMERING, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeRing}},
|
||||
{ZCL_INTERCOM, {ATTRID_TIMETALK, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeTalk}},
|
||||
{ZCL_INTERCOM, {ATTRID_TIMEOPEN, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeOpen}},
|
||||
{ZCL_INTERCOM, {ATTRID_TIMEBELL, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeBell}},
|
||||
{ZCL_INTERCOM, {ATTRID_TIMEREPORT, ZCL_UINT8, RW, (void *)&zclApp_Config.TimeReport}},
|
||||
};
|
||||
|
||||
@@ -157,5 +159,6 @@ void zclApp_ResetAttributesToDefaultValues(void) {
|
||||
zclApp_Config.TimeRing = DEFAULT_TimeRing;
|
||||
zclApp_Config.TimeTalk = DEFAULT_TimeTalk;
|
||||
zclApp_Config.TimeOpen = DEFAULT_TimeOpen;
|
||||
zclApp_Config.TimeBell = DEFAULT_TimeBell;
|
||||
zclApp_Config.TimeReport = DEFAULT_TimeReport;
|
||||
}
|
||||
@@ -82,6 +82,9 @@ const fz = {
|
||||
if (msg.data.hasOwnProperty(0x0055)) {
|
||||
result.time_open = msg.data[0x0055];
|
||||
}
|
||||
if (msg.data.hasOwnProperty(0x0057)) {
|
||||
result.time_bell = msg.data[0x0057];
|
||||
}
|
||||
if (msg.data.hasOwnProperty(0x0056)) {
|
||||
result.time_report = msg.data[0x0056];
|
||||
}
|
||||
@@ -92,7 +95,7 @@ const fz = {
|
||||
|
||||
const tz = {
|
||||
diy_zintercom_config: {
|
||||
key: ['state', 'mode', 'sound', 'time_ring', 'time_talk', 'time_open', 'time_report'],
|
||||
key: ['state', 'mode', 'sound', 'time_ring', 'time_talk', 'time_open', 'time_bell', 'time_report'],
|
||||
convertSet: async (entity, key, rawValue, meta) => {
|
||||
const lookup = {
|
||||
'OFF': 0x00,
|
||||
@@ -118,6 +121,7 @@ const tz = {
|
||||
time_ring: {0x0053: {value, type: 0x20}},
|
||||
time_talk: {0x0054: {value, type: 0x20}},
|
||||
time_open: {0x0055: {value, type: 0x20}},
|
||||
time_bell: {0x0057: {value, type: 0x20}},
|
||||
time_report: {0x0056: {value, type: 0x20}},
|
||||
};
|
||||
|
||||
@@ -134,6 +138,7 @@ const tz = {
|
||||
time_ring: ['closuresDoorLock', 0x0053],
|
||||
time_talk: ['closuresDoorLock', 0x0054],
|
||||
time_open: ['closuresDoorLock', 0x0055],
|
||||
time_bell: ['closuresDoorLock', 0x0057],
|
||||
time_report: ['closuresDoorLock', 0x0056],
|
||||
};
|
||||
await entity.read(payloads[key][0], [payloads[key][1]]);
|
||||
@@ -193,10 +198,11 @@ const device = {
|
||||
.withDescription('Time to hold before open'),
|
||||
exposes.numeric('time_open', ea.ALL).withUnit('sec')
|
||||
.withDescription('Time to open before end'),
|
||||
exposes.numeric('time_bell', ea.ALL).withUnit('sec')
|
||||
.withDescription('Time after last bell to finish ring'),
|
||||
exposes.numeric('time_report', ea.ALL).withUnit('min')
|
||||
.withDescription('Reporting interval'),
|
||||
ep.battery(),
|
||||
ep.linkquality(),
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user