HTTP Binding PUT request to Deconz

Hey guys,

I am trying to get my Siren (SZ-SRN12N Sercomm) working with Openhab. The siren is connected to Deconz. Neither the Deconz nor the Hue binding can control the siren. You have to use the REST API from Deconz (https://dresden-elektronik.github.io/deconz-rest-doc/getting_started/) to control it.

I tried a REST APOI Client to switch the siren ON and OFF and it works. But I am struggling with sending the API-request from Openhab.

It has to be a PUT request to the Deconz:

In my case: 192.168.100.2:8686/api/MYAPIKEY/lights/17/state -X PUT -d ‘{ “alert”: “select” }’

But how to create the siren item?

I tried:

Switch Sirene { http=">[ON:PUT:192.168.100.2:8686/api/MYAPIKEY/lights/17/state:{ “alert”: “lselect” }] >[OFF:PUT:192.168.100.2:8686/api/MYAPIKEY/lights/17/state:{ “alert”: „none“ }]" }

But it doesn’t work. :frowning:

Need your help.

Thanks.

HTTP binding does not support PUT content
docs -

The :<postcontent> section is optional, new in version 1.9.0, and only applies when <httpmethod> is POST .

You can use HTTP Action from a rule, example

Please provide information how the siren is represented in the deconz REST API. I‘ll add support for that.

So what do you need exactly?
Does this help?:

“modelid”: “SZ-SRN12N”,
“name”: “Warning device”,
“state”: {
“alert”: “none”,
“reachable”: true
},
“swversion”: “0x12005A10”,
“type”: “Warning device”,

Thanks. This worked for me!

rule “Sirene an_aus”
when
Item Sirene changed
then

    if (Sirene.state==ON ) {
        sendHttpPutRequest("http://192.168.100.2:8686/api/MYAPIKEY/lights/17/state","application/json",'{"alert": "lselect"}')
    			}
            if (Sirene.state==OFF ) {
        sendHttpPutRequest("http://192.168.100.2:8686/api/MYAPIKEY/lights/17/state","application/json",'{"alert": "none"}')
    			}

end

Exactly. What would you expect in openHAB, a switch?

Yes. A switch would be great!

By the way: right now you are able to by this siren for a small amount of money at EBay. I paid 7 EUR (shipping included). :sunglasses:

Please try if https://janessa.me/esh/org.openhab.binding.deconz-2.5.7-SNAPSHOT.jar works for you.