Closed whizzzkid closed 2 years ago
You need to provide more information (config/logs/etc), otherwise nobody can help you. That's why we have those fields in the issue form.
@jesserockz agreed however I don't have anything other than that. The same config (in the link) was working for more than a year and now it's not. Looks like there was a regression which is not reported in the logs and cannot be diagnosed as the logs display the normal behavior. However, it doesn't toggle the relay physically. The logs insists that the switch is on, but not really.
@jesserockz any updates on this?
@jesserockz , I have the exact same issue after updating the ESPHome addon to version 2021.12.3, also using EPS8266 platform. Here is the config file template that is used by all the affected devices. There are no errors in the device logs.
esphome:
name: ${id}
platform: ESP8266
board: esp01_1m
<<: !include ../wifi.yaml
logger:
api:
# password: !secret esphome_api_password
ota:
# password: !secret esphome_ota_password
status_led:
pin:
number: GPIO5 # Red LED
inverted: True
output:
- platform: gpio
id: led_1
pin:
number: GPIO4
inverted: True
light:
- platform: binary
id: white_led
output: led_1
restore_mode: RESTORE_DEFAULT_ON
internal: True
binary_sensor:
- platform: gpio
pin:
number: GPIO4
inverted: True
id: sensor
internal: True
- platform: gpio
pin:
number: GPIO13
inverted: True
id: button
name: ${id} Button
on_press:
- switch.toggle: ${id}
internal: True
switch:
- platform: gpio
id: relay
pin:
number: GPIO12
restore_mode: RESTORE_DEFAULT_OFF
internal: True
- platform: restart
name: ${project} REBOOT
- platform: template
name: ${project}
id: ${id}
icon: ${icon}
lambda: |-
if (id(sensor).state) {
return false;
} else {
return true;
}
turn_on_action:
- if:
condition:
- binary_sensor.is_on: sensor
then:
- switch.turn_on: relay
- light.turn_off: white_led
turn_off_action:
- if:
condition:
- binary_sensor.is_off: sensor
then:
- switch.turn_off: relay
- light.turn_on: white_led
One more piece of information, I rolled back to version 1.18.0 and everything works as expected. Is there any additional information that I can provide to get to the root cause?
One thing I just noticed is that you have GPIO15 (the relay) set up as both an output and a binary_sensor.
A pin cannot do both input and output at the same time and is bound to cause issues.
Move your on_state
code to on_turn_on
and on_turn_off
of the light and try again.
I see you got that from the esphome-devices template so it is not your fault, but it is just plain wrong and should not be done like that.
@jesserockz that was absolutely it:
# Basic Config
esphome:
name: switch-esp-hall-light-001
platform: ESP8266
board: esp01_1m
platformio_options:
upload_speed: 115200
wifi:
ssid: "[REDACTED]"
password: "[REDACTED]"
# Optional manual IP
manual_ip:
static_ip: [REDACTED]
gateway: [REDACTED]
subnet: [REDACTED]
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "[REDACTED]"
password: "[REDACTED]"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
output:
- platform: gpio
pin:
number: 15
id: plug_outlet
- platform: gpio
pin:
number: GPIO2
inverted: yes
id: blue_led
light:
- platform: binary
name: "Hall Light 001"
id: switch_esp_hall_light_001
output: plug_outlet
on_turn_on:
- output.turn_on: blue_led
on_turn_off:
- output.turn_off: blue_led
binary_sensor:
- platform: gpio
pin:
number: GPIO13
id: switch_esp_hall_light_001_button
on_press:
light.toggle: switch_esp_hall_light_001
status_led:
# Red LED
pin:
number: GPIO0
inverted: yes
This now works. I'll raise a PR to fix those examples.
The problem
I was using https://www.esphome-devices.com/devices/Aukey-SH-PA1-Smart-Plug/ configuration to run the switches, after the most recent update something seems to have messed up all of my switches. The relay doesn't turn on, neither does the
blue
led.Which version of ESPHome has the issue?
What type of installation are you using?
Docker
Which version of Home Assistant has the issue?
No response
What platform are you using?
ESP8266
Board
No response
Component causing the issue
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
The logs insist everything is working, the actual relay doesn't switch on, Nor does the blue LED.