Zigbee smoke alarm: turn on siren with switch


i bought new smoke detectors “frient smoke detector” with zigbee 3.0. I’m using
“Sonoff Zigbee Gateway ZBDongle-E” as gateway with the zigbee-binding in openHAB.

I have auto discovered the smoke detectors and added items “automatically” to my model.

It seems to work, but i cannot switch on the siren: the item “Fire Alarm” was added as “Switch”, but there is only the text “OFF” - no Switch?!

On zigbee2mqtt i found a documentation for this device:

Triggering alarm, Simple
Can be set by publishing to zigbee2mqtt/FRIENDLY_NAME/set with payload {“alarm”: “START”} and {“alarm”: “OFF”} Set max_duration from the Zigbee2MQTT UI or by publishing {“max_duration”: NEW_VALUE} This alarm are preset to highest volume

What is missing?

Best regards

Maybe you do not have a command topic in your thing (only guessing).

Thing channel config has to look something like this:

  • id: smoke_alarm
    channelTypeUID: mqtt:switch
    label: SEND ALARM
    description: “”
    commandTopic: zigbee2mqtt/FRIENDLY_NAME/set
    formatBeforePublish: ‘{“alarm”: “%s”}’
    off: OFF
    on: START

I don’t use mqtt, but the zigbee-binding. I think the documentation of zigbee2mqtt is helpful, to findout the “api” of my smoke detector.

Another Screenshot:

The configuration of the item:

label: Fire Alarm
type: Switch
category: SmokeDetector
  - RauchmelderArbeitszimmer
groupType: None
function: null
  - Point

I don’t have this device, but from the zigbee2mqtt documentation I would think you need to send JSON arguments to the Warning Device channel.

Since OH recognizes the Fire Alarm channel as a switch (not a string), I’m guessing that the “Triggering alarm, Simple” method in the z2m documentation doesn’t work. OH wouldn’t know how to send START to switch item.

Thanks, you are right: to switch on the siren, send a command “type=warning” to the “warning device”:

I think i got it now::
Item ‘RauchmelderArbeitszimmer_Fire_Alarm’ changed from OFF to ON

This seems to be a read-only switch. I can create rules for that event and send the “warning command” to trigger sirens in other rooms.

I extended my rules to switch on all sirens when recieving an alarm of one smoke detector. To disable all sirenes i have created another rule. Here i want to check the state of the item. This does not work.

For debugging purposes i tried to log the following:

The first log statement works, but the second not:

2024-02-07 14:19:52.819 [INFO ] [.script.ui.rauchmelderSirenenAlleAus] - Rauchmelder_Wohnzimmer_Warning_Device (Type=StringItem, State=type=warning duration=PT6S, Label=Warning Device, Category=Siren, Tags=[Point], Groups=[RauchmelderWohnzimmer, Gruppe_Rauchmelder_Sirene])
2024-02-07 14:19:52.828 [ERROR] [b.automation.script.javascript.stack] - Failed to execute script:
org.graalvm.polyglot.PolyglotException: TypeError: invokeMember (getItem) on org.openhab.core.internal.items.ItemRegistryImpl@195180a failed due to: Cannot convert '[object Object]'(language: JavaScript, type: W) to Java type 'java.lang.String': Invalid or lossy primitive coercion.
	at <js>.l(@openhab-globals.js:2) ~[?:?]
	at <js>.:program(<eval>:9) ~[?:?]
	at org.graalvm.polyglot.Context.eval(Context.java:399) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.eval(GraalJSScriptEngine.java:458) ~[?:?]

Any ideas?

I would want only the room that’s on fire to sound the alarm so that I immediately know where the problem is.

I can’t help you with your rule, as I don’t use Blockly.

In javascript this is the following code: