simplify command

This commit is contained in:
Sandro Zimmermann 2025-12-06 14:52:36 +01:00
parent 7302f3b2b3
commit bfe3c81ee7

View File

@ -9,10 +9,10 @@ GPIO.setmode(GPIO.BCM)
GPIO.setup(LED_PIN, GPIO.OUT) GPIO.setup(LED_PIN, GPIO.OUT)
def trigger_action(command): def trigger_action(command):
if "turn on the light" in command.lower(): if "on" in command.lower():
GPIO.output(LED_PIN, GPIO.HIGH) GPIO.output(LED_PIN, GPIO.HIGH)
print("Light ON") print("Light ON")
elif "turn off the light" in command.lower(): elif "off" in command.lower():
GPIO.output(LED_PIN, GPIO.LOW) GPIO.output(LED_PIN, GPIO.LOW)
print("Light OFF") print("Light OFF")