Disable automation if lovelace card used

An odd one I know but haven’t been able to find anyone asking this, may be the search terms I used.

Does anyone know how I could possibly turn off an automation if a Lovelace card is used, the card in this case is simple thermostat.

So what I am after is when I adjust simple thermostat from the card specifically it triggers an automation to turn off a thermostat automation I have in place that is enabled.

I don’t see a way to do this from the card itself and I don’t think I can do it based on the thermostat entity events from what I can tell as the thermostat automation I have in place would likely trigger the automation I am suggesting above and disable itself.

Hopefully this makes sense, keen for suggestions, maybe there is a simple fix I’m not seeing.

Trigger on the state or attributes of the climate device changing.

Check the context in the conditions to make sure it was an adjustment from the frontend, see: State.context to UI automation - #24 by mbuscher

      - conditions: # Only passes for HA user interface as source of change
          - condition: template
            value_template: '{{ trigger.to_state.context.id != none }}'
          - condition: template
            value_template: '{{ trigger.to_state.context.parent_id == none }}'
          - condition: template
            value_template: '{{ trigger.to_state.context.user_id != none }}'

Use the homeassistant.turn_off to turn off the automation.

1 Like