Hmm, it seems im going to have to dig into scene codeing with luup as the standard options do not provide the flexibility needed for some features.
So… als a total programming noob im going to start off here with a specifick example after looking through some code snippets and not being able to find what i would like to achieve.
All feedback is welcome, even if its just a link to a usefull thread.
- Id like to trigger a siren for a certain amount of time upon scene activation (ALARM ON) and then stop the siren again (1 sec).
I took a look at the code for emergency lights an christmastree (blinking lights) on how to turn on and off something, but couldnt quite hack it.
How do i convert this code by @aa6vh to switching on a siren (change of serviceId) and then stopping it after 1 second? (does sBlink work for sirens or do i need another piece of code there?)
function DipOnPorchLight(stuff)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="1" },19)
if (sBlink == "1") then
luup.call_timer("DipOffPorchLight", 1, "1", "", "")
end
end
function DipOffPorchLight(stuff)
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{ newTargetValue="0" },19)
if (sBlink == "1") then
luup.call_timer("DipOnPorchLight", 1, "1", "", "")
end
end
Or would this be closer? (havent got it to work yet)
local siren1 = 15
local On1 = 0.2
-- Keep siren on for preset time
function SirenOn()
luup.call_action("urn:upnp-org:serviceId:siren1","SetLoadLevelTarget",{ newLoadlevelTarget="1" },siren1)
luup.call_timer("SirenOn", 1, On1 , "", "")
end
-- Turn siren off
luup.call_action("urn:upnp-org:serviceId:siren1","SetLoadLevelTarget",{ newLoadlevelTarget="0" },Device1)
end
Anyone have any suggestions?