Automation determine who changed input

Is there a way in my automation to determine who changed the value of an input?

I have a custom Mqtt script running on a Pi that sends values from a Bose csp. I have input numbers holding the volume values. I want to be able to send the new values back to the server via mqtt but only when they changed by the user and not an endless loop.


If the value of the input_number is changed by an automation, trigger.to_state.context.user_id will be none otherwise it will be a long alphanumeric string representing the user’s identifier. If you simply check that user_id is not none it will mean it was changed by a user (via the UI).

Whatever automation you are using to call the custom MQTT script, will need to check trigger.to_state.context.user_id (assuming it employs something like a State Trigger that reports context.user_id).