substitutions: project_ver_let: "f" packages: kauf_plug_update: !include kauf-plug-update.yaml esphome: on_boot: then: - script.execute: script_factory_test script: - id: script_factory_test then: # little sequence so factory can confirm firwmare is working. - if: condition: lambda: 'return id(first_boot);' then: # get AP going ASAP - lambda: 'wifi_wificomponent->set_ap_timeout(1);' # disable button toggling relay - select.set: id: select_button option: "Don't Toggle" # turn on relay to draw current - switch.turn_on: relay - delay: 1s - light.turn_off: blue_led # wait until button is pressed, then turn on led - while: condition: binary_sensor.is_off: button_in then: - light.turn_off: blue_led - delay: 50ms - while: condition: binary_sensor.is_on: button_in then: - light.turn_on: blue_led - delay: 50ms # give it some time to see if a crash occurs with both AP and relay on - delay: 8s # test passed, clear first_boot variable so we don't run this again - globals.set: id: first_boot value: 'false' # re-enable button toggling relay - select.set: id: select_button option: "Toggle on Release" # delay time to save above changes - delay: 3s # blink blue led to indicate pass test until button is pressed then stay on - while: condition: binary_sensor.is_off: button_in then: - light.toggle: blue_led - delay: 100ms globals: - id: first_boot # used to run test routine at factory type: bool restore_value: yes initial_value: 'true'