So… I’m getting sick of how bad Tasmota 6.4.1.x is with disconnections and am having compilation failures with using 2.3.0 core as well so pretty sick of it all.
Looking at replacing with ESPHomeLib…
So I have some S22 switches (functionally identical to the S20’s) and I am using this YAML file here:
esphome:
name: s22_sonoff3_0898
platform: ESP8266
board: esp01_1m
wifi:
ssid: 'myssid'
password: 'mypass'
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "S22 Sonoff 3 Button"
on_press:
- switch.toggle: relay
- platform: status
name: "S22 Sonoff 3 Status"
switch:
- platform: gpio
name: "S22 Sonoff 3 Relay"
pin: GPIO12
id: relay
output:
- platform: esp8266_pwm
id: s20_green_led
pin: GPIO13
inverted: True
light:
- platform: monochromatic
name: "S22 Sonoff 3 Green LED"
output: s20_green_led
This then creates:
In the integrations.
With Tasmota, if I press the front button, the switch comes on (as it does with ESP) but the ‘green led’ would also come on with Tasmota but in ESP it stays off. With Tasmota, both LED’s come on when the switch is on. If the switch isn’t connected to the MQTT broker, the blue one (green led) will flash.
Can I set the switch to turn on/off both LED’s with ESPEasy when I toggle the switch?
Second Question… For a Sonoff SV, I want to have a momentary switch that will turn off after 2 seconds. Otto referred me to this code here:
# Example configuration entry
switch:
- platform: gpio
pin: 25
id: relay
- platform: template
name: "Gate Remote"
icon: "mdi:gate"
turn_on_action:
- switch.turn_on: relay
- delay: 500ms
- switch.turn_off: relay
I add that to the above as so:
esphome:
name: s22_sonoff3_0898
platform: ESP8266
board: esp01_1m
wifi:
ssid: 'ssid'
password: 'pass'
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "S22 Sonoff 3 Button"
on_press:
- switch.toggle: relay
- platform: status
name: "S22 Sonoff 3 Status"
switch:
- platform: gpio
name: "S22 Sonoff 3 Relay"
pin: GPIO12
id: relay
- platform: gpio
pin: 25
id: relay
- platform: template
name: "S22 Sonoff 3 Momentary"
icon: "mdi:flash"
turn_on_action:
- switch.turn_on: relay
- delay: 2000ms
- switch.turn_off: relay
output:
- platform: esp8266_pwm
id: s20_green_led
pin: GPIO13
inverted: True
light:
- platform: monochromatic
name: "S22 Sonoff 3 Green LED"
output: s20_green_led
When I try and upload, I get an error:
INFO Reading configuration…
Failed config
switch.gpio: [source /config/esphome/s22_sonoff3_0898.yaml:34]
platform: gpio
ESP8266: Invalid pin number: 25. Got '25'
pin: 25
id: relay
How do I fix this?