psvanstrom / esphome-p1reader

ESPHome custom component for reading P1 data from electricity meters.
MIT License
252 stars 106 forks source link

Trouble installing node #18

Closed kakanbro closed 2 years ago

kakanbro commented 2 years ago

Hey, ESPhome is all new to me. I use the addon in homeassistant. I copied the content from your p1reader.yaml pasted to my yaml file that was auto generated and created a new secrets.yaml with my data in the same directory (/config/esphome) but when I try to install I always get the same error log. What am I doing wrong?

Compiling /data/p1reader/.pioenvs/p1reader/src/main.cpp.o /config/esphome/p1reader.yaml: In lambda function: /config/esphome/p1reader.yaml:38:31: error: expected type-specifier before 'P1Reader' auto meter_sensor = new P1Reader(id(uart_bus)); ^ /config/esphome/p1reader.yaml:67:7: error: could not convert '{, , , , , , , , , , , , , , , , , , , , , , , , , }' from '' to 'std::vector<esphome::sensor::Sensor*>' }; ^ /config/esphome/p1reader.yaml:68:3: warning: control reaches end of non-void function [-Wreturn-type] sensors: ^ *** [/data/p1reader/.pioenvs/p1reader/src/main.cpp.o] Error 1 ========================== [FAILED] Took 1.97 seconds ==========================

PeterHolgersson commented 2 years ago

Did you also copy the p1reader.h to the same directory in esphome (config/esphome)?

kakanbro commented 2 years ago

I had missed that part, I copied it now, unfortunately I still get the same error msg though

PeterHolgersson commented 2 years ago

Please check the indentation as you have copied the text, especially the "Sensor:" part: `sensor:

kakanbro commented 2 years ago

I ended up deleting the yaml and copiying the entire file instead of copy the data within it. Must have been a indentation problem when I copy pasted. It is working as intented now, thanks :)

psvanstrom commented 2 years ago

Great to hear that you solved it 👍 . I'll close the issue.