So I’m trying to write a rule for a virtual switch that will (eventually) tell me over the sink audio what songs are playing on active squeezebox players.
Right now i have it checking one playrr, eventuly I’ll need to do a group and check if the players are actively playing.
I’m having an issue with a regex for album title where I need to strip out brackets and whatever is within the brackets. I’m alittle rusty with regex but this is throwing me for a loop within OH2 and keeps returning NULL. Here’s my rule so far:
rule "announce" when
Item SBAnnounce changed then {
if (SBAnnounce.state == ON) {
val String = transform("REGEX", "igiveupremovebrackets", SBPRottonPi_Album.state.toString)
/*
val String = SBPRottonPi_Album.state
*/
var linetosay = String::format("The current song playing is " + SBRottonPi_Artist + "on the album" + String)
say(linetosay, "voicerss:enUS")
SBAnnounce.postUpdate(OFF)
/* this is now going through chromecast binding so it plays full
SBPGoogleHome_Player.sendCommand(OFF)
*/
}
}
end
Sorry for the messy code… Been doing it mostly via ssh from phone