-
Platform information:
- Hardware: raspberry PI 4 / 4 GB RAM / SD 32 GB
- OS: Raspbian GNU/Linux 10 (buster)
- Java Runtime Environment: which java platform is used and what version
- openHAB version: 2.5.9-1
-
Issue of the topic:
I have an item to turn sonos alarm on and off. The item is controlled with a rule and is changed as required. But the alarm is not changed in the sonos app. I’ve had the problem for some time. But unfortunately i can’t say the exact time or issue. I have only one alarm in sonos app set.
Item:
/* Items Wecker Sonos */ Switch Sonos_Eltern_Alarm "Elternzimmer [%s]" <time> { channel="sonos:SYMFONISK:RINCON_347E5C34951601400:alarm" }
Rule:
// Wecker steuern
logInfo(funcTitle, "SettingControlAudio.state == {}", SettingControlAudio.state)
if(SettingControlAudio.state == ON) {
var int SettingAlarm = 0
logInfo(funcTitle, "ParamCalDavWecker.state = {}", ParamCalDavWecker.state)
SettingAlarm = (SettingAlarm_Eltern.state as Number).intValue
if (SettingAlarm == 0) {
sendCommand(Sonos_Eltern_Alarm, OFF)
} else if (SettingAlarm == 1) {
sendCommand(Sonos_Eltern_Alarm, ON)
} else if (SettingAlarm == 2) {
if (ParamCalDavWecker.state == "aus") {
sendCommand(Sonos_Eltern_Alarm, OFF)
} else if (ParamCalDavWecker.state == "an") {
sendCommand(Sonos_Eltern_Alarm, ON)
}
}
logInfo(funcTitle, "Sonos_Eltern_Alarm.state = {}, SettingAlarm = {}", Sonos_Eltern_Alarm.state, SettingAlarm)
Log:
2020-10-05 07:25:35.439 [ome.event.ItemCommandEvent] - Item ‘Sonos_Eltern_Alarm’ received command ON
2020-10-05 07:25:35.467 [nt.ItemStatePredictedEvent] - Sonos_Eltern_Alarm predicted to become ON
Result: The alarm in the sonos app remains off