Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.98k stars 1.67k forks source link

Support for Develco Smoke Alarm SMSZB-120 #3012

Closed BlizzWave closed 4 years ago

BlizzWave commented 4 years ago

The original issue has gone stale, but is still not resolved.

1809

Help with getting this smoke alarm to work with zigbee2mqtt.

Link to log

Log

Koenkk commented 4 years ago
BlizzWave commented 4 years ago

I'm running 1.11.0-dev actually. There's nothing being received while being triggered by smoke

Logging with command "DEBUG=zigbee-herdsman:controller* npm start"

BlizzWave commented 4 years ago

I have made some progress here. Smoke detection works and battery related stuff works.

I still don't get a successful interview though. And i don't know how to trigger the siren with command.

The technical manual helped me alot so far. Develco Smoke Alarm Technical Manual

{
"smoke":false,
"battery_low":false,
"linkquality":97,
"battery":"100.00",
"voltage":3500,
"battery_alarm_state":0,
"temperature":25.12,
"supervision_reports":true,
"restore_reports":true,
"test":false
}

Added this to my devices.js file


    {
       zigbeeModel: ['SMSZB-120'],
       model: 'SMSZB-120',
       vendor: 'Develco Products A/S',
       description: 'Smoke detector with siren',
       supports: 'smoke, warning, temperature',
       fromZigbee: [fz.temperature, fz.bitron_battery_att_report, fz.develco_smoke, fz.ignore_basic_report, fz.ignore_genOta],
       toZigbee: [tz.warning],
       meta: {configureKey: 1},
       configure: async (device, coordinatorEndpoint) => {
       const endpoint = device.getEndpoint(35);
       await bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'ssIasZone', 'genBasic']);
       await configureReporting.batteryVoltage(endpoint);
           const endpoint2 = device.getEndpoint(38);
           await bind(endpoint2, coordinatorEndpoint, ['msTemperatureMeasurement']);
       await configureReporting.temperature(endpoint2);
       },
    },

And added this to my fromZigbee.js file

    develco_smoke: {
        cluster: 'ssIasZone',
        type: ['attributeReport', 'readResponse', 'commandStatusChangeNotification'],
        convert: (model, msg, publish, options, meta) => {
            const zoneState = msg.data.zoneState;
            const zoneType = msg.data.zoneType;
            const zoneStatus = msg.data.zonestatus;
            const iasCieAddr = msg.data.iasCieAddr;
            const zoneId = msg.data.zoneId;

        return {
            sensor_type: zoneType,
            enrolled: zoneState,
            smoke: (zoneStatus & 1) > 0, // Bit 0 = Alarm: Smoke
            IASCIEAddress: iasCieAddr,
            zoneID: zoneId,
            battery_low: (zoneStatus & 1 << 3) > 0, // Bit 3 = Battery LOW indicator
        supervision_reports: (zoneStatus & 1 << 4) > 0,
        restore_reports: (zoneStatus & 1 << 5) > 0,
            test: (zoneStatus & 1 << 8) > 0,

            };    
        },
    },
Koenkk commented 4 years ago
BlizzWave commented 4 years ago
  • How did you got the device working now?

I thought that a device needed a successful interview to work. Therefor I thought that I could not troubleshoot.

  • Instead of develco_smoke I would recommend to use the already existing converter ias_smoke_alarm_1

They are not the same. The Develco Smoke alarm does not have tamper, trouble or ac_status. Ref. Tech Manual

  • For the siren try to add the following toZigbee converter: tz.warning and now send to zigbee2mqtt/NEO Sirene/set with payload {"warning": {"mode": "emergency"}}

This is what is says in the manual Nothing happens.

zigbee2mqtt:debug 2020-03-02 19:31:21: Received MQTT message on 'zigbee2mqtt2/0x0015bc0031004688/set' with data '{"warning": {"mode": "emergency"}}'
zigbee2mqtt:debug 2020-03-02 19:31:21: Publishing 'set' 'warning' to '0x0015bc0031004688'
zigbee2mqtt:error 2020-03-02 19:31:36: Publish 'set' 'warning' to '0x0015bc0031004688' failed: 'Error: Command 0x0015bc0031004688/1 ssIasWd.startWarning({"startwarninginfo":53,"warningduration":10}, {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) failed (Error: Timeout - 51981 - 1 - 2 - 1282 - 11 after 6000ms)'
zigbee2mqtt:debug 2020-03-02 19:31:36: Error: Command 0x0015bc0031004688/1 ssIasWd.startWarning({"startwarninginfo":53,"warningduration":10}, {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) failed (Error: Timeout - 51981 - 1 - 2 - 1282 - 11 after 6000ms)
    at Endpoint.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:344:23)
    at Generator.throw (<anonymous>)
    at rejected (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:6:65)
zigbee2mqtt:info  2020-03-02 19:31:36: MQTT publish: topic 'zigbee2mqtt2/bridge/log', payload '{"type":"zigbee_publish_error","message":"Publish 'set' 'warning' to '0x0015bc0031004688' failed: 'Error: Command 0x0015bc0031004688/1 ssIasWd.startWarning({\"startwarninginfo\":53,\"warningduration\":10}, {\"timeout\":6000,\"manufacturerCode\":null,\"disableDefaultResponse\":false}) failed (Error: Timeout - 51981 - 1 - 2 - 1282 - 11 after 6000ms)'","meta":{"friendly_name":"0x0015bc0031004688"}}'
zigbee2mqtt:debug 2020-03-02 19:34:25: Received Zigbee message from '0x0015bc0031004688', type 'commandStatusChangeNotification', cluster 'ssIasZone', data '{"zonestatus":48,"extendedstatus":0}' from endpoint 35 with groupID 0
Koenkk commented 4 years ago

Can you provide the database.db entry of this device? And are you sure it's possible to manually activate the alarm?

BlizzWave commented 4 years ago

Here you go:

{"id":2,"type":"EndDevice","ieeeAddr":"0x0015bc0031004688","nwkAddr":51981,"manufId":4117,"manufName":"Develco Products A/S","powerSource":"Battery","modelId":"SMSZB-120","epList":[1,35,38],"endpoints":{"1":{"profId":49353,"epId":1,"devId":1,"inClusterList":[3,5,6],"outClusterList":[],"clusters":{},"binds":[]},"35":{"profId":260,"epId":35,"devId":1026,"inClusterList":[0,1,3,15,32,1280,1282],"outClusterList":[10,25],"clusters":{"genBasic":{"attributes":{"modelId":"SMSZB-120","manufacturerName":"Develco Products A/S","powerSource":3,"zclVersion":1,"dateCode":"2018-11-26 06:22"}},"ssIasZone":{"attributes":{"iasCieAddr":"0x00124b00193e5093","zoneState":0}},"genPowerCfg":{"attributes":{"batteryVoltage":30,"batteryAlarmState":0}}},"binds":[]},"38":{"profId":260,"epId":38,"devId":770,"inClusterList":[0,3,1026],"outClusterList":[3],"clusters":{"msTemperatureMeasurement":{"attributes":{"measuredValue":2287}}},"binds":[]}},"dateCode":"2018-11-26 06:22","zclVersion":1,"interviewCompleted":false,"meta":{"configured":1},"lastSeen":1583231344532}

You are able to trigger the siren in Deconz so should be able to do it with zigbee2mqtt

4.2.4 IAS WD – Cluster id 0x0502 The IAS WD cluster is described in ZigBee Cluster Library Specification. Using this cluster, a ZigBee device can access a ZigBee enabled IAS WD device and issue alarm warning indications (Smoke siren) when a system alarm condition is detected.

Currently I'm testing if they trigger each other when there is smoke. ( I have multiple Develco smoke alarms)

Koenkk commented 4 years ago

The tz.warning uses the IAS WD cluster. Maybe the value is not correct, please try with different combinations:

So to zigbee2mqtt/NEO Sirene/set with payload {"warning": {"mode": "MODE", "level": "LEVEL"}}

BlizzWave commented 4 years ago

I tried every combination you can think of now, still no go. On thing though, I cannot get the enroll to work, do you think that hos something to do with it?

Koenkk commented 4 years ago

@BlizzWave I'm not sure if it has something to do with it. Are you sure triggering the alarm actually works via Deconz?

BlizzWave commented 4 years ago

Yes i'm sure it works with Deconz

Please have a read about it here: https://github.com/dresden-elektronik/deconz-rest-plugin/pull/1593

Also some info here. https://github.com/dresden-elektronik/deconz-rest-plugin/pull/1648

Maybe @SwoopX can help since he has done alot research regarding this?

Koenkk commented 4 years ago

Can you try with zigbee2mqtt/NEO Sirene/set with payload {"warning": {"mode": "burglar", "level": "high", "strobe": false, "duration": 300}}

BlizzWave commented 4 years ago

Still nothing

I find it really strange that it did not work with HEX 0x12 because thats what @SwoopX found out during his testing.

Hex 0x12 is 18 in decimal. Which we can see that zigbee2mqtt is sending: 0x0015bc0031004688/1 ssIasWd.startWarning({"startwarninginfo":18,"warningduration":300}

Why do we have the "1" after the friendly_name in the command?

Mar 06 08:01:32 raspberrypi npm[9343]: zigbee2mqtt:debug 2020-03-06 08:01:32: Received MQTT message on 'zigbee2mqtt2/0x0015bc0031004688/set' with data '{"warning": {"mode": "burglar", "level": "high", "strobe": false, "duration": 300}}'
Mar 06 08:01:32 raspberrypi npm[9343]: zigbee2mqtt:debug 2020-03-06 08:01:32: Publishing 'set' 'warning' to '0x0015bc0031004688'
Mar 06 08:01:47 raspberrypi npm[9343]: zigbee2mqtt:error 2020-03-06 08:01:47: Publish 'set' 'warning' to '0x0015bc0031004688' failed: 'Error: Command 0x0015bc0031004688/1 ssIasWd.startWarning({"startwarninginfo":18,"warningduration":300}, {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) failed (Error: Timeout - 14844 - 1 - 25 - 1282 - 11 after 6000ms)'
Mar 06 08:01:47 raspberrypi npm[9343]: zigbee2mqtt:debug 2020-03-06 08:01:47: Error: Command 0x0015bc0031004688/1 ssIasWd.startWarning({"startwarninginfo":18,"warningduration":300}, {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) failed (Error: Timeout - 14844 - 1 - 25 - 1282 - 11 after 6000ms)
Mar 06 08:01:47 raspberrypi npm[9343]:     at Endpoint.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:344:23)
Mar 06 08:01:47 raspberrypi npm[9343]:     at Generator.throw (<anonymous>)
Mar 06 08:01:47 raspberrypi npm[9343]:     at rejected (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:6:65)
Mar 06 08:01:47 raspberrypi npm[9343]: zigbee2mqtt:info  2020-03-06 08:01:47: MQTT publish: topic 'zigbee2mqtt2/bridge/log', payload '{"type":"zigbee_publish_error","message":"Publish 'set' 'warning' to '0x0015bc0031004688' failed: 'Error: Command 0x0015bc0031004688/1 ssIasWd.startWarning({\"startwarninginfo\":18,\"warningduration\":300}, {\"timeout\":6000,\"manufacturerCode\":null,\"disableDefaultResponse\":false}) failed (Error: Timeout - 14844 - 1 - 25 - 1282 - 11 after 6000ms)'","meta":{"friendly_name":"0x0015bc0031004688"}}'
SwoopX commented 4 years ago

Would it help if I provide you guys with a traffic sniff while triggering the alert?

BlizzWave commented 4 years ago

Would it help if I provide you guys with a traffic sniff while triggering the alert?

If you wouldn't mind that would be very helpful indeed!

SwoopX commented 4 years ago

Can do that in the evening.

BlizzWave commented 4 years ago

So i decided to make CC2531 sniffer because I was wondering what was going in with the enrollment not working. Some funny stuff here also. Error from Wireshark:

ZCL IAS Zone: Zone Status Change Notification, Seq: 4[Malformed Packet]

SwoopX commented 4 years ago

Here you go

grafik

Currently I'm testing if they trigger each other when there is smoke. ( I have multiple Develco smoke alarms)

Btw, if you find out how that exactly works, let me know ;)

BlizzWave commented 4 years ago

Thank you!

Here is how it looks when zigbee2mqtt is sending the command. But these seem different Acknowlegment Request Disable Default Resonse

sniff

SwoopX commented 4 years ago

Hm, if I recall correctly, the default response thingy could cause hickups... Also, I had real difficulties to get the device enrolled back in the days. Not sure if that has been sorted out by now.

@BlizzWave, has a default response been submitted somewhere later on?

I stumbled over this one here, but have no clue how this works (no need for it):

I don't think sending the default response would so much harm, when Disable Default Response bit is set. Not sending the default response when the bit is not set will do harm, since the device waiting for the response might conclude the coordinator is no longer reachable and eventually leave the network.

BlizzWave commented 4 years ago

I have just modified line 384 in endpoint.js so that I would get a "true" on the Disable Default Response.

return Object.assign({ timeout: 6000, manufacturerCode: null, disableDefaultResponse: true }, providedOptions);

This did not help.

Also the Frame Control Field: Cluster -specific is different.

I'm hoping @Koenkk will figure something out.

Koenkk commented 4 years ago

@SwoopX sniffer log shows that the message is send to endpoint 35, while yours is send to 1.

Try with:

{
    zigbeeModel: ['SMSZB-120'],
    model: 'SMSZB-120',
    vendor: 'Develco Products A/S',
    description: 'Smoke detector with siren',
    supports: 'smoke, warning, temperature',
    fromZigbee: [fz.temperature, fz.bitron_battery_att_report, fz.develco_smoke, fz.ignore_basic_report, fz.ignore_genOta],
    toZigbee: [tz.warning],
    meta: {configureKey: 1},
    configure: async (device, coordinatorEndpoint) => {
        const endpoint = device.getEndpoint(35);
        await bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'ssIasZone', 'genBasic']);
        await configureReporting.batteryVoltage(endpoint);
        const endpoint2 = device.getEndpoint(38);
        await bind(endpoint2, coordinatorEndpoint, ['msTemperatureMeasurement']);
        await configureReporting.temperature(endpoint2);
    },
    endpoint: (device) => {
        return {'default': 35};
    },
    },

Also, please remove the disableDefaultResponse that you've added.

SwoopX commented 4 years ago

@Koenkk good catch. Haven't thought about it since I don't need to worry with deconz. Of course it must go to 35, 1 is the manufacturer specific endpoint.

BlizzWave commented 4 years ago

Well I must be blind or something. Did not see that.

BUT It works now!

Thanks for the help @Koenkk and @SwoopX

To get the siren to start {"warning": {"mode": "burglar", "level": "high", "strobe": false, "duration": 300}}

To stop it {"warning": {"mode": "stop", "level": "low", "strobe": false, "duration": 300}}

It gives a error when starting the siren, but it works. Timing issue? Wireshark shows success.

Mar 08 19:32:44 raspberrypi npm[856]: zigbee2mqtt:error 2020-03-08 19:32:44: Publish 'set' 'warning' to '0x0015bc0031004688' failed: 'Error: Command 0x0015bc0031004688/35 ssIasWd.startWarning({"startwarninginfo":18,"warningduration":3}, {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) failed (Error: AREQ - AF - dataConfirm after 3000ms)'
Mar 08 19:32:44 raspberrypi npm[856]: zigbee2mqtt:debug 2020-03-08 19:32:44: Error: Command 0x0015bc0031004688/35 ssIasWd.startWarning({"startwarninginfo":18,"warningduration":3}, {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) failed (Error: AREQ - AF - dataConfirm after 3000ms)
Mar 08 19:32:44 raspberrypi npm[856]:     at Endpoint.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:344:23)
Mar 08 19:32:44 raspberrypi npm[856]:     at Generator.throw (<anonymous>)
Mar 08 19:32:44 raspberrypi npm[856]:     at rejected (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/controller/model/endpoint.js:6:65)
Mar 08 19:32:44 raspberrypi npm[856]: zigbee2mqtt:info  2020-03-08 19:32:44: MQTT publish: topic 'zigbee2mqtt2/bridge/log', payload '{"type":"zigbee_publish_error","message":"Publish 'set' 'warning' to '0x0015bc0031004688' failed: 'Error: Command 0x0015bc0031004688/35 ssIasWd.startWarning({\"startwarninginfo\":18,\"warningduration\":3}, {\"timeout\":6000,\"manufacturerCode\":null,\"disableDefaultResponse\":false}) failed (Error: AREQ - AF - dataConfirm after 3000ms)'","meta":{"friendly_name":"0x0015bc0031004688"}}'

response

Koenkk commented 4 years ago

Can you modify the toZigbee warning converter to add a timeout like done here: https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/converters/toZigbee.js#L844 ? (check if it works with a timeout of 10000).

BlizzWave commented 4 years ago

Can you modify the toZigbee warning converter to add a timeout like done here: https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/converters/toZigbee.js#L844 ? (check if it works with a timeout of 10000).

Like this?

EDIT That did work, just need to be careful of sending to many commands to fast.

const info = (mode[values.mode] << 4) + ((values.strobe ? 1 : 0) << 2) + (level[values.level]);
const opts = {timeout: 10000}; //Test

await entity.command(
    'ssIasWd',
    'startWarning',
    {startwarninginfo: info, warningduration: values.duration, opts},
    getOptions(meta),
Koenkk commented 4 years ago

Great, once you feel it's finished, could you make the PRs?

BlizzWave commented 4 years ago

Yes, I will do that. They way I modified the warning config effects all devices that use tz.warning. Should I create a separate config for the Develco ex. tz.warning_develco or should we have exception inside the current tz.warning? The latter I don't know how to do. I'm not good at programming!

Next thing is to look at is the enrollment issue. For a fire alarm to be really good it needs to be able to start other fire alarms without the need to go to the coordinator first. And if I understand the technical manual it should be able to do that.

@SwoopX Does enrollment work on Deconz?

Koenkk commented 4 years ago

Just create the PRs and I will do the cleanups.

SwoopX commented 4 years ago

@BlizzWave yes, it's working flawlessly. But as I said, I had trouble with zigbee2mqtt back in the days. Could that also be related to the endpoint? IAS stuff is endpoint 35...

Koenkk commented 4 years ago

@BlizzWave to check please sniff the traffic when pairing the device with zigbee2mqtt.

BlizzWave commented 4 years ago

Here's the log from Wireshark.

develco_fire_alarm_sniffing.zip

Koenkk commented 4 years ago

I'm not sure this was just an incident, but the status change notification, where zigbee-herdsman is waiting on to confirm it has been enrolled correctly, is malformed:

image

Could you sniff the traffic one more and confirm that the package is malformed again? If yes, I guess that the device is enrolled just fine (as it also triggers on smoke).

BlizzWave commented 4 years ago

Its not random. I get that every time. The smoke alarm does not set the enroll to true either. I have not tested with smoke to see if it triggers the other fire alarms yet though.

I quote myself from ealier, not from the same sniffing test:

Some funny stuff here also. Error from Wireshark:

ZCL IAS Zone: Zone Status Change Notification, Seq: 4[Malformed Packet]

Koenkk commented 4 years ago

But the alarm is triggered when there is smoke, right?

Sorry missed the malformed packet part, but in that case it's expected that interview fails, if the device works as expected this can be ignored though (in that case add it to the docs).

BlizzWave commented 4 years ago

Yes, it triggers. (Will do test with multiple alarms to check if they trigger each other later) The interview fails sometimes and you can try again and it works. I can remember reading something about this in another post, that the smoke alarm needs a couple of tries to actually interview correctly.

Koenkk commented 4 years ago

Good, as we cannot the interview fail issue (device issue due to the malformed packet), could you make a PR?

BlizzWave commented 4 years ago

Well I'm wondering if this happens on Deconz also, if its the device then Deconz should have the same error

@SwoopX could I bother you once more to do sniff traffic again while the sensor is being interviewed? In Deconz of course

SwoopX commented 4 years ago

What do you guys need exactly? Enrollment is working well on deconz side

grafik

However, I also see malformed packets, but typically directly after a valid one. Afaik, the malformed has an increased APS counter by 2.

grafik

BlizzWave commented 4 years ago

Could you post the whole log like I did?

SwoopX commented 4 years ago

Develco_join_neu3.zip

BlizzWave commented 4 years ago

@SwoopX That can't be correct. Contains no real Zigbee traffic

BlizzWave commented 4 years ago

I also get the Enroll request and Enroll response. But it keeps on asking for enroll even though it has gotten a successful response. And i get a malformed packet after a while, same as @SwoopX . I have also tested with smoke to see if they trigger each other. They dont NOT.

@SwoopX your enroll works, but if one alarm triggers from smoke does it start the other alarms? I'm assuming you have multiple. haha

SwoopX commented 4 years ago

That can't be correct. Contains no real Zigbee traffic

It is, Dedicated test gateway with only the sensor in it.

your enroll works, but if one alarm triggers from smoke does it start the other alarms?

Haven't tested that one, I currently don't dare it. Got 4 of them operational, two more lying around.

BlizzWave commented 4 years ago

That can't be correct. Contains no real Zigbee traffic

It is, Dedicated test gateway with only the sensor in it. Okay, I can't see it. If I sort by protocol I only get beacons from the Deconz. No joining or reporting of any sensor.

Might be asking alot, but the ones you have laying around, could you join them to your test network and see if they trigger each other from smoke?

Because if they dont then there is a issue with the firmware in the smoke alarm and I will send a email to Develco Support.

SwoopX commented 4 years ago

I knew this request would come... :P

I'll see what I can do on the weekend. Regarding the firmware, I know there are, well, "bugs" or inconsistencies. Was also thinking of reaching out trying to get access to their support forum. Not sure if some observations are known and eventually resolved by any updates. Maybe we can team up then...

BlizzWave commented 4 years ago

I knew this request would come... :P

I'll see what I can do on the weekend. Regarding the firmware, I know there are, well, "bugs" or inconsistencies. Was also thinking of reaching out trying to get access to their support forum. Not sure if some observations are known and eventually resolved by any updates. Maybe we can team up then...

Haha! I had to ask. Thanks for your help so far!

Btw I have contacted Develco. Hopefully I get some response. I'll l post what I get here. If (really big if here) theres some kind of firmware update for this issue. Then we stuble on a new issue, how would we update the smoke alarm?

BlizzWave commented 4 years ago

@SwoopX Did you get to test it?

A little update, I have been in contact with Develco about the enrollment issue. They are looking into it. Btw, to get access to their support forum you need to pay a fee.

SwoopX commented 4 years ago

A little update, I have been in contact with Develco about the enrollment issue. They are looking into it. Btw, to get access to their support forum you need to pay a fee.

Man, I just wanna have the firmware updates and the "bugs" fixed they have...

Haven't had the time to check it unfortunately. The meltdown out there made life a bit more complicated...

BlizzWave commented 4 years ago

Got a response from Develco today. @Koenkk what do you think?

Issue is that your Gateway is taking to long to answer the Enrollrequest.

Our sensors gives the TIMEOUT 0x94 (The exchange was aborted due to excessive response time.) after 15 seconds.


Lasse Pedersen Senior Technical Adviser Phone: +45 30 54 30 46 Develco Products A/S