Do you have a Zigbee Siren and running Z2M? - Looking for ppl to do a test

Hi,

I’m looking for people having a zigbee siren and using Zigbee2MQTT.

Could you please reply with:

  1. Your model of siren
  2. Does the configuration of modes/volume/strobe (Z2M UI) work with current release 1.21.0 ?

I have made an updated converter for the Climax siren, and a new integration for the Develco SIRZB-110 but we had to change the tz.warning to make the configurable modes to work.

So, this post is about figuring out if your siren work according to 2), or if not, would you like to test the new tz.warning?

I have z2m 1.21 and a tuya ts0216. It only exposes battery, alarm on/off, volume and lqi.

I tried to start a conversation here Siren functionality in HA? · Discussion #8284 · Koenkk/zigbee2mqtt · GitHub

Hi Nick,

If I send you a full local converter, can you put in your device in this .js file and test your siren?

This is my siren (Develco SIRZB-110) with all attributes it support.

I’ll give it a go, what is the easiest way to send it? email? github? pastebin? carrier pigeon?

Use code below, save this to a new file on your local zigbee2mqtt folder and name it testwarning.js
In your zigbee2mqtt configuration, add this local converter to your config:

external_converters:
  - testwarning.js
devices: devices.yaml

Here’s the code for the local converter:

const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const constants = require('zigbee-herdsman-converters/lib/constants');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;

const tzLocal = {
    warning: {
        key: ['warning'],
        convertSet: async (entity, key, value, meta) => {
            const mode = {'stop': 0, 'burglar': 1, 'fire': 2, 'emergency': 3, 'police_panic': 4, 'fire_panic': 5, 'emergency_panic': 6};
            const level = {'low': 0, 'medium': 1, 'high': 2, 'very_high': 3};
            const strobeLevel = {'low': 0, 'medium': 1, 'high': 2, 'very_high': 3};
            const values = {
                mode: value.mode || 'police_panic',
                level: value.level || 'very_high',
                strobe: value.hasOwnProperty('strobe') ? value.strobe : false,
                duration: value.hasOwnProperty('duration') ? value.duration : 60,
                strobeDutyCycle: value.hasOwnProperty('strobe_duty_cycle') ? value.strobe_duty_cycle * 10 : 0,
                strobeLevel: value.hasOwnProperty('strobe_level') ? strobeLevel[value.strobe_level] : 1,
            };
            const info = (mode[values.mode]) + ((values.strobe ? 1 : 0) << 4) + (level[values.level] << 6);
            await entity.command(
                'ssIasWd',
                'startWarning',
                {startwarninginfo: info, warningduration: values.duration,
                    strobedutycycle: values.strobeDutyCycle, strobelevel: values.strobeLevel},
                utils.getOptions(meta.mapped, entity),
            );
        },
    },
}

module.exports = [
    {
        zigbeeModel: ['TS0216'],
        model: 'TS0216',
        vendor: 'TuYa',
        description: 'Sound and flash siren',
        fromZigbee: [fz.ts0216_siren, fz.battery],
        exposes: [e.warning(), e.battery(), exposes.binary('alarm', ea.STATE_SET, true, false),
            exposes.numeric('volume', ea.ALL).withValueMin(0).withValueMax(100).withDescription('Volume of siren')],
        toZigbee: [tz.ts0216_alarm, tz.ts0216_duration, tz.ts0216_volume, tzLocal.warning],
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
            // Device advertises itself as Router but is an EndDevice
            device.type = 'EndDevice';
            device.save();
        },
    },
];

Restart Zigbee2MQTT, do a reconfigure on your Tyua device from the Z2M UI.
Then go to exposes, and play with the new warning settings, and report back if it works or not.

This is what now should be visible in the UI-> exposes

I’ve got the TS0216 and the settings appear in the frontend but don’t seem to do anything. When I press apply it just triggers the alarm. Are you sure this functionality is available on this model?

What I’d really like to know is if this siren can be bound to a smoke alarm? Looking at binding in the UI only exposes ota cluster.

@Morphy

That was the intention of the code above. Comparing the old code with this new code.

Could you please test the below and report back?

Existing code:
Select BURGLAR, can you also change the different modes of siren level ?
Does it support the STROBE ?

Same test with new code :slight_smile:

Which existing code? Without the external converter .js?

Those options…

…didn’t exist until I added the converter file. They don’t change anything, when I hit apply it just triggers the same siren on the same volume level.

Okie, please change from following line

toZigbee: [tz.ts0216_alarm, tz.ts0216_duration, tz.ts0216_volume, tzLocal.warning],

to

toZigbee: [tz.ts0216_alarm, tz.ts0216_duration, tz.ts0216_volume, tz.warning],

This means you will use the official tz.warning rather then the local. I’m curious how this will behave for you :slight_smile:

Nothing has changed. I changed the line, restarted Z2M and reconfigured the device. Still changing any of those options has no effect and just triggers the siren at the same volume level as was set before changing them.

Ok, then this siren do not support any other feature. Can you please share a screenshot of the attributes from Dev-Tools in HA ?

image

Could you please post your code somewhere sensible like github?

This looks very wrong as a first line

const fz = {...require('zigbee-herdsman-converters/converters/fromZigbee'), legacy: require('zigbee-herdsman-converters/lib/legacy').fromZigbee};

Do the volume buttons work on your model? They don’t seem to change my volume for some reason.

I seem to remember they are a bit hit & miss. I’ll test tomorrow.

Cheers. They work to enable pairing so not physically damaged. They just don’t seem to do anything else.

It is actually correct :slight_smile:

…with any version of the tz.warning (original in dev 1.21.0) and the modified local ?

Error: Parse error on line 1:
const fz = {	...req
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

This from an online json lint tool (jsonlint.com)