Skip to content

Commit ae412b4

Browse files
authored
Support Fire Angel Zigbee Module (P-LINE) (dresden-elektronik#7941)
1 parent 0e8502d commit ae412b4

13 files changed

+685
-0
lines changed

de_web_plugin.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,19 @@ void DeRestPluginPrivate::apsdeDataIndicationDevice(const deCONZ::ApsDataIndicat
11691169
DB_StoreZclValue(&dbVal);
11701170
}
11711171
}
1172+
else if (r->prefix() == RDevices && ind.clusterId() == IAS_ZONE_CLUSTER_ID)
1173+
{
1174+
if (itemSuffix == RAttrZoneType)
1175+
{
1176+
DB_ZclValue dbVal;
1177+
dbVal.deviceId = device->deviceId();
1178+
dbVal.endpoint = ind.srcEndpoint();
1179+
dbVal.clusterId = ind.clusterId();
1180+
dbVal.attrId = 0x0001;
1181+
dbVal.data = i->toNumber();
1182+
DB_StoreZclValue(&dbVal);
1183+
}
1184+
}
11721185
}
11731186

11741187
if (!eventLastUpdatedEmitted && i->descriptor().suffix[0] == 's') // state/*

device.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,11 @@ void DEV_GetDeviceDescriptionHandler(Device *device, const Event &event)
839839

840840
if (event.what() == REventStateEnter)
841841
{
842+
// if there is a IAS Zone Cluster add the RAttrZoneType
843+
if (DEV_GetSimpleDescriptorForServerCluster(device, 0x0500_clid))
844+
{
845+
device->addItem(DataTypeUInt16, RAttrZoneType);
846+
}
842847
DEV_EnqueueEvent(device, REventDDFInitRequest);
843848
}
844849
else if (event.what() == REventDDFInitResponse)

device_ddf_init.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,5 +556,19 @@ bool DEV_InitDeviceBasic(Device *device)
556556
}
557557
}
558558

559+
zclVal.clusterId = 0x0500; // IAS Zone cluster
560+
zclVal.attrId = 0x0001; // IAS Zone Type
561+
zclVal.data = 0;
562+
563+
if (DB_LoadZclValue(&zclVal) && zclVal.data != 0)
564+
{
565+
ResourceItem *item = device->addItem(DataTypeUInt16, RAttrZoneType);
566+
if (item && item->toNumber() != zclVal.data)
567+
{
568+
item->setValue(zclVal.data, ResourceItem::SourceDevice);
569+
item->clearNeedPush();
570+
}
571+
}
572+
559573
return found == poi.size();
560574
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* global Attr, Item */
2+
// Map battery voltage from 1.9V ... 3.0V to 0% ... 100%
3+
Item.val = Math.max(0, Math.min(Math.round(9.09090909 * (Attr.val - 19), 100)))

devices/fireangel/0019_swversion.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* global Attr, Item */
2+
const v = Attr.val
3+
Item.val = (v & 0x000000ff).toString() + '.' +
4+
((v & 0x0000ff00) >> 8).toString() + '.' +
5+
((v & 0x00ff0000) >> 16).toString() + '.' +
6+
((v & 0xff000000) >> 24).toString()

devices/fireangel/co_alarm.json

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
{
2+
"schema": "devcap1.schema.json",
3+
"manufacturername": "Fireangel",
4+
"modelid": "Alarm_SD_Device",
5+
"vendor": "Fire Angel",
6+
"product": "Zigbee Radio Module (P-LINE)",
7+
"matchexpr": "R.item('attr/zonetype').val === 0x002B",
8+
"sleeper": false,
9+
"status": "Gold",
10+
"subdevices": [
11+
{
12+
"type": "$TYPE_WARNING_DEVICE",
13+
"restapi": "/lights",
14+
"uuid": [
15+
"$address.ext",
16+
"0x01"
17+
],
18+
"items": [
19+
{
20+
"name": "attr/id"
21+
},
22+
{
23+
"name": "attr/lastannounced"
24+
},
25+
{
26+
"name": "attr/lastseen"
27+
},
28+
{
29+
"name": "attr/manufacturername"
30+
},
31+
{
32+
"name": "attr/modelid"
33+
},
34+
{
35+
"name": "attr/name"
36+
},
37+
{
38+
"name": "attr/swversion",
39+
"parse": {
40+
"fn": "zcl:attr",
41+
"ep": "0x01",
42+
"cl": "0x0019",
43+
"at": "0x0002",
44+
"script": "0019_swversion.js"
45+
},
46+
"read": {
47+
"fn": "zcl:attr",
48+
"ep": "0x01",
49+
"cl": "0x0019",
50+
"at": "0x0002"
51+
},
52+
"refresh.interval": 86400
53+
},
54+
{
55+
"name": "attr/type"
56+
},
57+
{
58+
"name": "attr/uniqueid"
59+
},
60+
{
61+
"name": "cap/groups/not_supported"
62+
},
63+
{
64+
"name": "state/alert",
65+
"read": {
66+
"fn": "none"
67+
},
68+
"write": {
69+
"cl": "0x0502",
70+
"cmd": "0x01",
71+
"ep": "0x01",
72+
"eval": "Item.val === 'none' ? null : '01'",
73+
"fn": "zcl:cmd"
74+
}
75+
},
76+
{
77+
"name": "state/reachable"
78+
}
79+
]
80+
},
81+
{
82+
"type": "$TYPE_CARBONMONOXIDE_SENSOR",
83+
"restapi": "/sensors",
84+
"uuid": [
85+
"$address.ext",
86+
"0x01",
87+
"0x0500"
88+
],
89+
"fingerprint": {
90+
"profile": "0x0104",
91+
"device": "0x0403",
92+
"endpoint": "0x01",
93+
"in": [
94+
"0x0000",
95+
"0x0001",
96+
"0x0500"
97+
],
98+
"out": [
99+
"0x0019"
100+
]
101+
},
102+
"items": [
103+
{
104+
"name": "attr/id"
105+
},
106+
{
107+
"name": "attr/lastannounced"
108+
},
109+
{
110+
"name": "attr/lastseen"
111+
},
112+
{
113+
"name": "attr/manufacturername"
114+
},
115+
{
116+
"name": "attr/modelid"
117+
},
118+
{
119+
"name": "attr/name"
120+
},
121+
{
122+
"name": "attr/swversion",
123+
"parse": {
124+
"fn": "zcl:attr",
125+
"ep": "0x01",
126+
"cl": "0x0019",
127+
"at": "0x0002",
128+
"script": "0019_swversion.js"
129+
},
130+
"read": {
131+
"fn": "none"
132+
}
133+
},
134+
{
135+
"name": "attr/type"
136+
},
137+
{
138+
"name": "attr/uniqueid"
139+
},
140+
{
141+
"name": "config/battery",
142+
"parse": {
143+
"ep": "0x01",
144+
"cl": "0x0001",
145+
"at": "0x0020",
146+
"script": "0001_battery_voltage.js"
147+
},
148+
"read": {
149+
"fn": "zcl:attr",
150+
"ep": "0x01",
151+
"cl": "0x0001",
152+
"at": "0x0020"
153+
},
154+
"refresh.interval": 43260
155+
},
156+
{
157+
"name": "config/enrolled"
158+
},
159+
{
160+
"name": "config/on"
161+
},
162+
{
163+
"name": "config/pending"
164+
},
165+
{
166+
"name": "config/reachable"
167+
},
168+
{
169+
"name": "state/carbonmonoxide",
170+
"read": {
171+
"fn": "zcl:attr",
172+
"ep": "0x01",
173+
"cl": "0x0500",
174+
"at": "0x0002"
175+
},
176+
"refresh.interval": 300
177+
},
178+
{
179+
"name": "state/lastupdated"
180+
},
181+
{
182+
"name": "state/lowbattery"
183+
},
184+
{
185+
"name": "state/tampered"
186+
},
187+
{
188+
"name": "state/test"
189+
}
190+
]
191+
}
192+
],
193+
"bindings": [
194+
{
195+
"bind": "unicast",
196+
"src.ep": "0x01",
197+
"cl": "0x0500"
198+
},
199+
{
200+
"bind": "unicast",
201+
"src.ep": "0x01",
202+
"cl": "0x0001"
203+
}
204+
]
205+
}

0 commit comments

Comments
 (0)