Files
openhab/rules/salon.kodi.rules

60 lines
1.6 KiB
Plaintext
Raw Normal View History

2018-07-01 21:48:20 +02:00
rule "Gramy!"
when
Item Kodi_State changed to Play
then
/* cottonballs */
2018-07-01 21:48:20 +02:00
sOWFS01.sendCommand(OFF)
/* prawe kanapowe */
sSONOFF09b_expected.postUpdate(sSONOFF09b.state)
sSONOFF09b.sendCommand(OFF)
2018-07-01 21:48:20 +02:00
Mpd_quodlibet_StartStop_expected.postUpdate(Mpd_quodlibet_StartStop.state)
Mpd_quodlibet_StartStop.sendCommand(OFF)
sHighPerformance.sendCommand(ON)
2018-07-01 21:48:20 +02:00
end
rule "Nie gramy"
when
Item Kodi_State changed to Stop
/* or
Item Kodi_State changed to Pause */
2018-07-01 21:48:20 +02:00
then
/* bezpośrednie odwoływanie się do tych zmiennych powoduje jakieś nulle */
var preCB = sOWFS01_expected.state.toString()
/* ponizsze generuje w linijce z ifem: The name '<XFeatureCallImplCustom> == <XFeatureCallImplCustom>' cannot be resolved to an item or type.
var OnOffType preQL = Mpd_quodlibet_StartStop_expected.state */
var preQL = Mpd_quodlibet_StartStop_expected.state.toString()
var preCL = sSONOFF09b_expected.state.toString() /* prawe couchlight */
2018-07-01 21:48:20 +02:00
logInfo("niegramy", "Restore QL to {}", preQL)
/* Mpd_quodlibet_StartStop.sendCommand(preQL.toString())*/
/* nie działa: preQL as StringType
preQL.toString()
*/
if (preQL == "ON") {
sendCommand(Mpd_quodlibet_StartStop, ON)
} else {
// logInfo("niegramy", "Did not restore QL. why?")
}
logInfo("niegramy", "Restore sOWFS01 to {}", preCB)
/* sOWFS01.sendCommand(preCB) */
/* sOWFS01.sendCommand(sOWFS01_expected.state.toString()) zakomentowane, bo null instance */
/* sendCommand(sOWFS01, preCB) */
if (preCB == "ON") {
sendCommand(sOWFS01, ON)
}
logInfo("niegramy", "Restore Right Couchlights to {}", preCL)
2021-04-10 15:50:42 +02:00
if (preCL == "ON") {
sSONOFF09b.sendCommand(ON)
}
sHighPerformance.sendCommand(OFF)
2018-07-01 21:48:20 +02:00
end