Hallo,
nachdem jetzt ein Echo Show 8 anstelle eine PiCore Players die musikalische Unterhaltung in der Küche übernommen hat, wollte ich die rule zum Umschalten bei unerwünschten Titeln hier
Für Alexa umstricken. Natürlich haut das nicht so ganz hin.
Ich möchte erreichen daß bei bestimmten Titeln oder Interpreten von meinem Stammsender auf einen Ausweichsender umgeschaltet wird und nach 3 Minuten wieder zurück.
Irgendwie kriegt der Echo auch den Befehl umzuschalten, startet aber den Sender nicht.
Code
Group Alexa_Kitchen <player>
// Player control
Player Echo_Kitchen_Player "Player" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:player"}
Dimmer Echo_Kitchen_Volume "Volume [%.0f %%]" <soundvolume> (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:volume"}
Number Echo_Kitchen_Treble "Treble" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:equalizerTreble"}
Number Echo_Kitchen_Midrange "Midrange" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:equalizerMidrange"}
Number Echo_Kitchen_Bass "Bass" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:equalizerBass"}
Switch Echo_Kitchen_Shuffle "Shuffle" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:shuffle"}
// Media channels
Dimmer Echo_Kitchen_MediaProgress "Media progress" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:mediaProgress"}
Number:Time Echo_Kitchen_MediaProgressTime "Media progress time [%d %unit%]" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:mediaProgressTime"}
Number:Time Echo_Kitchen_MediaLength "Media length [%d %unit%]" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:mediaLength"}
// Player Information
String Echo_Kitchen_ImageUrl "Image URL" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:imageUrl"}
String Echo_Kitchen_Title "Title" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:title"}
String Echo_Kitchen_Subtitle1 "Subtitle 1" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:subtitle1"}
String Echo_Kitchen_Subtitle2 "Subtitle 2" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:subtitle2"}
String Echo_Kitchen_ProviderDisplayName "Provider" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:providerDisplayName"}
// Music provider and start command
String Echo_Kitchen_MusicProviderId "Music Provider Id" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:musicProviderId"}
String Echo_Kitchen_PlayMusicCommand "Play music voice command (Write Only)" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:playMusicVoiceCommand"}
String Echo_Kitchen_StartCommand "Start Information" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:startCommand"}
// TuneIn Radio
String Echo_Kitchen_RadioStationId "TuneIn Radio Station Id" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:radioStationId"}
Switch Echo_Kitchen_Radio "TuneIn Radio" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:radio"}
// Amazon Music
String Echo_Kitchen_AmazonMusicTrackId "Amazon Music Track Id" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:amazonMusicTrackId"}
String Echo_Kitchen_AmazonMusicPlayListId "Amazon Music Playlist Id" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:amazonMusicPlayListId"}
Switch Echo_Kitchen_AmazonMusic "Amazon Music" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:amazonMusic"}
// Bluetooth
String Echo_Kitchen_BluetoothMAC "Bluetooth MAC Address" <bluetooth> (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:bluetoothMAC"}
Switch Echo_Kitchen_Bluetooth "Bluetooth" <bluetooth> (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:bluetooth"}
String Echo_Kitchen_BluetoothDeviceName "Bluetooth Device" <bluetooth> (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:bluetoothDeviceName"}
// Commands
String Echo_Kitchen_Announcement "Announcement" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:announcement"}
String Echo_Kitchen_TTS "Text to Speech" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:textToSpeech"}
Dimmer Echo_Kitchen_TTS_Volume "Text to Speech Volume" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:textToSpeechVolume"}
String Echo_Kitchen_Remind "Remind" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:remind"}
String Echo_Kitchen_PlayAlarmSound "Play Alarm Sound" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:playAlarmSound"}
String Echo_Kitchen_StartRoutine "Start Routine" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:startRoutine"}
Dimmer Echo_Kitchen_NotificationVolume "Notification volume" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:notificationVolume"}
Switch Echo_Kitchen_AscendingAlarm "Ascending alarm" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:ascendingAlarm"}
// Feedbacks
String Echo_Kitchen_LastVoiceCommand "Last voice command" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:lastVoiceCommand"}
DateTime Echo_Kitchen_NextReminder "Next reminder" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:nextReminder"}
DateTime Echo_Kitchen_NextAlarm "Next alarm" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:nextAlarm"}
DateTime Echo_Kitchen_NextMusicAlarm "Next music alarm" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:nextMusicAlarm"}
DateTime Echo_Kitchen_NextTimer "Next timer" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:nextTimer"}
String Echo_Kitchen_Announcement "Announcement" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:announcement"}
String Echo_Kitchen_TTS "Text to Speech" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:textToSpeech"}
Dimmer Echo_Kitchen_TTS_Volume "Text to Speech Volume" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:textToSpeechVolume"}
String Echo_Kitchen_Remind "Remind" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:remind"}
String Echo_Kitchen_PlayAlarmSound "Play Alarm Sound" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:playAlarmSound"}
String Echo_Kitchen_StartRoutine "Start Routine" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:startRoutine"}
Dimmer Echo_Kitchen_NotificationVolume "Notification volume" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:notificationVolume"}
Switch Echo_Kitchen_AscendingAlarm "Ascending alarm" (Alexa_Kitchen) {channel="amazonechocontrol:echoshow:account1:echoshow8:ascendingAlarm"}
Alles anzeigen
Code
//by AcidZero
import java.util.List
rule "echoswitch1"
when
Item Echo_Kitchen_Title changed
then
val List<String> blacklist = newArrayList("lewis capaldi", "watermelon sugar", "benny blanco", "james arthur", "zoe wees") //Blacklist
for (var i = 0 ; i < blacklist.size() ; i++)
{
if (triggeringItem.state.toString.toLowerCase.contains(blacklist.get(i)))
{
logInfo("squeezeswitch", "gefunden: " + blacklist.get(i))
Echo_Kitchen_TTS.sendCommand('<speak>Das kann sich ja kein Mensch anhören. ich schalte mal um.</speak>')
Echo_Kitchen_Volume.sendCommand(22)
Echo_Kitchen_RadioStationId.sendCommand('s116053') //s116053 ist Antenne Niedersachsen
createTimer(now.plusSeconds(180),[ Echo_Kitchen_RadioStationId.sendCommand('s56857') ]) //s56857 ist NDR2
i = blacklist.size()
}
}
end
Alles anzeigen
Code
log" data-line="1">2021-09-26 09:28:08.816 [vent.ItemStateChangedEvent] - Echo_Kitchen_Title changed from NDR 2 - NDR 2 - ndr.de/ndr2 to Lauv & Troye Sivan - I'm So Tired
2021-09-26 09:30:39.614 [vent.ItemStateChangedEvent] - Echo_Kitchen_Title changed from Lauv & Troye Sivan - I'm So Tired to NDR 2 - NDR 2 - ndr.de/ndr2
2021-09-26 09:31:10.056 [vent.ItemStateChangedEvent] - Echo_Kitchen_Title changed from NDR 2 - NDR 2 - ndr.de/ndr2 to ATB x Topic x A7S - Your Love (9PM)
2021-09-26 09:33:25.562 [vent.ItemStateChangedEvent] - Echo_Kitchen_Title changed from ATB x Topic x A7S - Your Love (9PM) to NDR 2 - NDR 2 - ndr.de/ndr2
2021-09-26 09:33:39.743 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@1d36cc3': POST url 'https://alexa.amazon.de/api/tunein/queue-and-play?deviceSerialNumber=xyz ' failed: Internal Server Error
org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.de/api/tunein/queue-and-play?deviceSerialNumber=Gxyz failed: Internal Server Error
at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:691) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.Connection.playRadio(Connection.java:1265) ~[?:?]
at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:512) ~[?:?]
2021-09-26 09:33:39.297 [vent.ItemStateChangedEvent] - Echo_Kitchen_Title changed from NDR 2 - NDR 2 - ndr.de/ndr2 to Kygo feat. Zoe Wees - Love Me Now
2021-09-26 09:33:39.438 [ome.event.ItemCommandEvent] - Item 'Echo_Kitchen_TTS' received command <speak>Das kann sich ja kein Mensch anhören. ich schalte mal um.</speak>
2021-09-26 09:33:39.473 [ome.event.ItemCommandEvent] - Item 'Echo_Kitchen_Volume' received command 22
2021-09-26 09:33:39.508 [ome.event.ItemCommandEvent] - Item 'Echo_Kitchen_RadioStationId' received command s116053
2021-09-26 09:33:39.512 [nt.ItemStatePredictedEvent] - Echo_Kitchen_TTS predicted to become <speak>Das kann sich ja kein Mensch anhören. ich schalte mal um.</speak>
2021-09-26 09:33:39.537 [nt.ItemStatePredictedEvent] - Echo_Kitchen_Volume predicted to become 22
2021-09-26 09:33:39.561 [nt.ItemStatePredictedEvent] - Echo_Kitchen_RadioStationId predicted to become s116053
2021-09-26 09:33:39.584 [vent.ItemStateChangedEvent] - Echo_Kitchen_TTS changed from to <speak>Das kann sich ja kein Mensch anhören. ich schalte mal um.</speak>
2021-09-26 09:33:39.589 [vent.ItemStateChangedEvent] - Echo_Kitchen_Volume changed from 33 to 22
2021-09-26 09:33:39.592 [vent.ItemStateChangedEvent] - Echo_Kitchen_RadioStationId changed from s56857 to s116053
2021-09-26 09:33:53.139 [vent.ItemStateChangedEvent] - Echo_Kitchen_TTS changed from <speak>Das kann sich ja kein Mensch anhören. ich schalte mal um.</speak> to
2021-09-26 09:33:53.173 [vent.ItemStateChangedEvent] - Echo_Kitchen_RadioStationId changed from s116053 to s56857
Alles anzeigen