Capture last HA command (idea)

So the other night, my wife said “alexa, turn on the living room lights”, immediately, she realized she accidentally said the wrong light, Then she jokingly said “Alexa Control Z”, funny nerd humor, but got me thinking, If I could caputre the last command ran by HA to maybe an input text, or some other variable, then make a script to do the opposite. So Light_turn_off, if the last command was light_turn_on, etc. Then create a Alexa Routine called “control Z” that would run that script.

I know I can do all of that other than not sure how I would capture the last command ran, and then use that command as a variable/entity.

Really mostly just thought this would be funny/cool. but the concept might have good use for other sort of automations in the future

1 Like