Amazon Echo Radio and Player changes every Time to "ON" and "PLAY"

Hello community,

have reading a lot here and appreciate this forum. Thank you to all here.

Since a few weeks i have a problem with my Alexa rule.

It fires my Echo when the light in the Bathroom goes on to play the radio and when the light goes out it stops playing.
It was always working as it should but now it doesn’t stop anymore. i doesn’t here anything but the Item status says still playing. When i talk to the Alexa to play something else nothing happens too.
I have replaced the device with another which i have here. Same problem.

When I plug out the cable and wait a little bit, put it back. It works maybe 5times. Then same.

I have already upgraded to OH3 and changed my rules. Nothing.
Have renamed the Thing and Items. Nothing.

Maybe someone here can give me another tip. Would be great.
Thank you.

var CurrentHour = now.getHour() 
var CurrentMinute = now.getMinute() 



//Badezimmerlicht schaltet Radio ein BEIDE Daheim
rule "Badradio An BEIDE DAHEIM"
    when
         Item C_Bathroom_Light changed from OFF to ON

    then 
var Speaking = "-"

        switch vTimeOfDay.state {
        case "MORNING": Speaking = '<speak>Good Morning in the Morning. </speak>'
        case "FORENOON": Speaking = '<speak>Schönen Vormittag!</speak>'
        case "NOON":  Speaking = '<speak>Schönen Nachmittag!</speak>'
        case "AFTERNOON": Speaking = '<speak>Schönen Nachmittag!</speak>' 
        case "EVENING": Speaking = '<speak>Guten Abend!</speak>'
        case "NIGHT": Speaking = '<amazon:effect name="whispered">Zeit fürs Bett! </amazon:effect>' 
        case "BED": Speaking = '<amazon:effect name="whispered">Bett?</amazon:effect>'
        }
    

    if  
        (vAnwesend_Beide.state == ON && C_Bathroom_Light.state == ON){
            Echo_Badezimmer_UG_TTS_Volume.sendCommand(30)
            Thread::sleep(1000)
            Echo_Badezimmer_UG_TTS.sendCommand(Speaking)
            Thread::sleep(1000)          
            Echo_Badezimmer_UG_Radio.sendCommand(ON)
            
        }
        
       

end

rule "Badradio Aus BEIDE DAHEIM"
  when
            Item C_Bathroom_Light changed from ON to OFF or
            Item C_Bathroom_Light changed from something to OFF
     then 
var Speaking_Beide_Aus = "-"

        switch vTimeOfDay.state {
        case "MORNING": Speaking_Beide_Aus = '<speak>Good Morning in the Morning. </speak>'
        case "FORENOON": Speaking_Beide_Aus = '<speak>Schönen Vormittag!</speak>'
        case "NOON":  Speaking_Beide_Aus = '<speak>Schönen Nachmittag!</speak>'
        case "AFTERNOON": Speaking_Beide_Aus = '<speak>Schönen Nachmittag!</speak>' 
        case "EVENING": Speaking_Beide_Aus = '<speak>Guten Abend!</speak>'
        case "NIGHT": Speaking_Beide_Aus = '<speak><amazon:effect name="whispered">Gute Nacht!</amazon:effect></speak>'
        case "BED": Speaking_Beide_Aus = '<speak><amazon:effect name="whispered">Schlaf gut!</amazon:effect></speak>'
        }
    

        if  
        (vAnwesend_Beide.state == ON && C_Bathroom_Light.state == OFF){
            Echo_Badezimmer_UG_TTS.sendCommand(Speaking_Beide_Aus)
            Thread::sleep(500)                        
            Echo_Badezimmer_UG_Radio.sendCommand(OFF)
            Echo_Badezimmer_UG_Radio.postUpdate(OFF)
            Echo_Badezimmer_UG_Player.postUpdate(PAUSE)
        }
    
    end

That’s a weird looking trigger.

Does your events.log show you any evidence of -
(a) The off-rule trigger event
(b) The off-rule sending commands

Hello.
Yes both.

2021-04-25 14:49:38.753 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Echo_Badezimmer_UG_Player' received command PAUSE

2021-04-25 14:49:38.754 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Echo_Badezimmer_UG_Player' predicted to become PAUSE

2021-04-25 14:49:38.762 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Echo_Badezimmer_UG_Player' changed from PLAY to PAUSE

immediatly to this. I have also checked my Alexa rules in the Amazonapp.

2021-04-25 14:49:41.020 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Echo_Badezimmer_UG_Player' changed from PAUSE to PLAY

But the rule that you have shown us does not issue a command to that Item. Something else does that.

The Player Item changes automatically to PAUSE when the RADIO stops.

Is there a chance to go deeper into the logging?

Okay, but you didn’t show us that command so the events.log excerpt doesn’t relate to your rule at all.

So if the player Item auto changes to PAUSE … why also have your rule updating to PAUSE? Just confuses who is doing what to whom.

I’m not sure what you can usefully log. So far as I can see from the little on show, Alexa does not think your player is paused and issues an update to say so, some time after everything else.

Thank you for your reply.

I have just added this two lines already because it doesn’t work anymore. :slight_smile:

            Echo_Badezimmer_UG_Radio.postUpdate(OFF)
            Echo_Badezimmer_UG_Player.postUpdate(PAUSE)

Do you also use the Amazonbinding?

And it didn’t help, because Alexa thinks things are not like that and comes along later and changes it back.

Nope. If the problem is outside openHAB, I can’t help.

Have changed the logging. When the Radio should be turn to OFF this log appears.

2021-04-25 20:17:46.797 [DEBUG] [nternal.profiles.ProfileCallbackImpl] - Delegating command 'OFF' for item 'Echo_Badezimmer_UG_Radio' to handler for channel 'amazonechocontrol:echo:account1:echo2:radio'

Looks good. Now you need to figure out what Amazon does with that. (It’s maybe still dealing with the TTS you requested just 500mS earlier)