Around two weeks ago i installed Sonoff D1 dimmer in my room (Dimmer is running ESPHome). From there on light is turned on EVERY DAY exactly at 12:15:00. In past days i searceh literally everywhere: all logs: history, log, all possible files, automations, scripts… nowhere say that ANYTHING triggers the light, but it DOES go to 100%. Only automation i have is the one which turns on light in the morning, at 6:00. And history shows that this automation was indeed last triggerred at 6:00AM.
Where to look for more clues? What else could trigger light? Is there any “debug” mode in HA’s history log? History tab only says: “light.dimmer_xxx” turned on at 12:15:00. Nothing about WHO turned it on. I looked all my entittes, but nothing is changed/triggered at 12:15:00, only light.dimmer_xxx.
I tried to set logger component to “debug” in conf.yaml, but it seems that’s not it: it doesn’t record entity changes.
I do have an old android phone (samsung S8) beside my bed to control dimmer and monitor a few basic things. But i can’t see how a phone itself would trigger light on by itself? Or could it?
I’m lost… totally lost…
Can you disable the entity and see if it still happens? That would tell you whether HA is controlling it on or something else.
I guess that elimination process is the only thing remaining, yes. One thing i can start with is delete device from HA completely and let it work on it’s own without link to HA. So i will check ESPHome FW if it’s to blame (i doubt, though…).
Oh, and Sonoff’s RF receiver is NOT “the one”. I have cut receiver link with res of electronics, so it doesn’t work. I did read that RF part was to blaim for random power-ups. But this is far from random, it’s quite “planned” (only by who…?)
the “down side” of this try-and-error thing is that i’ll have to wait 24 hours for each try…
RF interference can be quite “planned”/regular, too Second-Hand Television SHINEs, Takes Down Entire Village’s Internet | Hackaday
Is there anything special about your ESPHome config?
Because of possoble interference i chose to remove RF receiver, since i don’t need it…
If i have anything special… well, it’s quite long program, because i put some “extra stuff” in (complete program in attachment). But nothing from this program is time-related…
In short, what program does:
i have two buttons:
- one just quickly turns light on (to 100%) or off
- second button:
- quick press meand turn on or off (slow).
- long press dimming: from 0 to 20%, or from 20 to 100% and back from 100to 20, or from 20 to 1%.
then i have also three buttons on my phone : to 1%, 20% and 100%. And off, sure.
I know, i made it complicated…
# Set variables such as the device's name and friendly name
# The devicename is used internally which the friendly name is shown in the user interface
substitutions:
devicename: pavle_dimmer
friendly_name: Pavle dimmer
comment: Pavle soba tri dim vrednosti
esphome:
name: $devicename
platform: ESP8266
board: esp01_1m
# Include our custom code
includes:
- d1_dimmer_no_rf.h
globals:
- id: dim_up
type: bool
initial_value: 'true'
- id: dim_1
type: bool
initial_value: 'false'
- id: dim_20
type: bool
initial_value: 'false'
- id: dim_100
type: bool
initial_value: 'false'
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# use_address: 192.168.0.95
manual_ip:
static_ip: 192.168.0.80
gateway: 192.168.0.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pavle dimmer Fallback Hotspot"
password: !secret ota_password
ap_timeout: 5min
captive_portal:
# Enable logging
logger:
baud_rate: 0
uart:
baud_rate: 9600
tx_pin: GPIO1
rx_pin: GPIO3
# ------------------------------------------------------------------------------ I2C definicija
i2c:
sda: GPIO0
scl: GPIO2
scan: True
id: bus_a
# Enable Home Assistant API
api:
password: !secret ota_password
ota:
password: !secret ota_password
# TODO: Set these as your own web server credentials
#web_server:
# port: 80
# Uses the onboard LED as status indicator
status_led:
pin:
number: GPIO13
inverted: True
# Report basic device information like it's Wi-Fi signal strength and uptime
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: 60s
- platform: uptime
name: ${friendly_name} Uptime
filters:
- lambda: return x / 60.0;
unit_of_measurement: minutes
#define BMP280 pressure/temperature sensor ------------------------------------- BMP280
- platform: bmp280
address: 0x76
update_interval: 30s
temperature:
name: "Temperatura Pavle spalnica"
id: temperatura_pavle_spalnica
accuracy_decimals: 1
oversampling: 8x
# filters:
# offset: -0.1
# pressure:
# name: "Absolutni tlak BMP"
# id: abs_tlak_bmp
# oversampling: 8x
# accuracy_decimals: 1
# #relativni tlak
# - platform: template
# name: "Relativni tlak BMP"
# icon: "mdi:gauge"
# lambda: |-
# const float STANDARD_ALTITUDE = 315; // in meters, see note
# return (id(abs_tlak_bmp).state)/powf((1-((float)(STANDARD_ALTITUDE))/44330), 5.255);
# update_interval: 60s
# unit_of_measurement: 'hPa'
# accuracy_decimals: 1
# ---------------------------------------------------------------------------- DIMM vrednost
# pošiljanje DIMM vrednosti v HA (1 do 100):
# - platform: template
# name: "Dimm vrednost"
# id: "dim_value"
# update_interval: 10s
# accuracy_decimals: 0
# lambda: |-
# return (int(id(main).remote_values.get_brightness() * 100));
# ali pa od 0 do 100:
# lambda: |-
# return (int(id(pavle_dimmer).remote_values.get_brightness() * 255));
text_sensor: # ----------------------------------------------------------------- TEXT SENSORs
- platform: wifi_info
ip_address:
name: IP ${friendly_name}
mac_address:
name: MAC ${friendly_name}
bssid:
name: BSSID ${friendly_name}
# RESTART ---------------------------------------------------------------------- Restart
switch:
- platform: restart
name: ${friendly_name} Restart
#tipka za 0% ----------------------------------------------------------------- 0%
- platform: template
name: "D1 0%"
internal: false
turn_on_action:
- light.turn_on:
id: pavle_dimmer
brightness: 0%
transition_length: 2s
- lambda: |-
id(dim_up) = (true);
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(0);
#tipka za 1% ----------------------------------------------------------------- 1%
- platform: template
name: "D1 1%"
internal: false
turn_on_action:
- light.turn_on:
id: pavle_dimmer
brightness: 1%
- lambda: |-
id(dim_up) = (true);
id(dim_1)=(1);
id(dim_20)=(0);
id(dim_100)=(0);
#tipka za 20% ---------------------------------------------------------------- 20%
- platform: template
name: "D1 20%"
internal: false
turn_on_action:
then:
#tale pogoj gledam zato, ker drugače iz OFF ne dima, ampak po 2s takoj skoči na 100%.
#če dam to vedno, pa če pritisnem iz 20%-->100% najprej skoči dol na 1% šele nato dima na 100...
- if:
condition:
light.is_off: pavle_dimmer
then:
- light.turn_on:
id: pavle_dimmer
brightness: 1%
transition_length: 0.1s
- delay: 0.2s
- light.turn_on:
id: pavle_dimmer
brightness: 20%
- lambda: |-
id(dim_up) = (true);
id(dim_1)=(0);
id(dim_20)=(1);
id(dim_100)=(0);
#tipka za 100% --------------------------------------------------------------- 100%
- platform: template
name: "D1 100%"
internal: false
turn_on_action:
then:
- if:
condition:
light.is_off: pavle_dimmer
then:
- light.turn_on:
id: pavle_dimmer
brightness: 1%
transition_length: 0.1s
- delay: 0.2s
- light.turn_on:
id: pavle_dimmer
brightness: 99%
transition_length: 2s
- lambda: |-
id(dim_up) = (false);
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(1);
binary_sensor:
#tipka na STENI ---------------------------------------------------------------- tipka STENA
- platform: gpio
id: tipka_stena
internal: true
pin:
number: GPIO4
mode: INPUT
inverted: false
filters:
- delayed_off: 500ms
on_press:
then:
if:
condition:
light.is_off: pavle_dimmer
then:
- light.turn_on:
id: pavle_dimmer
brightness: 100%
transition_length: 0.1s
- lambda: |-
id(dim_up) = (false);
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(1);
- delay: 500ms
else:
- light.turn_off:
id: pavle_dimmer
transition_length: 0.1s
- lambda: |-
id(dim_up) = (true);
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(0);
- delay: 500ms
#tipka pri postelji ----------------------------------------------------------- tipka POSTELJA
- platform: gpio
id: tipka_postelja
internal: true
pin:
number: GPIO5
mode: INPUT
inverted: false
on_multi_click:
#kratek pritisk tipke
- timing:
- ON for at most 0.5s
then:
if:
condition:
light.is_on: pavle_dimmer
then:
#če je luč vključena jo izklopim
- light.turn_off:
id: pavle_dimmer
# brightness: 0%
transition_length: 2s
- lambda: |-
id(dim_up) = (true);
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(0);
else:
# če je luč izključena jo vklopim na 100%
- light.turn_on:
id: pavle_dimmer
brightness: 1%
transition_length: 0.1s
- delay: 0.2s
- light.turn_on:
id: pavle_dimmer
brightness: 100%
transition_length: 2s
- logger.log: "VKLOP na FULL"
#označim, da je naslednja faza dim DOL
- lambda: |-
id(dim_up) = (false);
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(1);
#dolg pritisk tipke
- timing:
- ON for at least 0.5s
then:
#preverjam ali je luč vključena ali ne------------------------------ ČARANJE
if:
condition:
light.is_off: pavle_dimmer
then: #luč je izključena, jo dam na 1%
- light.turn_on:
id: pavle_dimmer
brightness: 1%
#- logger.log: "VKLOP na 1%"
- lambda: |-
id(dim_up) = (true);
id(dim_1)=(1);
id(dim_20)=(0);
id(dim_100)=(0);
else: #luč je že vključena, preverjam DIMM stanje
if:
condition: #če je na 1%
lambda: |-
ESP_LOGD("Stanje", "Bool1: %d", id(dim_1));
return id(dim_1);
then: #grem na 20%
- light.turn_on:
id: pavle_dimmer
brightness: 30%
- lambda: |-
id(dim_1)=(0);
id(dim_20)=(1);
id(dim_100)=(0);
else: #sicer preverjam, če je na 20%
if:
condition:
lambda: |-
ESP_LOGD("Stanje", "Bool20: %d", id(dim_20));
return id(dim_20);
then: #če je, grem na 100% ali pa na 1%, odvisno od smeri
if:
condition:
lambda: |-
ESP_LOGD("Stanje", "Boolean: %d", id(dim_up));
return id(dim_up);
then:
- light.turn_on:
id: pavle_dimmer
brightness: 100%
- lambda: |-
id(dim_1)=(0);
id(dim_20)=(0);
id(dim_100)=(1);
id(dim_up)=(false);
else:
- light.turn_on:
id: pavle_dimmer
brightness: 1%
- lambda: |-
id(dim_1)=(1);
id(dim_20)=(0);
id(dim_100)=(0);
id(dim_up)=(true);
else: #če pa je že na 100% grem nazaj na 20%
- light.turn_on:
id: pavle_dimmer
brightness: 20%
- lambda: |-
id(dim_1)=(0);
id(dim_20)=(1);
id(dim_100)=(0);
# Define our custom light component -------------------------------------------- DO TUKAJ
light:
- platform: custom
lambda: |-
auto dimmer_light = new Sonoff_D1_Dimmer();
App.register_component(dimmer_light);
return {dimmer_light};
lights:
- name: $friendly_name
default_transition_length: 0.1s
id: pavle_dimmer
restore_mode: RESTORE_DEFAULT_OFF
gamma_correct: 0
I thought ESPHome used that for Wi-Fi communication. 2.4GHz is especially noisy. especially from devices such as microwave ovens.
sonoff D1 dimmer has, beside wifi, also integrated RF 433MHz receiver, you can control it also with remote control. This part is notoriously “broken”. Wifi part should work fine.
I have a bunch of sonoff’s installed, all on 2,4GHz wifi and all work fine, excelt this one.
1 Like
Ok, right now i’d like to bury myself underground…
i found the culprit! It’s my… well… test HA installation…
I have another VM and test installation - so when i’m testing something new i do it there, so i don’t kill my “real” HA in case of serious failure. I usually always suspend my test HA when i’m done. Somehow i forgot to suspend it this time, after i moved dimmer from test to real HA two weeks ago…
I was doing some testing around alarm clock. And, sure, i left it on and working - at exactly 12:15 each day…
Thanks to all for your help and suggestions!!!