Switch returns to off by itself after being turned on automatically

I’m experiencing a strange behavior with a template switch and its underlying actual switch (the template switch serves only to invert the behavior of the underlying switch).

I have a Node-RED sequence that turns the template switch, which controls an awning, to off when the Location Mode (an input_select helper) is set to “Away”. This retracts the awning.

When this triggered automatically today via a state change on the Location Mode helper, the expected behavior, turn the template switch off, executed as expected. However, 1:06 later, the inverse happened and the awnings were commanded to extend by the template switch changing back to on. I cannot figure out why this happened. I don’t have any automations, scenes or node-red sequences that extend the awnings, so I can eliminate accidental triggering of my own code.

Any thoughts would be welcome

      kitchen_awning_inverted:
        friendly_name: Kitchen Awning
        unique_id: d9854c12-a23b-4f5b-a5da-58eb0af504a5
        value_template: "{{ is_state('switch.kitchen_awning', 'off') }}"
        turn_on:
          service: homeassistant.turn_off
          data:
            entity_id: switch.kitchen_awning
        turn_off:
          service: homeassistant.turn_on
          data:
            entity_id: switch.kitchen_awning
        icon_template: "{% if is_state('switch.kitchen_awning', 'on') %}mdi:awning-outline{% else %}mdi:awning-outline{% endif %}"