Is there a way to distinguish user input from callback output?

Hi guys, does anyone know of a good way to differentiate weather a callback was triggered by the user input or by another callback? Specifically for components that don’t have the n_clicks property.
I’m using Dash to create a GUI for an electrochemical analyzer running on a backend script (I know that’s not what it’s intended to be used for but I love the possibilities it offers including easy integration of plotly graphs, so I’m hacking around a little). The issue is that I have some input components (like daq boolean switches) that occasionally get updated by processes running on the backend. So if I update the ‘on’ parameter of a boolean switch from the backend to reflect the state on the instrument, the callback of that switch gets triggered again.
I use an interval component with a callback to periodically check for updates from the backend and updating the ui elements accordingly.
An easy way to suppress the callback on those elements would be to update a second parameter (like a hidden div) on backend updates, so the callback of the input element could check that and only update if that indicator wasn’t set so the callback only fires when the user activates/deactivates the switch which wouldn’t set the indicator.
The problem with using a second indicator is that if I’m using it as a second input, that actually triggers the callback twice and if I’m using it as state, I can’t tell whether it’s been changed. That would be okay if the callback could itself reset the indicator but since it is already an output of the interval callback, so I can’t use it as an output of the switch callback. The restriction in Dash that an output cannot be set by more than one callback is really making things difficult for me. From other forum discussions, I understand that in many use cases multiple callbacks setting the same output can lead to problems, but here it would be really useful!
I hope it’s somewhat understandable what I’m trying to achieve and what the issue is. I’ll try and generate a minimal code example.
Any ideas would be much appreciated!

So, here’s a minimal example:


import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_daq as daq
from dash.dependencies import Input, Output, State

app = dash.Dash(__name__)

app.layout = html.Div(children=[
    dcc.Interval(
        id='interval-component',
        interval=100,
        n_intervals=0
        ),
    daq.BooleanSwitch(id="example_switch"),
    daq.Indicator(id="example_indicator")])

@app.callback(
    Output('example_indicator','value'),
    [Input('example_switch','on')])
def switching(on):
    sendCommandtoBackend()
    return(on)

@app.callback(
    Output('example_switch','on'),
    [Input('interval-component','n_intervals')])
def updateSwitch(n_intervals):
    update = checkForUpdate() # checking whether backend provided an update
    if update == True:
        update_value = getUpdate()
        return update_value
    else:
        return dash.no_update

if __name__ == '__main__':
    app.run_server(debug=True, host='10.3.141.1', port=8086)

Basically, I want to be able to update the ‘on’ state of the boolean switch using the Output of the updateSwitch function without triggering the callback of the switching function (while still getting the user input when clicking the switch). Currently, every time the backend updates the switch, the callback gets triggered and resend the command.

Found a hacky solution to use two store components, update one from the backend, the other in the callback of the component and compare their values.