esphome-opentherm
esphome-opentherm copied to clipboard
configuring dhw_enable switch makes my esphome fail while compiling
Python 3.11.2 venv, esphome 2023.9.3, running on Debian 12.
When I change the switch block from this:
switch:
- platform: opentherm
ch_enable:
name: "Boiler Central Heating enabled"
mode: restore_default_on
into this:
switch:
- platform: opentherm
ch_enable:
name: "Boiler Central Heating enabled"
mode: restore_default_on
- platform: opentherm
dhw_enable:
name: "Domestic Hot Water enabled"
mode: restore_default_off
esphome run opentherm-thermostat.yml
fails, whereas before the change, it did not fail.
Compiling .pioenvs/cv-ketel-thermostaat/src/esphome/components/ota/ota_component.cpp.o
src/esphome/components/opentherm/hub.cpp: In member function 'unsigned int esphome::opentherm::OpenthermHub::build_request(OpenThermMessageID)':
src/esphome/core/defines.h:21:40: error: 'class esphome::opentherm::OpenthermHub' has no member named 'ch_enable_switch'; did you mean 'dhw_enable_switch'?
#define OPENTHERM_READ_ch_enable this->ch_enable_switch->state
^~~~~~~~~~~~~~~~
src/esphome/components/opentherm/hub.cpp:80:17: note: in expansion of macro 'OPENTHERM_READ_ch_enable'
OPENTHERM_READ_ch_enable
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/esphome/components/socket/headers.h:2,
from src/esphome/components/socket/socket.h:6,
from src/esphome/components/ota/ota_component.h:3,
from src/esphome/components/ota/ota_component.cpp:1:
src/esphome/core/defines.h:27: warning: "OPENTHERM_SWITCH_LIST" redefined
#define OPENTHERM_SWITCH_LIST(F, sep) F(dhw_enable_switch)
src/esphome/core/defines.h:26: note: this is the location of the previous definition
#define OPENTHERM_SWITCH_LIST(F, sep) F(ch_enable_switch)
src/esphome/core/defines.h:29: warning: "OPENTHERM_SWITCH_MESSAGE_HANDLERS" redefined
#define OPENTHERM_SWITCH_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) MESSAGE(Status) ENTITY(dhw_enable_switch, flag8_hb_1) postscript
src/esphome/core/defines.h:28: note: this is the location of the previous definition
#define OPENTHERM_SWITCH_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) MESSAGE(Status) ENTITY(ch_enable_switch, flag8_hb_0) postscript
*** [.pioenvs/cv-ketel-thermostaat/src/esphome/components/opentherm/hub.cpp.o] Error 1
========================================= [FAILED] Took 16.29 seconds =========================================
# A basic thremostat for a boiler with a single central heating circuit and
# domestic hot water. It reports the flame, CH and DHW status, similar to what
# you would expect to see on a thermostat and also reports the internal boiler
# temperatures and the current modulation level. The temperature is regulated
# through a PID Climate controller and the current room temperature is retrieved
# from a sensor in Home Asisstant.
# This configuration should meet most needs and is the recommended starting
# point if you just want a thermostat with an external temperature sensor.
esphome:
name: cv-ketel-thermostaat
external_components:
- source: github://arthurrump/esphome-opentherm@main
esp32:
board: nodemcu-32s
logger:
api:
ota:
wifi:
ssid: REDACTED
password: REDACTED
captive_portal:
opentherm:
ch_enable: true
dhw_enable: true
in_pin: 21
out_pin: 22
output:
- platform: opentherm
t_set:
id: t_set
min_value: 20
max_value: 65
zero_means_zero: true
dallas:
- pin: 18
sensor:
- platform: opentherm
rel_mod_level:
name: "Boiler Relative modulation level"
t_boiler:
name: "Boiler water temperature"
t_ret:
name: "Boiler Return water temperature"
- platform: dallas
address: 0x363c01f0956a1528
name: Temp living
id: templiving
filters:
- heartbeat: 1s
# - platform: homeassistant
# id: ch_room_temperature
# entity_id: sensor.temperature
# filters:
# # Push room temperature every second to update PID parameters
# - heartbeat: 1s
binary_sensor:
- platform: opentherm
ch_active:
name: "Boiler Central Heating active"
dhw_active:
name: "Boiler Domestic Hot Water active"
flame_on:
name: "Boiler Flame on"
fault_indication:
name: "Boiler Fault indication"
entity_category: diagnostic
diagnostic_indication:
name: "Boiler Diagnostic event"
entity_category: diagnostic
switch:
- platform: opentherm
ch_enable:
name: "Boiler Central Heating enabled"
mode: restore_default_on
- platform: opentherm
dhw_enable:
name: "Domestic Hot Water enabled"
mode: restore_default_off
climate:
- platform: pid
name: "Central heating"
heat_output: t_set
default_target_temperature: 20.5
sensor: templiving
control_parameters:
kp: 0.4
ki: 0.004
Just use it in this way
switch:
- platform: opentherm
ch_enable:
name: "Gas Heating"
mode: restore_default_on
icon: mdi:water-boiler
dhw_enable:
name: "Gas Hot Water"
mode: restore_default_off
icon: mdi:hand-water
- platform: template
name: "PID Autotune"
icon: mdi:tune-vertical-variant
turn_on_action:
- climate.pid.autotune:
id: pid_climate
noiseband: 0.1
Thanks for the quick reply. I can confirm your suggestion works
Can be closed :)