Standalone Setup Not Turning off Switch in Web Interface

I am running an ESP8266 device not connected to the Internet ( AP Mode ) by using the following settings

wifi:
  ap:
    ssid: "Hotspot"
    password: "password"
    ap_timeout: 1s

ota:

# Enable Web Server (optional)
web_server:
  local: true

I can connect to the Wifi Hotspot and the Web Interface is shown in a web browser at 192.168.4.1 perfectly.
I have 8 relays connected to 8 GPIO pins and one of the templates just turns on and off each relay in turn.

  - platform: template
    name: "16 - Go Nuts Switch all with 1s Delay"
    optimistic: yes
    id: go_nuts
    turn_on_action:
    - while:
        condition:
          lambda: 'return true;'
        then:
        - switch.turn_on: east_straight
        - delay: 1s
        - switch.turn_off: east_straight
        - delay: 1s
        - switch.turn_on: east_turn
        - delay: 1s
        - switch.turn_off: east_turn
        - delay: 1s
        - switch.turn_on: south_straight
        - delay: 1s
        - switch.turn_off: south_straight
        - delay: 1s
        - switch.turn_on: south_turn
        - delay: 1s
        - switch.turn_off: south_turn
        - delay: 1s
        - switch.turn_on: north_straight
        - delay: 1s
        - switch.turn_off: north_straight
        - delay: 1s
        - switch.turn_on: north_turn
        - delay: 1s
        - switch.turn_off: north_turn
        - delay: 1s
        - switch.turn_on: west_straight
        - delay: 1s
        - switch.turn_off: west_straight
        - delay: 1s
        - switch.turn_on: west_turn
        - delay: 1s
        - switch.turn_off: west_turn
        - delay: 1s
        - switch.turn_off: go_nuts
    turn_off_action:
    - switch.turn_off: north_straight
    - switch.turn_off: north_turn
    - switch.turn_off: east_straight
    - switch.turn_off: east_turn
    - switch.turn_off: south_straight
    - switch.turn_off: south_turn
    - switch.turn_off: west_straight
    - switch.turn_off: west_turn

When you run this, the relays work perfectly, but the “go_nuts” switch remains slid into the “ON” position.
Yet when you run this connected to the Internet ( wifi setup to local access point and IP address set and internet access ok ) the slider works perfectly.
Is there something I am missing or a bug with the slider js when you use local:true

Thanks if anyone has some insights - Martin