Giter VIP home page Giter VIP logo

Comments (16)

glmnet avatar glmnet commented on August 28, 2024 1

should be fixed in #61

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

You're not going to fix this errors by custom tags. That's Unrelated

The error is "right". It means ESPHome itself cannot find the secret in your secrets.yaml you'll have to provide more info on your environment. Add on configuration etc

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

Btw this is not a syntax error not neither a secrets unknown tag error!! Please fix title and try to understand the message properly

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

Changed the title, dunno if this suits better.
Add-on config:

ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
leave_front_door_open: true
status_use_ping: false

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

that's ok, so you are running the ESPHome add on inside a HA docker or Home Assistant OS.

I'm wondering actually how are you configuring the ESPHome VS code extension, is validator local or dashboard?

where is physically (os path) the file you are validating and where is physically the secrets.yaml file? (they should be in the same folder)

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

I use Home Assistant OS
ESPHome VS code extension is configured as dashboard.
It is accessible with a valid SSL certificate through nginx.
Extension successfully connects to the dashboard.
I tested by converting all the secrets to strings and everything seems to work then.

secrets.yaml file is located at the same level as the esphome yaml configuration files. The secrets are working as expected despite the error.

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

What you mean that converted to string? Is your ssid or password a number?

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

I mean instead of using !secret tag I used the actual passwords in plain text.

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

But your secrets work or not? This seems like ESPHome cannot read your secrets at all, I mean not a vscode only issue but you have something wrong with your setup or secrets file contents

To put it clear: Are you able to compile and upload if you just ignore the errors shown in vs code?

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

Yes, I can compile and upload just fine and the secrets work just fine. It is just a visual error on the vscode side.

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

The same thing is also happening with the vscode addon for the home assistant. If I open an esphome configuration yaml file and switch the language mode from yaml to esphome to view those files. I get the same errors.

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

I don't understand what's going on then.

When vscode validates your yaml it will send all the file to ESPHome inside the dashboard, then it will realize you have secrets in your yaml and will try to open the secrets.yaml locally (I.e. inside the dashboard itself). Then it will read the secret exists and value is ok. All this happens inside the ESPHome dashboard, then if there is an error it will send back this error information to the vscode extension and it will just print the error there. The vscode extension does not do any validation by itself, so it's weird you get this error while validating but then compilation works.

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

I think I found the issue. When I checked the extension logs, it successfully connects to dashboard and sends the file for validation. It also sends the secrets.yaml along with it. However, the secrets.yaml file it sends belongs to the HA configuration.
I did not use the
!include ../secrets.yaml directive and created a separate secrets.yaml file in the esphome directory. That is why, it was generating this error.

  • \config
  • -\config\esphome
  • --\config\esphome\secrets.yaml ===> this one contains esphome secrets
  • \config\secrets.yaml ===> this one contains home assistant secrets

Moving the contents of the esphome secrets to home assistant secrets fixed the issue.
However, there is a design flaw here. The extension should send the esphome secrets to the dashboard instead of the Home Assistant secrets.
If you do not add !include ../secrets.yaml directive to the esphome secrets.yaml file, it does not give any errors on the vscode but checking with dashboard validation fails.

https://esphome.io/guides/faq.html#how-do-i-use-my-home-assistant-secrets-yaml

Adding !include ../secrets.yaml directive to the esphome secrets file prevents this and pulls the contents of the home assistant secrets file.
However, by logic the extension should not send the home assistant secrets to the esphome dashboard, instead it should send the esphome secrets.

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

You're right. I'm confused there are three kinds of validations that I've worked on and mixed up my head

I tried to reproduce your scenario but could not get the errors you've got

Can you give more details on your environment?

Are you using studio code add on or is vs code running on a pc / Mac? How files are shared? Which folder do you open in code?

Thanks

from esphome-vscode.

glmnet avatar glmnet commented on August 28, 2024

You're right, I finally reproduced this

from esphome-vscode.

Salvora avatar Salvora commented on August 28, 2024

Vscode windows, SMB share, config folder

from esphome-vscode.

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.