How do I automate based on the trigger of another device?

I have a smart socket that I suspect occasionally turns off for no reason. Normally in the history I do get a trigger, with the switch being toggled by an automation or by someone using the frontend to call the switch service. But when the device is switched by pushing the physical toggle button (or as I suspect, for no reason), then there is no known trigger in the log book.

I want to use that fact, that there is no known trigger, as a trigger; ie, create an automation that runs when the switch was triggered by “nothing”, or when someone pushed the physical button.

Looking at the events or capturing them in nodered, I cant see a difference in the events if they are triggered by a service or by pressing the button. The log book does show a difference, giving me a trigger and username if I used the service, and nothing when I press the button:
image

so I guess this has to be possible somehow?

And many more posts already on this topic.

Rather use the event listener under the dev tools to see all event data.