Grego
(Gregor)
July 6, 2020, 3:32pm
1
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.
Need your help.
Thanks.
rossko57
(Rossko57)
July 6, 2020, 4:24pm
2
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
Hi All,
Based on the Information from shrap i was able to create a Simple Solution using an Rule, which is enough for me at the moment.
My Rule:
rule "Reboot Cube on Failures"
when
Item Reboot_Cube received command //Dummy Switch Item
then
if (receivedCommand==ON ) {
sendHttpPutRequest("http://192.168.xxx.xxx:8080/rest/things/max:bridge:OEQ1944954/config","application/json",'{"action-cubeReboot":"1234"}')
}
end
Hope this hel…
J-N-K
(Jan N. Klug)
July 6, 2020, 5:11pm
3
Please provide information how the siren is represented in the deconz REST API. I‘ll add support for that.
Grego
(Gregor)
July 6, 2020, 6:19pm
4
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”,
Grego
(Gregor)
July 6, 2020, 6:36pm
5
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
J-N-K
(Jan N. Klug)
July 6, 2020, 6:56pm
6
Exactly. What would you expect in openHAB, a switch?
Grego
(Gregor)
July 6, 2020, 7:26pm
7
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).
J-N-K
(Jan N. Klug)
July 9, 2020, 5:08pm
8