Is there a way to create a template sensor that has the value of who changed the state of a switch? I mean whether the device state was changed by an automation or manually via frontend/wall switch. The context is: I am creating an automation that will turns on/off the hot water system depending on whether there is sufficient solar power generated to run the water heater at that time (so that I am not drawing power from the grid). However, I would like to be able to manually turn on the water heater from frontend dashboard and not have the automation turn-off the water heater if it was turned on manually and not via an automation. Is there something similar to state.last_changed which can be used to find state ‘who changed it’? I can see the Logbook entry in the device which shows turned on by automationxxxx . Don’t know how to create a template sensor out of that which has the value of who changed the state of the entity.