Template switch causes non-booting devices
- Dominant language
- No language data
- Stars
- 313
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
### The problem
One of my devices does not boot (or is in bootloop) after uploading the following code:
Unfortunately I also could not get serial log working.
The problem is on the addition of line 121 and the interlock for this switch. The goal was to use this as a "block" to not lower the screen when the window is open. This switch was supposed to be enabled using home assistant.
### Which version of ESPHome has the issue?
2024.5.0
### What type of installation are you using?
Home Assistant Add-on
### Which version of Home Assistant has the issue?
_No response_
### What platform are you using?
ESP8266
### Board
Sonoff Dual-R3
### Component causing the issue
_No response_
### Example YAML snippet
```yaml
substitutions:
devicename: screen-keuken
long_devicename: Screen Keukenraam
esphome:
name: $devicename
platform: ESP32
board: esp32dev
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Screen-Keuken Fallback Hotspot"
password: "OHxPoT0UpDIp"
# Enable Home Assistant API
api:
encryption:
key: ""
ota:
safe_mode: True
password: "629eae8216e1e88bbc11476be3abb1a3"
web_server:
port: 80
logger:
baud_rate: 0
captive_portal:
# remove # below to enable ble tracking
#esp32_ble_tracker:
uart:
tx_pin: GPIO25
rx_pin: GPIO26
baud_rate: 4800
parity: NONE
stop_bits: 2
sensor:
- platform: wifi_signal
name: "$long_devicename WiFi Signal"
update_interval: 60s
- platform: bl0939
update_interval: 1s
# voltage:
# name: "$long_devicename Voltage"
current_1:
name: "$long_devicename Current Open"
id: open_current_sensor
internal: True
current_2:
name: "$long_devicename Current Close"
id: close_current_sensor
internal: True
active_power_1:
name: "$long_devicename Power Open"
active_power_2:
name: "$long_devicename Power Close"
# energy_1:
# name: '$long_devicename Energy Open'
# energy_2:
# name: '$long_devicename Energy Close'
energy_total:
name: '$long_devicename Energy Total'
cover:
- platform: current_based
device_class: shutter
id: shutter
name: "Screen Keuken"
open_sensor: open_current_sensor
open_moving_current_threshold: 0.35
open_obstacle_current_threshold: 0.8
open_duration: 32s
open_action:
- switch.turn_on: open_cover_switch
close_sensor: close_current_sensor
close_moving_current_threshold: 0.35
close_obstacle_current_threshold: 0.8
close_duration: 31s
close_action:
- switch.turn_on: close_cover_switch
stop_action:
- switch.turn_off: close_cover_switch
- switch.turn_off: open_cover_switch
obstacle_rollback: 30%
start_sensing_delay: 2s
malfunction_detection: true
malfunction_action:
then:
- logger.log: "Malfunction detected. Relay welded."
switch:
- platform: gpio
pin: GPIO27
name: "$long_devicename - Open"
id: open_cover_switch
restore_mode: RESTORE_DEFAULT_OFF
interlock: [close_cover_switch] #ensure only one relay active at a time
interlock_wait_time: 200ms
internal: True
- platform: gpio
pin: GPIO14
name: "$long_devicename - Close"
id: close_cover_switch
restore_mode: RESTORE_DEFAULT_OFF
interlock: [open_cover_switch, window_unsafe] #ensure only one relay active at a time
interlock_wait_time: 200ms
internal: True
- platform: template
id: window_unsafe
name: "Unsafe to close"
turn_on_action:
- switch.turn_on: window_unsafe
turn_off_action:
- switch.turn_on: window_unsafe
binary_sensor:
- platform: gpio
pin:
number: GPIO32
mode: INPUT_PULLUP
inverted: True
name: $long_devicename Open Button
on_press:
then:
cover.open: shutter
- platform: gpio
pin:
number: GPIO33
mode: INPUT_PULLUP
inverted: True
name: $long_devicename Close Button
on_press:
then:
cover.close: shutter
```
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided YAML, checking the template switch and the interlock references around the reported addition of line 121. Compare the declared ESP8266 platform and Sonoff Dual-R3 board with the ESP32 configuration, then reproduce the upload or boot failure with the same switch setup. Done means identifying a configuration that boots and preserves the intended window-safety interlock.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- yaml
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100