mirror of
https://github.com/Utyff/Zintercom.git
synced 2026-01-13 01:37:43 +03:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e58b8a0f97 | ||
|
|
0439847dd5 | ||
|
|
a34f4319d9 | ||
|
|
c9ff7819b2 | ||
|
|
e63e1cbd92 | ||
|
|
06b4283fd7 | ||
|
|
fda52cd269 | ||
|
|
c833dc48ab | ||
|
|
bc3f698efc | ||
|
|
29ff218b19 | ||
|
|
44087fceb9 | ||
|
|
a4fe271d30 | ||
|
|
deafb7667e | ||
|
|
29c71487ea | ||
|
|
5e02f3c97a |
38
README.md
38
README.md
@@ -13,34 +13,50 @@ There are 4 work modes:
|
||||
3. `Always` - open door when intercom rings
|
||||
4. `Drop` - hangs up all intercom rings, right after start
|
||||
|
||||
You can change the operating mode with z2m or by pressing the button.
|
||||
After pressing the button, the LED will flash.
|
||||
You can change the operating mode uisng z2m or by short press the button. (< 1000ms)
|
||||
After pressing the button, the LED will flash at 4 Hz.
|
||||
The number of flashes indicates the current operating mode.
|
||||
|
||||
You can control sound mode using z2m or by long press the button. (1000ms < X < 5000ms)
|
||||
After pressing the button, the LED will flash at 1.5 Hz.
|
||||
One flash - OFF, two flashes - ON.
|
||||
|
||||
|
||||
|
||||
## Important info
|
||||
In Gerber PCB v1.0 committed on Apr 14, there are some errors in the silkscreen layers:
|
||||
1. 'Line-' and 'Phone-' are reversed.
|
||||
2. '+' and '-' are also reversed.
|
||||
|
||||
Just plug by swapping.
|
||||
|
||||
|
||||
|
||||
### How to join
|
||||
Reset to FN by reboot device 5 times with interval less than 10 seconds.
|
||||
Reset to FN by press and hold BTN for 5 seconds.
|
||||
|
||||
LED will flash during reset.
|
||||
|
||||
<img src="./images/z2m_dashboard.gif" width="45%">
|
||||

|
||||
|
||||
|
||||
### How to add device into zigbe2mqtt
|
||||
Use [external converters](https://www.zigbee2mqtt.io/information/configuration.html#external-converters-configuration) feature
|
||||
|
||||
Converter file located [here](./converters/DIY_Zintercom.js)
|
||||
Converter file located [here](https://github.com/diyruz/Zintercom/blob/master/converters/DIYRuZ_Zintercom.js)
|
||||
|
||||
<img src="./images/z2m_exposes.png" width="90%">
|
||||

|
||||
|
||||
### Schematic
|
||||
|
||||
<img src="./hardware/Schematic_Zintercom.png" width="90%">
|
||||

|
||||
|
||||
|
||||
### PCB size
|
||||
|
||||
`57.5mm x 27.3mm`
|
||||
<img src="./images/dimensions.png" width="60%">
|
||||

|
||||
|
||||
|
||||
### DC Power
|
||||
@@ -48,9 +64,9 @@ Converter file located [here](./converters/DIY_Zintercom.js)
|
||||
Support `router` and `end device` modes.
|
||||
Install `E18-MS1PA1`, `E18-MS1PA2` or `E18-MS1-PCB`.
|
||||
|
||||
<img src="./images/front_side.png" width="70%">
|
||||

|
||||
|
||||
<img src="./images/back_DC_5-9V.png" width="70%">
|
||||

|
||||
|
||||
|
||||
### Battery Power
|
||||
@@ -65,7 +81,7 @@ But you have the ability to set the button mode or at the time of the call.
|
||||
|
||||
If any commands are in the coordinator's queue, they will be executed after a button is pressed or a call is received.
|
||||
|
||||
<img src="./images/back_2xAAA.png" width="70%">
|
||||

|
||||
|
||||
##### The mode set by the Zigbee command `overwrites` the mode set by the button.
|
||||
|
||||
@@ -78,7 +94,9 @@ For example, you can turn on the light while a call comes to the intercom, for n
|
||||
### Files to reproduce
|
||||
* [Gerbers and BOM](https://github.com/diyruz/Zintercom/tree/master/hardware) by [xyzroe](https://t.me/xyzroe)
|
||||
* [Firmware](https://github.com/diyruz/Zintercom/releases) by [xyzroe](https://t.me/xyzroe)
|
||||
* [Case stl](https://www.thingiverse.com/thing:4866356) by [dreamertwo](https://t.me/dreamertwo)
|
||||
|
||||

|
||||
|
||||
### Inspired by
|
||||
The original scheme of the intercom opener by [Alexander Vaidurov](https://easyeda.com/Alex_AW/domofon-with-battery)
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#define HAL_KEY_P0_INPUT_PINS_EDGE HAL_KEY_RISING_EDGE
|
||||
#define HAL_KEY_P2_INPUT_PINS BV(0)
|
||||
#define HAL_KEY_P2_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
||||
#define INT_HEAP_LEN 2256
|
||||
#define INT_HEAP_LEN 2200//2256
|
||||
#elif defined( HAL_BOARD_CHDTECH_DEV )
|
||||
#define HAL_KEY_P0_INPUT_PINS BV(1)
|
||||
#define HAL_KEY_P0_INPUT_PINS_EDGE HAL_KEY_FALLING_EDGE
|
||||
|
||||
128
Source/zcl_app.c
128
Source/zcl_app.c
@@ -68,6 +68,7 @@ byte zclApp_TaskID;
|
||||
* LOCAL VARIABLES
|
||||
*/
|
||||
|
||||
static uint8 currentBtnClickPhase = 0;
|
||||
|
||||
/*********************************************************************
|
||||
* LOCAL FUNCTIONS
|
||||
@@ -88,8 +89,6 @@ static void zclApp_RingRun(void);
|
||||
static void zclApp_TalkStart(void);
|
||||
static void zclApp_RingEnd(void);
|
||||
|
||||
//static uint32 pressTime = 0;
|
||||
|
||||
/*********************************************************************
|
||||
* ZCL General Profile Callback table
|
||||
*/
|
||||
@@ -123,6 +122,7 @@ void zclApp_Init(byte task_id) {
|
||||
LREP("Build %s \r\n", zclApp_DateCodeNT);
|
||||
|
||||
zclApp_ConfigInit(TIMER_START);
|
||||
|
||||
IO_IMODE_PORT_PIN(0,0,IO_TRI);
|
||||
|
||||
#if defined( ZIC_BATTERY_MODE )
|
||||
@@ -140,34 +140,52 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
||||
|
||||
//exit old stop timer
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
osal_clear_event(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) {
|
||||
//osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
|
||||
//osal_pwrmgr_task_state(Hal_TaskID, PWRMGR_CONSERVE);
|
||||
|
||||
|
||||
|
||||
//start ring
|
||||
if (zclApp_State.RingRunStep == 0) {
|
||||
LREPMaster("Ring start\r\n");
|
||||
HalLedSet(LED_PIN, HAL_LED_MODE_BLINK);
|
||||
zclApp_State.RingRunStep = 1;
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||
afAddrType_t inderect_DstAddr = {.addrMode = (afAddrMode_t)AddrNotPresent, .endPoint = 0, .addr.shortAddr = 0};
|
||||
zclGeneral_SendOnOff_CmdOn(zclApp_FirstEP.EndPoint, &inderect_DstAddr, FALSE, bdb_getZCLFrameCounter());
|
||||
#if defined( ZIC_BATTERY_MODE )
|
||||
osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
|
||||
#endif
|
||||
LREPMaster("Ring start\r\n");
|
||||
//HalLedSet(LED_PIN, HAL_LED_MODE_BLINK);
|
||||
zclApp_State.RingRunStep = 1;
|
||||
//osal_start_reload_timer(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||
osal_start_timerEx(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||
afAddrType_t inderect_DstAddr = {.addrMode = (afAddrMode_t)AddrNotPresent, .endPoint = 0, .addr.shortAddr = 0};
|
||||
zclGeneral_SendOnOff_CmdOn(zclApp_FirstEP.EndPoint, &inderect_DstAddr, FALSE, bdb_getZCLFrameCounter());
|
||||
}
|
||||
}
|
||||
|
||||
//start new stop timer (ring ends timer)
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||
}
|
||||
|
||||
if (portAndAction & 0x04) { //P2 Btn //S2 P2_0
|
||||
zclFactoryResetter_HandleKeys(portAndAction, keyCode);
|
||||
if (portAndAction & HAL_KEY_PRESS) {
|
||||
LREPMaster("Key pressed\r\n");
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||
zclApp_State.pressTime = osal_getClock();
|
||||
LREP("pressTime = %d\r\n", zclApp_State.pressTime);
|
||||
}
|
||||
|
||||
if (portAndAction & HAL_KEY_RELEASE) {
|
||||
LREPMaster("Key released\r\n");
|
||||
uint32 holdTime = osal_getClock() - zclApp_State.pressTime;
|
||||
LREP("holdTime = %d \r\n", holdTime);
|
||||
zclApp_State.pressTime = 0;
|
||||
if (holdTime >= 1) { //seconds
|
||||
osal_start_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
||||
}
|
||||
else {
|
||||
osal_start_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +258,9 @@ uint16 zclApp_event_loop(uint8 task_id, uint16 events) {
|
||||
|
||||
if (events & APP_BTN_HOLD_EVT) {
|
||||
LREPMaster("APP_BTN_HOLD_EVT\r\n");
|
||||
zclApp_BtnClick(true);
|
||||
#if !defined( ZIC_BATTERY_MODE )
|
||||
zclApp_BtnClick(true);
|
||||
#endif
|
||||
return (events ^ APP_BTN_HOLD_EVT);
|
||||
}
|
||||
return 0;
|
||||
@@ -248,10 +268,13 @@ uint16 zclApp_event_loop(uint8 task_id, uint16 events) {
|
||||
|
||||
|
||||
static void zclApp_RingRun(void) {
|
||||
|
||||
zclApp_State.RingRunStep++;
|
||||
LREP("zclApp_State.RingRunStep %d\r\n", zclApp_State.RingRunStep);
|
||||
LREP("zclApp_State.State %d\r\n", zclApp_State.State);
|
||||
|
||||
osal_start_timerEx(zclApp_TaskID, APP_RING_RUN_EVT, 500);
|
||||
|
||||
|
||||
switch (zclApp_State.State) {
|
||||
case Idle:
|
||||
zclApp_State.State = Ring;
|
||||
@@ -270,6 +293,7 @@ static void zclApp_RingRun(void) {
|
||||
}
|
||||
break;
|
||||
case Talk:
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
||||
if (zclApp_State.RingRunStep > ((zclApp_Config.TimeRing + zclApp_Config.TimeTalk) * 2)) {
|
||||
zclApp_State.State = Open;
|
||||
@@ -279,6 +303,7 @@ static void zclApp_RingRun(void) {
|
||||
}
|
||||
break;
|
||||
case Open:
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
if ((zclApp_Config.ModeOpen == Once) || (zclApp_Config.ModeOpen == Always)){
|
||||
if (zclApp_State.RingRunStep > ((zclApp_Config.TimeRing + zclApp_Config.TimeTalk + zclApp_Config.TimeOpen) * 2)) {
|
||||
zclApp_RingEnd();
|
||||
@@ -286,7 +311,8 @@ static void zclApp_RingRun(void) {
|
||||
}
|
||||
break;
|
||||
case Droped:
|
||||
if (zclApp_State.RingRunStep > 3) {
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
if (zclApp_State.RingRunStep > 1) {
|
||||
zclApp_RingEnd();
|
||||
}
|
||||
break;
|
||||
@@ -296,8 +322,8 @@ static void zclApp_RingRun(void) {
|
||||
|
||||
static void zclApp_TalkStart(void) {
|
||||
LREPMaster("Talk start\r\n");
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
zclApp_OneReport();
|
||||
HalLedSet(ANSWER_PIN, HAL_LED_MODE_ON);
|
||||
if (zclApp_Config.ModeSound == true) {
|
||||
@@ -310,42 +336,38 @@ static void zclApp_TalkStart(void) {
|
||||
|
||||
static void zclApp_RingEnd(void) {
|
||||
LREPMaster("Ring end\r\n");
|
||||
if (zclApp_Config.ModeSound == true) {
|
||||
HalLedSet(CATCH_PIN, HAL_LED_MODE_OFF);
|
||||
HalLedSet(HANDSET_PIN, HAL_LED_MODE_OFF);
|
||||
}
|
||||
else {
|
||||
HalLedSet(CATCH_PIN, HAL_LED_MODE_ON);
|
||||
HalLedSet(HANDSET_PIN, HAL_LED_MODE_ON);
|
||||
}
|
||||
HalLedSet(CATCH_PIN, !zclApp_Config.ModeSound);
|
||||
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
||||
HalLedSet(ANSWER_PIN, HAL_LED_MODE_OFF);
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_RUN_EVT);
|
||||
osal_clear_event(zclApp_TaskID, APP_RING_RUN_EVT);
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//osal_clear_event(zclApp_TaskID, APP_RING_RUN_EVT);
|
||||
//osal_stop_timerEx(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
//osal_clear_event(zclApp_TaskID, APP_RING_STOP_EVT);
|
||||
zclApp_State.RingRunStep = 0;
|
||||
zclApp_State.State = Idle;
|
||||
afAddrType_t inderect_DstAddr = {.addrMode = (afAddrMode_t)AddrNotPresent, .endPoint = 0, .addr.shortAddr = 0};
|
||||
|
||||
|
||||
afAddrType_t inderect_DstAddr = {.addrMode = (afAddrMode_t)AddrNotPresent, .endPoint = 0, .addr.shortAddr = 0};
|
||||
zclGeneral_SendOnOff_CmdOff(zclApp_FirstEP.EndPoint, &inderect_DstAddr, FALSE, bdb_getZCLFrameCounter());
|
||||
|
||||
if (zclApp_Config.ModeOpen == Once) {
|
||||
zclApp_Config.ModeOpen = Never;
|
||||
}
|
||||
zclApp_OneReport();
|
||||
|
||||
#if defined( ZIC_BATTERY_MODE )
|
||||
zclBattery_Report();
|
||||
osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_CONSERVE);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void zclApp_BtnClick(bool hold) {
|
||||
|
||||
static uint8 currentBtnClickPhase = 0;
|
||||
LREP("currentBtnClickPhase %d\r\n", currentBtnClickPhase);
|
||||
switch (currentBtnClickPhase++) {
|
||||
case 0:
|
||||
if (hold) {
|
||||
zclApp_Config.ModeSound = !zclApp_Config.ModeSound;
|
||||
HalLedSet(CATCH_PIN, !zclApp_Config.ModeSound);
|
||||
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
||||
HalLedSet(CATCH_PIN, !zclApp_Config.ModeSound);
|
||||
}
|
||||
else {
|
||||
if (zclApp_Config.ModeOpen < Drop) {
|
||||
@@ -367,7 +389,8 @@ static void zclApp_BtnClick(bool hold) {
|
||||
HalLedBlink(LED_PIN, zclApp_Config.ModeOpen+1, 50, 250);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
/*
|
||||
if (hold) {
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT);
|
||||
osal_clear_event(zclApp_TaskID, APP_BTN_HOLD_EVT);
|
||||
@@ -376,12 +399,18 @@ static void zclApp_BtnClick(bool hold) {
|
||||
osal_stop_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT);
|
||||
osal_clear_event(zclApp_TaskID, APP_BTN_CLICK_EVT);
|
||||
}
|
||||
*/
|
||||
currentBtnClickPhase = 0;
|
||||
break;
|
||||
}
|
||||
#if defined( ZIC_BATTERY_MODE )
|
||||
zclBattery_Report();
|
||||
#endif
|
||||
if (currentBtnClickPhase != 0) {
|
||||
if (hold) {
|
||||
osal_start_timerEx(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
||||
}
|
||||
else {
|
||||
osal_start_timerEx(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void zclApp_Report(void) {
|
||||
@@ -392,7 +421,10 @@ static void zclApp_OneReport(void) {
|
||||
HalLedSet(LED_PIN, HAL_LED_MODE_BLINK);
|
||||
bdb_RepChangedAttrValue(zclApp_FirstEP.EndPoint, ZCL_INTERCOM, ATTRID_STATE);
|
||||
bdb_RepChangedAttrValue(zclApp_FirstEP.EndPoint, ZCL_INTERCOM, ATTRID_MODEOPEN);
|
||||
bdb_RepChangedAttrValue(zclApp_FirstEP.EndPoint, ZCL_INTERCOM, ATTRID_MODESOUND);
|
||||
#if !defined( ZIC_BATTERY_MODE )
|
||||
bdb_RepChangedAttrValue(zclApp_FirstEP.EndPoint, ZCL_INTERCOM, ATTRID_MODESOUND);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static void zclApp_BasicResetCB(void) {
|
||||
@@ -421,15 +453,9 @@ static void zclApp_ConfigInit(bool restart) {
|
||||
uint32 ReportInterval = (uint32)zclApp_Config.TimeReport * (uint32)60;
|
||||
LREP("Start report with interval %d seconds\r\n", ReportInterval);
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_REPORT_EVT, ((uint32)ReportInterval*(uint32)1000));
|
||||
|
||||
if (zclApp_Config.ModeSound == true) {
|
||||
HalLedSet(HANDSET_PIN, HAL_LED_MODE_OFF);
|
||||
HalLedSet(CATCH_PIN, HAL_LED_MODE_OFF);
|
||||
}
|
||||
else {
|
||||
HalLedSet(HANDSET_PIN, HAL_LED_MODE_ON);
|
||||
HalLedSet(CATCH_PIN, HAL_LED_MODE_ON);
|
||||
}
|
||||
|
||||
HalLedSet(HANDSET_PIN, !zclApp_Config.ModeSound);
|
||||
HalLedSet(CATCH_PIN, !zclApp_Config.ModeSound);
|
||||
HalLedSet(ANSWER_PIN, HAL_LED_MODE_OFF);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ extern "C" {
|
||||
#define APP_SAVE_ATTRS_EVT 0x0002
|
||||
#define APP_BTN_CLICK_EVT 0x0004
|
||||
#define APP_RING_RUN_EVT 0x0008
|
||||
#define APP_BTN_HOLD_EVT 0x0016
|
||||
#define APP_RING_STOP_EVT 0x0032
|
||||
#define APP_TALK_START_EVT 0x0064
|
||||
#define APP_BTN_HOLD_EVT 0x0010
|
||||
#define APP_RING_STOP_EVT 0x0020
|
||||
#define APP_TALK_START_EVT 0x0040
|
||||
|
||||
/*********************************************************************
|
||||
* MACROS
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ const uint8 zclApp_PowerSource = POWER_SOURCE_DC;
|
||||
#define DEFAULT_ModeOpen Never
|
||||
#define DEFAULT_ModeSound TRUE
|
||||
|
||||
#define DEFAULT_TimeRing 3 //seconds to ring, before answer
|
||||
#define DEFAULT_TimeTalk 1 //seconds to talk, before open
|
||||
#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,12 +75,14 @@ application_config_t zclApp_Config = {
|
||||
.TimeRing = DEFAULT_TimeRing,
|
||||
.TimeTalk = DEFAULT_TimeTalk,
|
||||
.TimeOpen = DEFAULT_TimeOpen,
|
||||
.TimeBell = DEFAULT_TimeBell,
|
||||
.TimeReport = DEFAULT_TimeReport,
|
||||
};
|
||||
|
||||
device_state_t zclApp_State = {
|
||||
.State = Idle,
|
||||
.RingRunStep = 0,
|
||||
.pressTime = 0,
|
||||
};
|
||||
|
||||
|
||||
@@ -121,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}},
|
||||
};
|
||||
|
||||
@@ -156,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]]);
|
||||
@@ -146,7 +151,7 @@ const device = {
|
||||
model: 'DIYRuZ_Zintercom',
|
||||
vendor: 'DIYRuZ',
|
||||
description: '[Matrix intercom auto opener](https://diyruz.github.io/posts/zintercom/)',
|
||||
icon: 'https://github.com/diyruz/Zintercom/blob/master/images/z2m.png?raw=true',
|
||||
icon: 'https://raw.githubusercontent.com/diyruz/Zintercom/master/images/z2m.png',
|
||||
fromZigbee: [
|
||||
fromZigbeeConverters.battery,
|
||||
fz.diy_zintercom_config,
|
||||
@@ -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