rsciriano / ESPHome-OpenTherm

Example of how to control an opentherm boiler with esphome
156 stars 43 forks source link

Trying to contribute... But compile issue #46

Closed Chuckame closed 1 year ago

Chuckame commented 1 year ago

Plop!

I recently bought the DIYLess opentherm master adapter. I'm also a developer, so for sure I want to contribute to opentherm+esphome integration, even with external component system to have a very clean config !

But after trying to copy/paste your config and classes, it's failing during compilation:

In file included from src/main.cpp:24:
src/opentherm_output.h:5:39: error: expected class-name before '{' token
    5 | class OpenthermOutput : public Component, public FloatOutput {
      |                                                  ^

It seems like the FloatOutput class coming from esphome itself was not found.

esphome version: v2022.12.3

I did my monkey to totally go to this "empty" config:

esphome:
  name: boiler
  includes:
    - esphome-opentherm/
esp8266:
  board: d1_mini
logger:
api:
  encryption:
    key: "..."
ota:
  password: "..."
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none

the C code:

#pragma once

#include "esphome.h"

class OpenthermBinarySensor : public BinarySensor {
};

And the same error (with or without using namespace esphome;):

In file included from src/main.cpp:26:
src/opentherm_binary.h:5:51: error: expected class-name before '{' token
    5 | class OpenthermBinarySensor : public BinarySensor {
      |                                                   ^

Any idea ?

Chuckame commented 1 year ago

After 2 days of research, the solution : if we want a classe using BinarySensor, we have to add in yaml at least binary_sensor: to indicate to esphome build system to import the binary sensor related classes....