Automation on/off on event data for IKEA Tradfri smart outlet

HI, I’m new to Home automation, and I recently manage to make 2 automations for my smart outlet, one that turns it off and the other to turn it on. I suppose it would be pretty ridiculous to have 2 automations for each. I would like to make 1 automation that would turn a plug off/on depending on an event and its data, probably being 1- the name, 2- the new state. I tried looking for many blueprints and understanding how it works, but they are usually pretty advanced compared to what I want to achieve for now.