Closed Styx85 closed 5 years ago
Greetings,
I was able to get my Sonoff devices stable by installing and defining each versions and then update them version by version see update on issue.
If possible, use the method describe here and check if that improves / changes the stability for you devices.
And some pictures for the ones interested.
Greetings,
I was able to get my Sonoff devices stable by installing and defining each versions and then update them version by version see update on issue.
If possible, use the method describe here and check if that improves / changes the stability for you devices.
Thanks for the info @meijerwynand , I switched to bleeding edge for my sonoff clone and that one is running flawlessly so far but breakung OTA for my Wemos D1 mini.
BTW, have a look at my modified yaml. I took yours for inspiration and modified the "button" part.
What the heck do you have going on with the relay configured as a light!? I think what you want is to use a template switch to tie the button and LED together. Try this (change your board/ssid/broker):
esphomeyaml:
name: sonoff
platform: ESP8266
board: esp01_1m
arduino_version: 2.4.2
esphomelib_version: dev
wifi:
ssid: 'ssid'
password: 'password'
mqtt:
broker: 'broker'
discovery_prefix: homeassistant
username: ''
password: ''
logger:
level: DEBUG
debug:
ota:
sensor:
- platform: wifi_signal
name: "Sonoff WiFi Signal"
filters:
- sliding_window_moving_average:
window_size: 4
send_every: 4
switch:
- platform: gpio
id: switch0
pin:
number: 4
mode: OUTPUT
- platform: template
id: template0
icon: "mdi:power-plug"
name: "Sonoff Power"
restore_state: yes
turn_off_action:
- light.turn_off:
id: led0_light
- switch.turn_off:
id: switch0
turn_on_action:
- light.turn_on:
id: led0_light
- switch.turn_on:
id: switch0
lambda: "return id(switch0).state;"
binary_sensor:
- platform: gpio
id: button0
pin:
number: 12
mode: INPUT
on_press:
then:
- switch.toggle:
id: template0
status_led:
pin:
number: 13
mode: OUTPUT
inverted: true
output:
- platform: esp8266_pwm
id: led0_output
pin:
number: 15
mode: OUTPUT
inverted: true
light:
- platform: monochromatic
id: led0_light
output: led0_output
default_transition_length: 0.5s
@Styx85
I switched to bleeding edge for my sonoff clone and that one is running flawlessly so far but breakung OTA for my Wemos D1 mini.
I am running a Wemos D1 Mini Pro on v1.9.3 without any issue. However after copy/paste from other configs I noticed I flashed the Wemos possibly incorrect (but it's functional and stable for almost a week now). That includes a functional OTA.
The "invalid" but functional Wemos config - I have the board as nodemcuv2
esphomeyaml:
name: !secret 5ccf7f2c0f45
platform: ESP8266
board: nodemcuv2
esphomelib_version: 1.9.3
@brandond
What the heck do you have going on with the relay configured as a light!?
Thank you so much for the config you posted. I will surely be able to better my configs and make a more appropriate use of the template
options/features.
The initial reasoning for using the relay as a light
was:
light
component Your submission of configs as above really helps out, it is much appreciated.
What the heck do you have going on with the relay configured as a light!? I think what you want is to use a template switch to tie the button and LED together. Try this (change your board/ssid/broker):
Well I integrated these simple relays in my wall mounted lights and want them to behave as such. I personally don't think it matters if you configure the switch as light directly in the esp or in home assistant.
One thing I like to have is that the light just turns on if someone uses the regular wall mounted switch, therefore I integrate some boot command. That just works and with the given priority is independent from wireless and mqtt connection. So before it becomes smart its a simple light ;)
on_boot:
priority: 50
then:
- light.turn_on: esp_xxxl_relay
Here's what I ended up using for a Shelly 1, which is similar but lacks a LED. If you set up a switch and use icon: mdi:light
a switch and a binary light are essentially the same thing except for appearing in a different domain in HA.
esphomeyaml:
name: fixture00
platform: ESP8266
board: esp01_1m
arduino_version: 2.4.2
esphomelib_version: dev
board_flash_mode: dout
build_path: esp8266
on_boot:
if:
condition:
binary_sensor.is_on: switch0
then:
light.turn_on: relay0
else:
light.turn_off: relay0
wifi:
ssid: 'x'
password: 'x'
fast_connect: True
mqtt:
broker: '10.0.1.27'
logger:
level: DEBUG
debug:
ota:
sensor:
- platform: wifi_signal
name: "Fixture 00 WiFi Signal"
filters:
- sliding_window_moving_average:
window_size: 4
send_every: 4
output:
- platform: gpio
id: relay_output
pin:
number: 4
mode: OUTPUT
light:
- platform: binary
name: "Fixture 00 Light"
id: relay0
output: relay_output
binary_sensor:
- platform: gpio
id: switch0
pin:
number: 5
mode: INPUT
on_state:
then:
light.toggle: relay0
Closing because this doesn't seem to be an issue, just documentation on how to set up a device.
What new integration would you wish to have? I don't know if new integration is the right thing, but I'd like to report the experience. If I get some guidance I can also write a short manual for the module.
I recently bought a Sonoff Basic Smart Switch clone (Amazon). It differs from the original Sonoff that it is Tuya/Smart Life based. Also flashing the board is a bit different.
If possible, provide a link to an existing library for the integration: All things are set in esphomelib.
Please describe your use case for this integration and alternatives you've tried: I just bought this aforementioned clone. There are sone Problems you have to think about.
Additional context: There is a different PIN-out, like already reported elswhere for Sonoff clones (PowStro and SmartHome): Relay is GPIO4 Status LED is GPIO13 First LED (blue) is GPIO15 Button(hardware switch) is GPIO12
I used following template to get it up and running. The relay, button and the blue LED are working, the red one is dimmable but I couldn't find the trick so far to turn it off completely:
Than version 1.9.0 to 1.9.3 is not working, the clone becomes unresponsive. To be fair I only tested version 1.9.0 and 1.9.3 and no versions in between. Regarding the tip by @OttoWinter in Issue #340 bleeding edge/dev version with the mentioned wifi changes is running stable now for three hours, but is breaking OTA for my Wemos D1 mini PIR #353. Version 1.8.2 is working flawlessly, but the old OTA method is a pain.
Another thing I tested was the Sonoff basic instruction from the manual, but with that configuration OTA updates crashes reproducible. Maybe it is not that good an idea to have GPIO4 as INPUT_PULLUP (it really isn't in the aforementioned configuration of the switch). That maybe blocked the ESP or it turned into a bootloop. But I think with ne now correct pinout it should work (not tested).