Sound plays twice (RPI, Openhabian, Audio jack)

Recently I had to re-install Openhabian on my RPI 3 again. After the installation I ran the usual adaptations in the openhabian config menu (user rights, updates, etc.)
For the voice announcements I use the VoiceRSS add-on and the say() commands in the rules. Via the audio jack there is a speaker linked to the RPI.

The only issue I have is that announcements are played twice. This only happens for the audio coming from the RPI directly. Voice on a tablet (with “Web Audio” set in PaperUI) with habpanel runs fine, announcements are audible just once, no second “echo”.

I dont know whether this is an openhab(ian) issue or something related to the RPI or a Linux issue. It used to work in the beginning and I dont know what I did that is causing the sound playing twice on the speaker and I really have no clue how to fix this (tried several settings in PaperUI, etc.). Is anyone else having a similar issue or an idea how to fix this?

Have you tried cleaning the cache and rebooting?

sudo systemctl stop openhab2

sudo openhab-cli clean-cache

sudo reboot

It would help if you would post the rule(s) used for that topic.

@H102
I tried that but it did not help. But thanks for the quick reply.

@opus
Here is one of the rules in which this issue happens:

rule "New Notification"
when
    Item Notifications received command or
    Item Cam01_Motion_Image received update
then
    //logInfo("default.rules", "Trigger Item: " + triggeringItem.name)
    
    // Bildschirm aus?
    if (Lenovo_Screen.state == OPEN) {
        Lenovo_Command.sendCommand("SCREEN_ON")
        Thread::sleep(1000)//1s
    }
    
    if (triggeringItem.name == "Notifications") {
        //logInfo("default.rules", "#rule: New Notification# - Neue Benachrichtigung: " + receivedCommand.toString)
        Tablet_Dashboard.sendCommand("Benachrichtigungen")
        //logInfo("default.rules", "Speech_Notifications_Switch: " + Speech_Notifications_Switch.state)
        if (Speech_Notifications_Switch != "OFF") {
            say(receivedCommand.toString)
        }
    }
    else if (triggeringItem.name == "Cam01_Motion_Image") {
        //logInfo("default.rules", "#rule: New Notification# - Neue Bewegung erkannt")
        if (Speech_Notifications_Switch != "OFF") {
            playSound("doorbell.mp3")
        }
        Tablet_Dashboard.sendCommand("Kamera")
    }

    //Stay on Dashboard for 20s
    Thread::sleep(20000)

end

On a side note: sleeping for anything beyond 1s or so is a really bad idea in rules, because you can easily choke all 5 threads for rule execution. And all kinds of side effects are known to happen.

I noticed you removed the logging, Have you verified that the rule is not actually executed twice in a row?

Thanks for the hint. I will try to find a better solution for this. Basically I just want the rule to wait for a couple of seconds before executing another command.

When I enable logging it appears that the rule is only executed once. As mentioned in the first post, when I enable Web Audio on the tablet, it works fine. It only happens on the speaker linked to the RPI for whatever reason.