[RFC] trigger events from states

These patchs are for #11762

This is my idea on how to do it, but I am not sure if yall would prefer to do it in a different way.

Looking for any comments or suggestions on a better way to do it :+1:

Thanks!
Daniel