ginkage / MHI-AC-Ctrl-ESPHome

ESPHome integration for MHI-AC-Ctrl project
MIT License
101 stars 35 forks source link

Update lambda to fix build #9

Closed OperKH closed 3 years ago

OperKH commented 3 years ago

Resolves erros during the build:

Compiling /data/mhi-cabinet/.pioenvs/mhi-cabinet/src/esphome/core/util.cpp.o
Compiling /data/mhi-cabinet/.pioenvs/mhi-cabinet/src/main.cpp.o
/config/esphome/mhi-cabinet.yaml: In lambda function:
/config/esphome/mhi-cabinet.yaml:54:27: error: 'mhi_ac_ctrl' was not declared in this scope
       return ((MhiAcCtrl*)mhi_ac_ctrl)->get_sensors();
                           ^
/config/esphome/mhi-cabinet.yaml: In lambda function:
/config/esphome/mhi-cabinet.yaml:62:27: error: 'mhi_ac_ctrl' was not declared in this scope
       return ((MhiAcCtrl*)mhi_ac_ctrl)->get_binary_sensors();
                           ^
Generating LD script /data/mhi-cabinet/.pioenvs/mhi-cabinet/ld/local.eagle.app.v6.common.ld
Compiling /data/mhi-cabinet/.pioenvs/mhi-cabinet/lib4d9/ESP8266WiFi/BearSSLHelpers.cpp.o
/config/esphome/mhi-cabinet.yaml: In lambda function:
/config/esphome/mhi-cabinet.yaml:55:3: warning: control reaches end of non-void function [-Wreturn-type]
     sensors:
   ^
/config/esphome/mhi-cabinet.yaml: In lambda function:
/config/esphome/mhi-cabinet.yaml:63:3: warning: control reaches end of non-void function [-Wreturn-type]
     binary_sensors:
   ^
*** [/data/mhi-cabinet/.pioenvs/mhi-cabinet/src/main.cpp.o] Error 1
========================= [FAILED] Took 80.65 seconds =========================
ginkage commented 3 years ago

This makes little sense: you create three different instances of MhiAcCtrl, whereas there should be only one.

ginkage commented 3 years ago

On a related note: what compile error you're getting, and on which ESPHome version? I'm asking this because I don't get any errors on the latest ESPHome 1.19.4, so I'm not quite sure what this fix is for.

OperKH commented 3 years ago

@ginkage I have this error on ESPHome 1.19.4

ginkage commented 3 years ago

Could you please give me the detailed output, the exact error, and if possible, your full .yaml file and the output main.cpp file? Please also note that for the original setup to work you need to either have the id in

    climates:
        id: mhi_ac_ctrl

defined exactly like that, or change the variable name in the other two lambdas accordingly.