Dear All, I started to learn ESPHome recently, so the question might be quite noob`s, but It looks like I stuck here and need smb to guide the proper way.
I made a sensor to receive a feedback from my boiler on which current mode it is working on. It physically consist of 3xBPW 34 photodiode sensors (one per each LED of boiler), some resistances for the voltage dividers and wired to Wemos_d1_mini32. It is all attached to boiler and the signal from BPW34 photodiodes are coming and are available in logs. However due to some noise I would like to create additional text_sensor which supposed to check if the state of three diodes was the same for the last 20 secs (to be adjusted later) and return a value of the mode inside the text_sensor based on that. Design of the text sensors, relevant automations and lambda I took from the manuals available here https://esphome.io/. When I compile firmware and upload it there are no errors revealed, however log only provides states of “Boiler Eco”, “Boiler High” or “Boiler No heating”, but no states of text_sensor with id “boiler_operational_mode_20_sec”. I am using ESPHome addon within HA. Can smb advice what am I doing wrong?
The code is below:
esphome:
name: boiler-wemos-light-sensor
platform: ESP32
board: wemos_d1_mini32
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "mypwd"
ota:
password: "mypwd"
web_server:
port: XX
# Example configuration entry
sensor:
- platform: adc
pin: 39
id: "boiler_no_heating"
name: "Boiler No heating"
update_interval: 1s
raw: false
attenuation: auto
filters:
- max:
window_size: 10
send_every: 10
send_first_at: 10
- platform: adc
pin: 35
id: "boiler_eco"
name: "Boiler Eco"
update_interval: 1s
raw: false
attenuation: auto
filters:
- max:
window_size: 10
send_every: 10
send_first_at: 10
- platform: adc
pin: 33
id: "boiler_high"
name: "Boiler High"
update_interval: 1s
raw: false
attenuation: auto
filters:
- max:
window_size: 10
send_every: 10
send_first_at: 10
text_sensor:
- platform: template
name: "Boiler Operational mode 20 sec"
id: "boiler_operational_mode_20_sec"
- platform: template
name: "Boiler Operational mode"
id: "boiler_operational_mode"
update_interval: 10s
on_value:
then:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state <= 0.1)&&(id(boiler_eco).state >=0.1)&&(id(boiler_high).state <=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Eco");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state >= 0.1)&&(id(boiler_eco).state <=0.1)&&(id(boiler_high).state <=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Manual");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state <= 0.1)&&(id(boiler_eco).state <=0.1)&&(id(boiler_high).state >=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("High");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state >= 0.1)&&(id(boiler_eco).state >=0.1)&&(id(boiler_high).state <=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Unclear 12");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state <= 0.1)&&(id(boiler_eco).state >=0.1)&&(id(boiler_high).state >=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Unclear 23");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state >= 0.1)&&(id(boiler_eco).state <=0.1)&&(id(boiler_high).state >=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Unclear 13");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state >= 0.1)&&(id(boiler_eco).state >=0.1)&&(id(boiler_high).state >=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Unclear 123");
else:
if:
condition:
for:
time: 20sec
condition:
lambda: |-
return ((id(boiler_no_heating).state <= 0.1)&&(id(boiler_eco).state <=0.1)&&(id(boiler_high).state <=0.1));
then:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Switched_off");
else:
- lambda: |-
id(boiler_operational_mode_20_sec).publish_state("Not_defined");
Log info is as follows:
[13:55:42][D][sensor:125]: 'Boiler High': Sending state 0.07500 V with 2 decimals of accuracy
[13:55:42][D][sensor:125]: 'Boiler No heating': Sending state 0.07500 V with 2 decimals of accuracy
[13:55:52][D][sensor:125]: 'Boiler Eco': Sending state 0.07500 V with 2 decimals of accuracy