Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c833dc48ab | ||
|
|
bc3f698efc | ||
|
|
29ff218b19 | ||
|
|
44087fceb9 | ||
|
|
a4fe271d30 | ||
|
|
deafb7667e | ||
|
|
29c71487ea | ||
|
|
5e02f3c97a | ||
|
|
2b89cbc188 | ||
|
|
23626a37d1 | ||
|
|
468d299e9e | ||
|
|
afc1124b64 |
66
README.md
@@ -1,5 +1,21 @@
|
||||
# Zintercom
|
||||
## Zigbee Intercom Automator
|
||||
##### Zigbee Intercom Automator
|
||||
This device is designed to control the matrix intercom using Zigbee.
|
||||
|
||||
Using zigbee2mqtt you can:
|
||||
1. Receive notification when the intercom rings. (also support **direct bind**)
|
||||
2. Mute the sound on the intercom handset.
|
||||
3. Automatically or manually open the door or hang up when the intercom rings.
|
||||
|
||||
There are 4 work modes:
|
||||
1. `Never` - ordinary work mode, use handset to control
|
||||
2. `Once` - one time open door when intercom rings
|
||||
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.
|
||||
The number of flashes indicates the current operating mode.
|
||||
|
||||
### How to join
|
||||
Reset to FN by reboot device 5 times with interval less than 10 seconds.
|
||||
@@ -7,39 +23,65 @@ Reset to FN by press and hold BTN for 5 seconds.
|
||||
|
||||
LED will flash during reset.
|
||||
|
||||

|
||||
|
||||
|
||||
### 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_dashboard.png" width="45%">
|
||||
|
||||
<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
|
||||
|
||||
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="35%">
|
||||
<img src="./images/back_microUSB.png" width="35%">
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
### Battery Power
|
||||
|
||||
Support only `end device` mode.
|
||||
Install `E18-MS1-PCB` only!
|
||||
<img src="./images/back_2xAAA.png" width="35%">
|
||||
<img src="./images/back_CR2032.png" width="35%">
|
||||
|
||||
Do not turn off `sound` because it turns U2 forever, which will drain the battery much faster.
|
||||
|
||||
Since the device is in sleep mode, it cannot receive commands.
|
||||
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.
|
||||
|
||||

|
||||
|
||||
##### The mode set by the Zigbee command `overwrites` the mode set by the button.
|
||||
|
||||
### Binding
|
||||
The device supports direct binding of an incoming call to the onOff cluster.
|
||||
|
||||
For example, you can turn on the light while a call comes to the intercom, for notification in mute mode.
|
||||
|
||||
|
||||
### 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)
|
||||
|
||||
|
||||
### Inspired by
|
||||
The original scheme of the intercom opener by [Alexander Vaidurov](https://easyeda.com/Alex_AW/domofon-with-battery)
|
||||
Various hardware solutions by [Jager](https://modkam.ru)
|
||||
Firmware for different Zigbee devices by [Anonymous](https://github.com/nurikk/)
|
||||
|
||||
@@ -88,8 +88,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
|
||||
*/
|
||||
@@ -141,6 +139,8 @@ 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);
|
||||
//start new stop timer (ring ends timer)
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_RING_STOP_EVT, 3000);
|
||||
|
||||
if (portAndAction & HAL_KEY_PRESS) {
|
||||
//osal_pwrmgr_task_state(zclApp_TaskID, PWRMGR_HOLD);
|
||||
@@ -148,26 +148,36 @@ static void zclApp_HandleKeys(byte portAndAction, byte keyCode) {
|
||||
|
||||
//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());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
//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_reload_timer(zclApp_TaskID, APP_BTN_HOLD_EVT, 50);
|
||||
}
|
||||
else {
|
||||
osal_start_reload_timer(zclApp_TaskID, APP_BTN_CLICK_EVT, 50);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +296,7 @@ static void zclApp_RingRun(void) {
|
||||
}
|
||||
break;
|
||||
case Droped:
|
||||
if (zclApp_State.RingRunStep > 3) {
|
||||
if (zclApp_State.RingRunStep > 1) {
|
||||
zclApp_RingEnd();
|
||||
}
|
||||
break;
|
||||
@@ -379,9 +389,6 @@ static void zclApp_BtnClick(bool hold) {
|
||||
currentBtnClickPhase = 0;
|
||||
break;
|
||||
}
|
||||
#if defined( ZIC_BATTERY_MODE )
|
||||
zclBattery_Report();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void zclApp_Report(void) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -64,8 +64,8 @@ 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
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ application_config_t zclApp_Config = {
|
||||
device_state_t zclApp_State = {
|
||||
.State = Idle,
|
||||
.RingRunStep = 0,
|
||||
.pressTime = 0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,11 +7,6 @@ const {
|
||||
const ep = exposes.presets;
|
||||
const ea = exposes.access;
|
||||
|
||||
const ZCL_DATATYPE_INT16 = 0x29;
|
||||
const ZCL_DATATYPE_UINT8 = 0x20;
|
||||
const ZCL_DATATYPE_UINT16 = 0x21;
|
||||
const ZCL_DATATYPE_BOOLEAN = 0x10;
|
||||
const ZCL_DATATYPE_INT32 = 0x2b;
|
||||
const bind = async (endpoint, target, clusters) => {
|
||||
for (const cluster of clusters) {
|
||||
await endpoint.bind(cluster, target);
|
||||
@@ -63,8 +58,6 @@ const repInterval = {
|
||||
MINUTE: 60,
|
||||
};
|
||||
|
||||
|
||||
|
||||
const fz = {
|
||||
diy_zintercom_config: {
|
||||
cluster: 'closuresDoorLock',
|
||||
@@ -150,11 +143,10 @@ const tz = {
|
||||
|
||||
const device = {
|
||||
zigbeeModel: ['DIY_Zintercom'],
|
||||
model: 'DIY_Zintercom',
|
||||
vendor: 'xyzroe',
|
||||
description: '[Intercom Auto Opener]',
|
||||
supports: '',
|
||||
//homeassistant: [hass.temperature, hass.presure, hass.humidity, hass.co2],
|
||||
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',
|
||||
fromZigbee: [
|
||||
fromZigbeeConverters.battery,
|
||||
fz.diy_zintercom_config,
|
||||
@@ -169,37 +161,11 @@ const device = {
|
||||
configure: async (device, coordinatorEndpoint) => {
|
||||
const firstEndpoint = device.getEndpoint(1);
|
||||
|
||||
//await bind(firstEndpoint, coordinatorEndpoint, ['msCO2', 'closuresDoorLock', 'genOnOff']);
|
||||
|
||||
await bind(firstEndpoint, coordinatorEndpoint, ['closuresDoorLock', 'genPowerCfg']);
|
||||
|
||||
const overides = {min: 0, max: 3600, change: 0};
|
||||
await configureReporting.batteryVoltage(firstEndpoint, overides);
|
||||
await configureReporting.batteryPercentageRemaining(firstEndpoint, overides);
|
||||
/*
|
||||
if (device.applicationVersion < 3) { // Legacy PM2 firmwares
|
||||
const payload = [{
|
||||
attribute: 'batteryPercentageRemaining',
|
||||
minimumReportInterval: 0,
|
||||
maximumReportInterval: 3600,
|
||||
reportableChange: 0,
|
||||
}, {
|
||||
attribute: 'batteryVoltage',
|
||||
minimumReportInterval: 0,
|
||||
maximumReportInterval: 3600,
|
||||
reportableChange: 0,
|
||||
}];
|
||||
await firstEndpoint.configureReporting('genPowerCfg', payload);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
const msBindPayload = [{
|
||||
attribute: 'measuredValue',
|
||||
minimumReportInterval: 0,
|
||||
maximumReportInterval: 3600,
|
||||
reportableChange: 0,
|
||||
}];
|
||||
await firstEndpoint.configureReporting('msCO2', msBindPayload);
|
||||
*/
|
||||
|
||||
const payload = [{
|
||||
attribute: {
|
||||
@@ -212,20 +178,6 @@ const device = {
|
||||
},
|
||||
];
|
||||
await firstEndpoint.configureReporting('closuresDoorLock', payload);
|
||||
/**/
|
||||
/*
|
||||
await firstEndpoint.configureReporting('msTemperatureMeasurement', msBindPayload);
|
||||
await firstEndpoint.configureReporting('msRelativeHumidity', msBindPayload);
|
||||
|
||||
const pressureBindPayload = [{
|
||||
attribute: 'scaledValue',
|
||||
minimumReportInterval: 0,
|
||||
maximumReportInterval: 3600,
|
||||
reportableChange: 0,
|
||||
}];
|
||||
await firstEndpoint.configureReporting('msPressureMeasurement', pressureBindPayload);
|
||||
*/
|
||||
|
||||
|
||||
},
|
||||
exposes: [
|
||||
|
Before Width: | Height: | Size: 330 KiB After Width: | Height: | Size: 313 KiB |
|
Before Width: | Height: | Size: 348 KiB After Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 347 KiB |
|
Before Width: | Height: | Size: 265 KiB After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 298 KiB |
|
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 198 KiB |
BIN
images/z2m.png
Normal file
|
After Width: | Height: | Size: 190 KiB |
BIN
images/z2m_dashboard.gif
Normal file
|
After Width: | Height: | Size: 559 KiB |
|
Before Width: | Height: | Size: 45 KiB |