Update input select helper without triggering automation

I have an automation for roller shades that is triggering twice every time it is run. The triggers are a physical button on a switch and an input select helper with options “up” and “down.” The input select allows the shade to be controlled on the dashboard. To keep the state of the helper in sync with the state of the roller shade, part of the action is to update the helper, but that will trigger the automation once more. The automation works, but I believe it is causing a lot of duplicate warnings in the logs.

I tried adding context user id as a condition to test that a user vs automation updating the helper state, but was unable to get it working. Please let me know if there is a better way of configuring this automation.

alias: Test automation
description: ""
triggers:
  - trigger: state
    entity_id:
      - event.window_switch_scene_001
    id: shade_up_button
  - trigger: state
    entity_id:
      - event.window_switch_scene_003
    id: shade_down_button
    enabled: true
  - trigger: state
    entity_id:
      - input_select.shade
    id: input_shade_up
    enabled: true
    from: Down
    to: Up
  - trigger: state
    entity_id:
      - input_select.shade
    id: input_shade_down
    enabled: true
    from: Up
    to: Down
conditions: []
actions:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: and
                conditions:
                  - condition: trigger
                    id:
                      - shade_up_button
                  - condition: state
                    entity_id: event.window_switch_scene_001
                    attribute: event_type
                    state: KeyPressed
              - condition: trigger
                id:
                  - input_shade_up
            alias: Shade Up
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.window_relay_1_up
          - action: input_select.select_option
            metadata: {}
            data:
              option: Up
            target:
              entity_id: input_select.shade
      - conditions:
          - condition: or
            conditions:
              - condition: and
                conditions:
                  - condition: trigger
                    id:
                      - shade_down_button
                  - condition: state
                    entity_id: event.window_switch_scene_003
                    attribute: event_type
                    state: KeyPressed
              - condition: trigger
                id:
                  - input_shade_down
            alias: Shade Down
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.window_relay_2_down
          - action: input_select.select_option
            metadata: {}
            data:
              option: Down
            target:
              entity_id: input_select.shade
mode: single

i thought about it some more, and i think maybe the simplest solution is to clear the input select at the beginning of the action to null since the trigger is the value changing from up to down or down to up, but I am having issues with this also.

I would have to add a third option for “none” and set it to this at the beginning of the action, but then the tiles on the dashboard would cycle between 3 options instead of up and down. I guess I could have separate tiles for up and down, but I wanted to keep the dashboard simple.

is there something like anything like an input_select.clear option? or a way to have input_select.select_next only cycle between 2 options?

I’d try to separate the two things. The roller shade should reports its position. Then use a button or an event to trigger the automation from the dashboard.

the roller shade is actually a dumb motor. I have it hooked up to a double relay, so there is no reporting of position. The buttons on the switch activate relays for up and down.

Maybe add an action to disable the automation before you change the state then re enable it after.