I want to play the “doorbell” sound by a self-defined rule (created with the Eclipse Smart Home IDE). I want to play the sound when an Item receives a command.
When I use the Rules Engine via the Paper UI everything works fine, see the screenshots of my rule:
I am having the same problem. Did you find a solution?
I am trying to get playStream to work but I get the same error when I run playStream or playSound from a rule file.
While this may be working, this rule bloks a thread for 10 minutes or more if the window stays opened. You only have 5 threads to play with in openhab. If you have 5 of the same rules and you windows are opened, openHAB will stop executing any other rules.
There is a diffrent approach with the expire binding.
install the expire binding
new item:
Switch windowTimer { expire="10m, command=OFF" }
rules
rule "windowOpenCommand"
when
Item Heizung_Bad_Fensterkontakt_FensterZustand changed to OPEN
then
windowTimer.sendCommand(ON) // Start timer if window open
end
rule "windowClosedCommand"
when
Item Heizung_Bad_Fensterkontakt_FensterZustand changed to OPEN
then
windowTimer.sendCommand(OFF) // Stop timer if window closed
end
rule "window timer"
when
Item windowTimer received command OFF // Timer ended
then
if (Heizung_Bad_Fensterkontakt_FensterZustand.state.toString == "OPEN") {
playSound("RedAlert.mp3")
windowTimer.sendCommand(ON) // reset timer
}
end