Dear All,
I am trying to make my heating controller with esphome and home assistant.
I wanted to connect all my temperature sensors, PID loops, current sensors, I need also one bluetooth thermometer.
After setting it up I esp32 is not starting. As far I understand because of loop watchdog., That means I probably have to much put in configuration.
I do not want to split things up.
So what is Your biggest setup? I am wondering, am I asking too much from esp32?
Is there way to optimize, prioritize things to get it working. I think it tries to do everything in one time and that is why watchdog is activated.
Any other thoughts. Thanks!
My yaml
name: mcp2317-test
platform: ESP32
board: esp32dev
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "a20bf731afed106f05b67477ea4264ea"
wifi:
ssid: !secret ssid
password: !secret password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Mcp2317-Test Fallback Hotspot"
password: "d6PmNvsnozYk"
# Enable Bluetooth scanning for this ESP32
esp32_ble_tracker:
substitutions:
katla_valve_time: "9000"
apkures_valve_time: "9000"
gridas_valve_time: "9000"
captive_portal:
# Binārie sensori
binary_sensor:
- platform: status
name: "ESP32 statuss"
- platform: template
name: "Boilera vārsts"
id: boiler_valve_state
device_class: opening
- platform: template
name: "Grīdas sūknis"
id: floor_pump_state
- platform: template
name: "Katla sūknis"
id: katla_pump_state
- platform: template
name: "Apkures sūknis"
id: apkures_pump_state
# Katla vārsta PID
climate:
# Boileris
- platform: bang_bang
name: "Boilera sildītājs"
sensor: temp_boiler
visual:
min_temperature: 10 °C
max_temperature: 95 °C
temperature_step: 0.1 °C
default_target_temperature_low: 45 °C
default_target_temperature_high: 50 °C
heat_action:
- switch.turn_on: boiler_heater
idle_action:
- switch.turn_off: boiler_heater
# Boilera vārsts atvērt/aizvērt, ja krāsns kurās
- platform: bang_bang
name: "Boilera vārsts"
sensor: temp_katla
visual:
min_temperature: 10 °C
max_temperature: 95 °C
temperature_step: 0.1 °C
default_target_temperature_low: 45 °C
default_target_temperature_high: 60 °C
heat_action:
then:
- switch.turn_on: close_boiler_valve
- delay: 10s
- switch.turn_off: close_boiler_valve
- binary_sensor.template.publish:
id: boiler_valve_state
state: OFF
idle_action:
- globals.set:
id: dummy
value: "true"
cool_action:
then:
- switch.turn_on: open_boiler_valve
- delay: 10s
- switch.turn_off: open_boiler_valve
- binary_sensor.template.publish:
id: boiler_valve_state
state: ON
# Ieslēgt grīdas sūkni
- platform: bang_bang
name: "Grīdas sūknis"
sensor: temp_katla
visual:
min_temperature: 10 °C
max_temperature: 95 °C
temperature_step: 0.1 °C
default_target_temperature_low: 45 °C
default_target_temperature_high: 60 °C
heat_action:
then:
- switch.turn_off: floor_pump_relay
- binary_sensor.template.publish:
id: floor_pump_state
state: OFF
# - climate.control:
# id: pid_gridas_varstam
# mode: "OFF"
idle_action:
- globals.set:
id: dummy
value: "true"
cool_action:
then:
- switch.turn_on: floor_pump_relay
- binary_sensor.template.publish:
id: floor_pump_state
state: ON
# - climate.control:
# id: pid_gridas_varstam
# mode: "HEAT_COOL"
# Ieslēgt katla sūkni
- platform: bang_bang
name: "Katla sūknis"
sensor: temp_katla
visual:
min_temperature: 10 °C
max_temperature: 95 °C
temperature_step: 0.1 °C
default_target_temperature_low: 45 °C
default_target_temperature_high: 60 °C
heat_action:
then:
- switch.turn_off: katla_pump_relay
- binary_sensor.template.publish:
id: katla_pump_state
state: OFF
- climate.control:
id: pid_katla_varstam
mode: "OFF"
idle_action:
- globals.set:
id: dummy
value: "true"
cool_action:
then:
- switch.turn_on: katla_pump_relay
- binary_sensor.template.publish:
id: katla_pump_state
state: ON
- climate.control:
id: pid_katla_varstam
mode: "HEAT_COOL"
# Ieslēgt apkures sūkni
- platform: bang_bang
name: "Apkures sūknis"
sensor: temp_liela_loka
visual:
min_temperature: 10 °C
max_temperature: 95 °C
temperature_step: 0.1 °C
default_target_temperature_low: 45 °C
default_target_temperature_high: 60 °C
heat_action:
then:
- switch.turn_off: apkures_pump_relay
- binary_sensor.template.publish:
id: apkures_pump_state
state: OFF
idle_action:
- globals.set:
id: dummy
value: "true"
cool_action:
then:
- switch.turn_on: apkures_pump_relay
- binary_sensor.template.publish:
id: apkures_pump_state
state: ON
# Katla vārsta PID
- platform: pid
id: pid_katla_varstam
visual:
min_temperature: 0 °C
max_temperature: 125 °F
temperature_step: 0.5 °C
name: "PID katla vārstam"
sensor: temp_katla
default_target_temperature: 60°C
heat_output: katla_valve_inc
cool_output: katla_valve_dec
control_parameters:
kp: 0.04
ki: 0.000001
kd: 0
min_integral: 0
max_integral: 0.9
# Apkures vārsta PID
- platform: pid
id: pid_apkures_varstam
name: "PID apkures vārstam"
sensor: temp_liela_loka
default_target_temperature: 60°C
heat_output: apkures_valve_inc
cool_output: apkures_valve_dec
control_parameters:
kp: 0.04
ki: 0.000001
kd: 0
min_integral: 0
max_integral: 0.9
# Grīdas vārsta PID
- platform: pid
id: pid_gridas_varstam
visual:
min_temperature: 10 °C
max_temperature: 50 °C
temperature_step: 0.1 °C
name: "PID grīdas vārstam"
sensor: temp_grida_turpgaita
default_target_temperature: 30°C
heat_output: gridas_valve_inc
cool_output: gridas_valve_dec
control_parameters:
kp: 0.04
ki: 0.000001
kd: 0
min_integral: 0
max_integral: 0.9
i2c:
sda: 21
scl: 22
# Time
time:
- platform: homeassistant
id: esptime
timezone: Europe/Riga
# Example configuration entry
dallas:
- pin: 16
update_interval: 60s
ads1115:
- address: 0x48
text_sensor:
- platform: template
name: Darba laiks cilvēkiem
id: uptime_human
icon: mdi:clock-start
sensor:
- platform: uptime
name: Uptime Sensor
id: uptime_sensor
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
- platform: atc_mithermometer
mac_address: "A4:C1:38:74:88:B5"
temperature:
name: "Piebūves temperatūra"
humidity:
name: "Piebūves mitrums"
battery_level:
name: "Piebūves devēja batereja"
battery_voltage:
name: "Piebūves devēja baterejas spriegums"
- platform: dallas
address: 0xBF00000297EAA628
name: "Boilera temperatūra"
id: temp_boiler
- platform: dallas
address: 0x993C01E07679B828
name: "Katla temperatūra"
id: temp_katla
# - platform: dallas
# address: 0xBF000002
# name: "Mazā apkures loka temperatūra"
# id: temp_maza_loka
- platform: dallas
address: 0x1A3C01E0766E4C28
name: "Lielā apkures loka temperatūra"
id: temp_liela_loka
# - platform: dallas
# address: 0xBF000003
# name: "Apkures atpakaļgaitas temperatūra"
# id: temp_atpakalgaita
# - platform: dallas
# address: 0xBF000004
# name: "Akumulatora temperatūra"
# id: temp_akumulatora
# - platform: dallas
# address: 0xBF000005
# name: "Akumulatora izejas temperatūra"
# id: temp_akumulatora_izeja
- platform: dallas
address: 0x7E3C01E07681A728
name: "Piebūves grīdas turpgaita"
id: temp_grida_turpgaita
# - platform: dallas
# address: 0xBF000007
# name: "Piebūves atpakaļgaita"
# id: temp_grida_atpakalgaita
- platform: pid
name: "Katla PID izeja1"
type: RESULT
climate_id: pid_katla_varstam
# - platform: pid
# name: "Katla PID integrālā izeja1"
# type: INTEGRAL
# climate_id: pid_katla_varstam
# - platform: pid
# name: "Katla PID diferencējošā izeja1"
# type: DERIVATIVE
# climate_id: pid_katla_varstam
# - platform: pid
# name: "Katla PID proporcionālā izeja1"
# type: PROPORTIONAL
# climate_id: pid_katla_varstam
- platform: pid
climate_id: pid_katla_varstam
name: "Katla PID kp1"
id: katla_kp
type: KP
- platform: pid
climate_id: pid_katla_varstam
name: "Katla PID ki1"
id: katla_ki
type: KI
- platform: pid
climate_id: pid_katla_varstam
name: "Katla PID kd1"
id: katla_kd
type: KD
# - platform: pid
# climate_id: pid_katla_varstam
# name: "Katla PID izeja heat1"
# type: HEAT
# - platform: pid
# climate_id: pid_katla_varstam
# name: "Katla PID izeja cool1"
# type: COOL
### Apkures vārstam ###
- platform: pid
name: "Apkures PID izeja"
type: RESULT
climate_id: pid_apkures_varstam
# - platform: pid
# name: "Apkures PID integrālā izeja"
# type: INTEGRAL
# climate_id: pid_apkures_varstam
# - platform: pid
# name: "Apkures PID diferencējošā izeja"
# type: DERIVATIVE
# climate_id: pid_apkures_varstam
# - platform: pid
# name: "Apkures PID proporcionālā izeja"
# type: PROPORTIONAL
# climate_id: pid_apkures_varstam
- platform: pid
climate_id: pid_apkures_varstam
name: "Apkures PID kp"
id: apkures_kp
type: KP
- platform: pid
climate_id: pid_apkures_varstam
name: "Apkures PID ki"
id: apkures_ki
type: KI
- platform: pid
climate_id: pid_apkures_varstam
name: "Apkures PID kd"
id: apkures_kd
type: KD
# - platform: pid
# climate_id: pid_apkures_varstam
# name: "Apkures PID izeja heat"
# type: HEAT
# - platform: pid
# climate_id: pid_apkures_varstam
# name: "Apkures PID izeja cool"
# type: COOL
### Grīdas vārstam ###
- platform: pid
name: "Grīdas PID izeja"
type: RESULT
climate_id: pid_gridas_varstam
# accuracy_decimals: 4
- platform: pid
name: "Grīdas PID kļūda"
type: ERROR
climate_id: pid_gridas_varstam
# accuracy_decimals: 4
- platform: pid
name: "Grīdas integrālā izeja"
type: INTEGRAL
climate_id: pid_gridas_varstam
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
name: "Grīdas PID diferencējošā izeja"
type: DERIVATIVE
climate_id: pid_gridas_varstam
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
name: "Grīdas PID proporcionālā izeja"
type: PROPORTIONAL
climate_id: pid_gridas_varstam
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
climate_id: pid_gridas_varstam
name: "Grīdas PID kp"
id: gridas_kp
type: KP
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
climate_id: pid_gridas_varstam
name: "Grīdas PID ki"
id: gridas_ki
type: KI
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
climate_id: pid_gridas_varstam
name: "Grīdas PID kd"
id: gridas_kd
type: KD
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
climate_id: pid_gridas_varstam
name: "Grīdas PID izeja heat"
type: HEAT
icon: "mdi:water-percent"
# accuracy_decimals: 4
- platform: pid
climate_id: pid_gridas_varstam
name: "Grīdas pid izeja cool"
type: COOL
icon: "mdi:water-percent"
# accuracy_decimals: 4
# ADC
- platform: ads1115
multiplexer: 'A0_GND'
gain: 2.048
name: "ADS1115 A0-GND"
id: ADS1115_A0GND
- platform: ads1115
multiplexer: 'A1_GND'
gain: 2.048
name: "ADS1115 A1-GND"
id: ADS1115_A1GND
- platform: ads1115
multiplexer: 'A2_GND'
gain: 2.048
name: "ADS1115 A2-GND"
id: ADS1115_A2GND
- platform: ads1115
multiplexer: 'A3_GND'
gain: 2.048
name: "ADS1115 A3-GND"
id: ADS1115_A3GND
# Strāvas moduļi
- platform: ct_clamp
sensor: ADS1115_A0GND
name: "Katla sūkņa strāva"
update_interval: 60s
- platform: ct_clamp
sensor: ADS1115_A1GND
name: "Apkures sūkņa strāva"
update_interval: 60s
- platform: ct_clamp
sensor: ADS1115_A2GND
name: "Grīdas sūkņa strāva"
update_interval: 60s
- platform: ct_clamp
sensor: ADS1115_A3GND
name: "Boilera sildītāja strāva"
update_interval: 60s
# Katla PID home assistant sensori
- platform: homeassistant
name: "PID kp ha"
entity_id: input_number.pid_kp_ha
id: pid_kp_ha
- platform: homeassistant
name: "PID ki ha"
entity_id: input_number.pid_ki_ha
id: pid_ki_ha
- platform: homeassistant
name: "PID kd ha"
entity_id: input_number.pid_kd_ha
id: pid_kd_ha
# Example configuration entry
mcp23017:
- id: 'mcp23017_hub'
address: 0x20
# Individual outputs
switch:
- platform: gpio
name: "MCP23017 Pin #0"
id: katla_valve_inc_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 0
number: 0
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #1"
id: katla_valve_dec_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 1
number: 1
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #2"
id: out3
pin:
mcp23xxx: mcp23017_hub
# Use pin number 2
number: 2
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #3"
id: boiler_heater
pin:
mcp23xxx: mcp23017_hub
# Use pin number 3
number: 3
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #4"
id: open_boiler_valve
pin:
mcp23xxx: mcp23017_hub
# Use pin number 4
number: 4
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #5"
id: close_boiler_valve
pin:
mcp23xxx: mcp23017_hub
# Use pin number 5
number: 5
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #6"
id: floor_pump_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 6
number: 6
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #7"
id: katla_pump_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 7
number: 7
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #8"
id: apkures_pump_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 8
number: 8
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #9"
id: apkures_valve_inc_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 9
number: 9
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #10"
id: apkures_valve_dec_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 10
number: 10
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #11"
id: gridas_valve_inc_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 11
number: 11
mode:
output: true
inverted: true
- platform: gpio
name: "MCP23017 Pin #12"
id: gridas_valve_dec_relay
pin:
mcp23xxx: mcp23017_hub
# Use pin number 12
number: 12
mode:
output: true
inverted: true
# Katla PID slēdži
- platform: template
name: "Katla PID Autotune"
turn_on_action:
- climate.pid.autotune: pid_katla_varstam
- platform: template
name: "Iestatīt katla PID parametrus"
turn_on_action:
- climate.pid.set_control_parameters:
id: pid_katla_varstam
kp: !lambda
return id(pid_kp_ha).state;
ki: !lambda
return id(pid_ki_ha).state;
kd: !lambda
return id(pid_kd_ha).state;
- platform: template
name: "Nolasīt katla PID parametrus"
turn_on_action:
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_kp_ha
value: !lambda return id(katla_kp).state;
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_ki_ha
value: !lambda return id(katla_ki).state;
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_kd_ha
value: !lambda return id(katla_kd).state;
- platform: template
name: "Nullēt katla PID integrāli"
turn_on_action:
- climate.pid.reset_integral_term: pid_katla_varstam
# Apkures PID slēdži
- platform: template
name: "Apkures PID Autotune"
turn_on_action:
- climate.pid.autotune: pid_apkures_varstam
- platform: template
name: "Iestatīt apkures PID parametrus"
turn_on_action:
- climate.pid.set_control_parameters:
id: pid_apkures_varstam
kp: !lambda
return id(pid_kp_ha).state;
ki: !lambda
return id(pid_ki_ha).state;
kd: !lambda
return id(pid_kd_ha).state;
- platform: template
name: "Nolasīt apkures PID parametrus"
turn_on_action:
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_kp_ha
value: !lambda return id(apkures_kp).state;
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_ki_ha
value: !lambda return id(apkures_ki).state;
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_kd_ha
value: !lambda return id(apkures_kd).state;
- platform: template
name: "Nullēt apkures PID integrāli"
turn_on_action:
- climate.pid.reset_integral_term: pid_apkures_varstam
# Grīdas PID slēdži
- platform: template
name: "Gridas PID Autotune"
turn_on_action:
- climate.pid.autotune: pid_gridas_varstam
- platform: template
name: "Iestatīt grīdas PID parametrus"
turn_on_action:
- climate.pid.set_control_parameters:
id: pid_gridas_varstam
kp: !lambda
return id(pid_kp_ha).state;
ki: !lambda
return id(pid_ki_ha).state;
kd: !lambda
return id(pid_kd_ha).state;
- platform: template
name: "Nolasīt grīdas PID parametrus"
turn_on_action:
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_kp_ha
value: !lambda return id(gridas_kp).state;
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_ki_ha
value: !lambda return id(gridas_ki).state;
- homeassistant.service:
service: input_number.set_value
data:
entity_id: input_number.pid_kd_ha
value: !lambda return id(gridas_kd).state;
- platform: template
name: "Nullēt grīdas PID integrāli"
turn_on_action:
- climate.pid.reset_integral_term: pid_gridas_varstam
- platform: template
name: "Izmantot akumulatoru"
id: use_acumulator_switch
turn_on_action:
- lambda: !lambda |-
id(use_acumulator_switch).publish_state(true);
turn_off_action:
- lambda: !lambda |-
id(use_acumulator_switch).publish_state(false);
- platform: template
name: "Manuāli ieslēgt releju"
id: manual_on
turn_on_action:
- switch.turn_on: out3
- lambda: !lambda |-
id(manual_on).publish_state(true);
turn_off_action:
- switch.turn_off: out3
- lambda: !lambda |-
id(manual_on).publish_state(false);
### Global Vars for OLED Menu State Retention ###
globals:
- id: current_page
type: int
initial_value: "1"
- id: dummy
type: bool
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
lambda: |-
if(id(current_page) == 1){
it.strftime("%H:%M %d.%m.%Y", id(esptime).now());
it.printf(0, 1, "Boileris %.1f C", id(temp_boiler).state);
}
output:
- platform: template
id: katla_valve_inc
type: float
write_action:
- if:
condition:
lambda: 'return (state > 0.001);'
then:
- switch.turn_on: katla_valve_inc_relay
- delay: !lambda |-
return (${katla_valve_time} * state);
- switch.turn_off: katla_valve_inc_relay
- platform: template
id: katla_valve_dec
type: float
write_action:
then:
- if:
condition:
lambda: 'return (state > 0.001);'
then:
- switch.turn_on: katla_valve_dec_relay
- delay: !lambda "return (${katla_valve_time} * state);"
- switch.turn_off: katla_valve_dec_relay
- platform: template
id: apkures_valve_inc
type: float
write_action:
- if:
condition:
lambda: 'return (state > 0.001);'
then:
- switch.turn_on: apkures_valve_inc_relay
- delay: !lambda |-
return (${apkures_valve_time} * state);
- switch.turn_off: apkures_valve_inc_relay
- platform: template
id: apkures_valve_dec
type: float
write_action:
then:
- if:
condition:
lambda: 'return (state > 0.001);'
then:
- switch.turn_on: apkures_valve_dec_relay
- delay: !lambda "return (${apkures_valve_time} * state);"
- switch.turn_off: apkures_valve_dec_relay
- platform: template
id: gridas_valve_inc
type: float
write_action:
- if:
condition:
lambda: 'return (state > 0.001);'
then:
- switch.turn_on: gridas_valve_inc_relay
- delay: !lambda |-
return (${gridas_valve_time} * state);
- switch.turn_off: gridas_valve_inc_relay
- platform: template
id: gridas_valve_dec
type: float
write_action:
then:
- if:
condition:
lambda: 'return (state > 0.001);'
then:
- switch.turn_on: gridas_valve_dec_relay
- delay: !lambda "return (${gridas_valve_time} * state);"
- switch.turn_off: gridas_valve_dec_relay