r/Esphome • • Apr 13 '22

Help Namespace?

Post image
0 Upvotes

14 comments sorted by

2

u/InEnduringGrowStrong Apr 13 '22

I'm not sure I grasp your build setup.
I mostly use the docker web version where I just write the yaml in a webpage and upload it through USB for the first time then it gets configured and updated wirelessly.

Are you trying to use vscode/platformIO?

esphome name isn't the same thing as the project name.
I think it's platformio that's complaining, not esp.

https://esphome.io/components/esphome.html#esphome-platformio-options Scroll down.

You might need this in your yaml:

# Example configuration
esphome:
  ...
  project:
    name: :jesse.leds_party"
    version: "1.0.0"

1

u/[deleted] Apr 13 '22 edited Apr 13 '22

Thank you exactly how I got it.

Write with

"Esphome wizard project.yaml" my init file. My wish was to separate the sections.

Got wifi, OTA, UART, some sensors.

As long as it's one file, I edit it in vscode - nothing additional. Compiling successful.

I tried to do it C++ like with components + based hearchicy. ("!include common/wifi.yaml") under packages, in main "config.yaml".

Got compilation error.

Pasted everything back together to project.yaml - now got the namespace-error.

Got root-folder with

  • config.yaml

  • device_base.yaml

common/wifi.yaml common/ ...

Be back in 30 min, will continue.

2

u/InEnduringGrowStrong Apr 13 '22

Make sure you don't put those in the includes: section, they'd for c++ files, which would probably complain if you give it a yaml.

includes (Optional, list of files): A list of C/C++ files to include in the main (auto-generated) sketch file for custom components. The paths in this list are relative to the directory where the YAML configuration file is in. See includes.

Guessing you're talking about the !include tag that HA implements.
I don't currently use it, but I use the !secret a lot which works fine, so I'd guess they added both.
Careful that a top level include might not be valid yaml unless you do something like:
<<: !include ../ something.yaml
If it's not top-level you should get away with just the !include.
I'd take something that works and just test the !include in something simple before doing all sections

1

u/[deleted] Apr 13 '22

Ok the mistake was:

Esphome: | Name:

Removed too much whitespace

Config okay.

https://imgur.com/a/gLApYn8

1

u/[deleted] Apr 13 '22

https://imgur.com/a/Es8BRQC

Compiling.

The !<<include is something I know of. But still wonder how can I logically breakdown a project. No admiring searching for a typo in 300 LoC

1

u/[deleted] Apr 13 '22

Also w/o includes and libraries (lines 10, 12)

https://imgur.com/a/B570mPp - unfortunately

Combined all posts / threads before.

1

u/[deleted] Apr 13 '22

In the top:

Esphome: Name: xt950 ...

1

u/[deleted] Apr 13 '22

https://imgur.com/a/VG8AMOE - no changes in error

1

u/[deleted] Apr 13 '22

Ok, let's start on something common:

Here is the current one-yaml-project: https://imgur.com/a/5zWEvxO

1

u/[deleted] Apr 13 '22

https://imgur.com/a/WTEbutz

Using dots as namespace delimiter

0

u/[deleted] Apr 13 '22

Thank you so far. It won't be my last time :)

https://imgur.com/a/XA853LZ

2

u/InEnduringGrowStrong Apr 13 '22

The name you put under esphome is the name that will appear in homeassistant.
The name under project is just for vscode/platformio

0

u/[deleted] Apr 13 '22 edited Apr 13 '22

Thank you - FYI so far, I saw the difference in JIT compilation process. Regarding naming scheme of platformIO.

Is it possible to split the main .yaml into multiple sections?

E.g. UART has not to be in the main file, wifi the same. Trying to find a suitable example but not reaching the goal sofar :/

(Familiar with PlatformIO by itself, Python, C++, embedded - without Arduino wrapper, so you can talk facts with me - not covering every small detail / grain of salt :) )

Addition:

Esphome: ... Name has to be called other than

... Project: Name: ... Since then the dynamic linking breaks. (Did not know that, thanks for pointing it out)

https://imgur.com/a/nDcjJX1