How do I lie to Homekit? I want to send a "false state" for an object with no state

With some help, I got this script working:

TL;DR

We have a gate we cannot see, but trigger to open with a Tasmota switch. Ideally, we use Siri and Homekit to open the gate.

The problem is, that Homekit isn’t sent the “state” of the gate, so it thinks it is always trying to open. What I would like to do, is have Home Assistant falsify a state, and send it to homekit.

Something like this:

state:
  do_thing: If script to open gate is called; 
  then:
    send: state of gate is open
    wait:  wait 60 seconds
    send: state of gate is closed
  else: gate is closed

How can I send a false gate state to homekit whenever the open gate script is fired?

Make a template switch with an assumed state by using an input boolean. Just keep in mind that it will get out of sync on restart if the state of your gate doesn’t match the state of your inputboolean. But you can quickly rectify that by flipping the boolean.

make an input_boolean called fake_state or gate or whatever…

switch:
- platform: template
  switches:
    gate:
      friendly_name: Gate
      value_template: "{{ states('input_boolean.fake_gate') }}"
      turn_on:
      - service: homeassistant.turn_on
        target:
          entity_id: 
          - switch.tasmota_switch
          - input_boolean.fake_gate
      - delay: "00:01:00"
      - service: homeassistant.turn_off
        target:
          entity_id: input_boolean.fake_gate
      turn_off:
      - service: homeassistant.turn_on
        target:
          entity_id: 
          - switch.tasmota_switch
          - input_boolean.fake_gate
      - delay: "00:01:00"
      - service: homeassistant.turn_off
        target:
          entity_id: input_boolean.fake_gate

Both turn on and turn off will open the gate, but you can change the turn off sequence.

Thanks! I will give this a shot!