khenderick / esphome-opentherm

OpenTherm support for ESPHome
MIT License
14 stars 4 forks source link

Error compiling esp8266 #1

Closed 5A52 closed 1 year ago

5A52 commented 1 year ago

With an example config:

esphome:
  name: climatest
  friendly_name: climatest

esp8266:
  board: d1_mini

logger:
api:
ota:
wifi:
  ssid: !secret ssid
  password: !secret PWD

external_components:
  source: github://khenderick/esphome-opentherm
  components: [opentherm]

opentherm:
  read_pin: 4
  write_pin: 5
**The rest is from Example entry for config.yaml:**

I have this compilation error:

INFO ESPHome 2023.5.5
INFO Reading configuration /config/climatest.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing climatest (board: d1_mini; framework: arduino; platform: platformio/espressif8266@3.2.0)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- ESPAsyncTCP-esphome @ 1.2.3
|   |-- Hash @ 1.0
|   |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
|   |-- libsodium @ 1.10018.1
Compiling .pioenvs/climatest/src/esphome/components/opentherm/number/custom_number.cpp.o
Compiling .pioenvs/climatest/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling .pioenvs/climatest/src/esphome/components/ota/ota_backend_arduino_rp2040.cpp.o
Compiling .pioenvs/climatest/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling .pioenvs/climatest/src/esphome/components/ota/ota_component.cpp.o
Compiling .pioenvs/climatest/src/esphome/components/sensor/automation.cpp.o
In file included from src/esphome/components/opentherm/number/custom_number.cpp:1:
src/esphome/components/opentherm/number/custom_number.cpp: In member function 'void esphome::opentherm::CustomNumber::dump_custom_config(const char*, const char*)':
src/esphome/components/opentherm/number/custom_number.cpp:31:22: error: initializer fails to determine size of '__pstr__'
   31 |   LOG_NUMBER(prefix, type, this);
src/esphome/core/log.h:94:90: note: in definition of macro 'esph_log_config'
   94 |   esp_log_printf_(ESPHOME_LOG_LEVEL_CONFIG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
      |                                                                                          ^~~~~~~~~~~
src/esphome/components/number/number.h:14:5: note: in expansion of macro 'ESP_LOGCONFIG'
   14 |     ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
      |     ^~~~~~~~~~~~~
src/esphome/core/log.h:185:28: note: in expansion of macro 'LOG_STR_ARG'
  185 | #define LOG_STR_LITERAL(s) LOG_STR_ARG(LOG_STR(s))
      |                            ^~~~~~~~~~~
src/esphome/core/log.h:185:40: note: in expansion of macro 'LOG_STR'
  185 | #define LOG_STR_LITERAL(s) LOG_STR_ARG(LOG_STR(s))
      |                                        ^~~~~~~
src/esphome/components/number/number.h:14:45: note: in expansion of macro 'LOG_STR_LITERAL'
   14 |     ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
      |                                             ^~~~~~~~~~~~~~~
src/esphome/components/opentherm/number/custom_number.cpp:31:3: note: in expansion of macro 'LOG_NUMBER'
   31 |   LOG_NUMBER(prefix, type, this);
      |   ^~~~~~~~~~
src/esphome/components/opentherm/number/custom_number.cpp:31:22: error: array must be initialized with a brace-enclosed initializer
   31 |   LOG_NUMBER(prefix, type, this);
src/esphome/core/log.h:94:90: note: in definition of macro 'esph_log_config'
   94 |   esp_log_printf_(ESPHOME_LOG_LEVEL_CONFIG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
      |                                                                                          ^~~~~~~~~~~
src/esphome/components/number/number.h:14:5: note: in expansion of macro 'ESP_LOGCONFIG'
   14 |     ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
      |     ^~~~~~~~~~~~~
src/esphome/core/log.h:185:28: note: in expansion of macro 'LOG_STR_ARG'
  185 | #define LOG_STR_LITERAL(s) LOG_STR_ARG(LOG_STR(s))
      |                            ^~~~~~~~~~~
src/esphome/core/log.h:185:40: note: in expansion of macro 'LOG_STR'
  185 | #define LOG_STR_LITERAL(s) LOG_STR_ARG(LOG_STR(s))
      |                                        ^~~~~~~
src/esphome/components/number/number.h:14:45: note: in expansion of macro 'LOG_STR_LITERAL'
   14 |     ESP_LOGCONFIG(TAG, "%s%s '%s'", prefix, LOG_STR_LITERAL(type), (obj)->get_name().c_str()); \
      |                                             ^~~~~~~~~~~~~~~
src/esphome/components/opentherm/number/custom_number.cpp:31:3: note: in expansion of macro 'LOG_NUMBER'
   31 |   LOG_NUMBER(prefix, type, this);
      |   ^~~~~~~~~~
*** [.pioenvs/climatest/src/esphome/components/opentherm/number/custom_number.cpp.o] Error 1
========================== [FAILED] Took 3.52 seconds ==========================

Hovewer esp32 compiles OK.

khenderick commented 1 year ago

Interesting.

With the provided config, it seems like I have a different compilation error and a slightly different dependency graph. Looking into it.

However, I've made a branch with at least a fix for the compilation error I'm seeing. You can test this by using this updates external_components part;

external_components:
  source: github://khenderick/esphome-opentherm@8266-fix
  components: [opentherm]

Can you give it a try and let me know what compilation errors you (still) see? If it compiles, are you able to validate its functionality?

khenderick commented 1 year ago

Oops, I missed

**The rest is from Example entry for config.yaml:**

I now have the same compilation error. Let's see.

khenderick commented 1 year ago

Alright, I just pushed a fix on the branch mentioned above which fixes the issue on my laptop. Let me know if everything works for you, then I can merge it in.

5A52 commented 1 year ago

Compiles and works as designed, Thanks! . Is there an easy way to add other enities (for example I have MSG_DHW_FLOW_RATE in my boiler)? Also looks like CH\DHW\MIN\MAX-temperatures are read only during boot. Or may be it is better to open new issues?

khenderick commented 1 year ago

Yes, please open separate issues for each of the things you'd like to add or change. It will make it easier to implement them step by step.

khenderick commented 1 year ago

I've merged the PR, so you can remove the branch from the external component:

external_components:
  source: github://khenderick/esphome-opentherm
  components: [opentherm]

Make sure to verify whether it's updating the repo, otherwise you can add

  refresh: 0s

To the external_components.