Solution: Distinguish a Manual Versus Automated Switch Flip (Tasmota)

I am using a number of tasmota devices, mostly Shelly-1 light switches. I wanted to be able to tell the difference between a manual flip of the switch and an auomatic one. Why? I consider a manual flip as a motion sensor. It tells me someone is at the switch. I also wanted to setup a panic capability where a double switch-ON flip within seconds sends a panic Telegram text. This is working on OH3.

Items
	panic_frontdoor Switch, expire 1s, OFF
	ShellyFrontdoor - linked to MQTT switch command, autoupdate=true
	ShellyFrontdoor_feedback - linked to MQTT switch state, autoupdate not specified
rule "Shelly frontdoor manual switch flipped"
    when
        Item ShellyFrontdoor_feedback changed
    then
        if (ShellyFrontdoor_feedback.state == ShellyFrontdoor.state) return;  // automatic flip
		// If here, a manual switch was flipped 
        ShellyFrontdoor.postUpdate(ShellyFrontdoor_feedback.state)
		// Place code here related to a motion event, if you wish
		// panic code to follow
		if (ShellyFrontdoor_feedback.state == ON) {
			if (panic_frontdoor.state == ON)    
				send_telegram.sendCommand("Panic alert - Frontdoor Light Switch Panic Occured")
			else  {
				Thread::sleep(300)
				panic_frontdoor.sendCommand(ON)
			}
		}
    end

I had to play with the 0.3 sec sleep to eliminate debounce issues.