GithubHelp home page GithubHelp logo

Multiple units about mhi-ac-ctrl-esphome HOT 7 CLOSED

ginkage avatar ginkage commented on August 22, 2024
Multiple units

from mhi-ac-ctrl-esphome.

Comments (7)

ginkage avatar ginkage commented on August 22, 2024

Hi!
Could you please elaborate on the compilation failure, what error do you get?

from mhi-ac-ctrl-esphome.

ogizhelev avatar ogizhelev commented on August 22, 2024

Sure - so in the yaml config if i change the id like :
climate:

  • platform: custom
    lambda: |-
    auto mhi_ac_ctrl = new MhiAcCtrl();
    App.register_component(mhi_ac_ctrl);
    return {mhi_ac_ctrl};
    climates:
    - name: "bedroomac"
    id: bedroomac

when compiling is trowing those errors :
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- 1.2.3
|-- 2.1.0
| |-- 1.2.3
| |-- 1.0
| |-- 1.0
|-- 1.1.1
|-- 1.0
|-- 5.13.3
|-- 1.2
Compiling /data/mhi-ac-ctrl-bedroom/.pioenvs/mhi-ac-ctrl-bedroom/src/main.cpp.o
/config/esphome/mhi-ac-ctrl-bedroom.yaml: In lambda function:
/config/esphome/mhi-ac-ctrl-bedroom.yaml:83:27: error: 'mhi_ac_ctrl' was not declared in this scope
return ((MhiAcCtrl*)mhi_ac_ctrl)->get_sensors();
^
/config/esphome/mhi-ac-ctrl-bedroom.yaml: In lambda function:
/config/esphome/mhi-ac-ctrl-bedroom.yaml:101:27: error: 'mhi_ac_ctrl' was not declared in this scope
return ((MhiAcCtrl*)mhi_ac_ctrl)->get_binary_sensors();
^
/config/esphome/mhi-ac-ctrl-bedroom.yaml: In lambda function:
/config/esphome/mhi-ac-ctrl-bedroom.yaml:84:3: warning: control reaches end of non-void function [-Wreturn-type]
sensors:
^
/config/esphome/mhi-ac-ctrl-bedroom.yaml: In lambda function:
/config/esphome/mhi-ac-ctrl-bedroom.yaml:102:3: warning: control reaches end of non-void function [-Wreturn-type]
binary_sensors:
^
*** [/data/mhi-ac-ctrl-bedroom/.pioenvs/mhi-ac-ctrl-bedroom/src/main.cpp.o] Error 1
========================== [FAILED] Took 3.60 seconds ==========================

from mhi-ac-ctrl-esphome.

ginkage avatar ginkage commented on August 22, 2024

Ah, got it. Note the following lines in your error output:

return ((MhiAcCtrl*)mhi_ac_ctrl)->get_sensors();
return ((MhiAcCtrl*)mhi_ac_ctrl)->get_binary_sensors();

These point to the lambdas in sensor and binary_sensor sections of the yaml file, and are trying to reference your climate component — these are the lines where you also need to replace mhi_ac_ctrl with your id: in this case, bedroomac. Note that you can use a more human-readable name.

To avoid other conflicts, you'll probably want to change the name parameter of the top esphome section (second line of the .yaml file), as that's going to be the hostname of your ESP's.

from mhi-ac-ctrl-esphome.

ginkage avatar ginkage commented on August 22, 2024

Please let me know if the suggestion above helped...

from mhi-ac-ctrl-esphome.

ogizhelev avatar ogizhelev commented on August 22, 2024

Hi,
Yeah - whatever i have tried always fails to compile
here is my full config https://pastebin.com/BDUifscD
if i make any changes it on the above config it fails.

from mhi-ac-ctrl-esphome.

ginkage avatar ginkage commented on August 22, 2024

Something like this seems to work fine:

       return {mhi_ac_ctrl};
     climates:
       - name: "Bedroom MHI AC Ctrl"
-        id: mhi_ac_ctrl
+        id: bedroomac
         
         
 # Sensors with general information.
 sensor:
   - platform: custom
     lambda: |-
-      return ((MhiAcCtrl*)mhi_ac_ctrl)->get_sensors();
+      return ((MhiAcCtrl*)bedroomac)->get_sensors();
     sensors:
       - name: "Error code bedroom"
       - name: "Outdoor temperature bedroom"
@@ -129,7 +129,7 @@ sensor:
 binary_sensor:
   - platform: custom
     lambda: |-
-      return ((MhiAcCtrl*)mhi_ac_ctrl)->get_binary_sensors();
+      return ((MhiAcCtrl*)bedroomac)->get_binary_sensors();
     binary_sensors:
       - name: "Defrost bedroom"
 

from mhi-ac-ctrl-esphome.

ogizhelev avatar ogizhelev commented on August 22, 2024

That worked

from mhi-ac-ctrl-esphome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.