ESPHome Issue with api: encryption when using web esphome vs using the install option on the windows machine that is connecting to my pi through network

Hello all,

Could you all help me figure out the issue with the subject.

Essentially if I create the device using webesphome and then click the “show api key”, it says something to the nature of “no api key in the file”. If I create the device using the option of the esp being connected to the pc, it shows the encryption key when clicking “show api key” and it adds the key to the build file.

Can you all help me get all of this straightened out. I feel like nothing is working correctly.

API “encryption” is optional not required.
If encryption is added, the “key” is required.

Encryption disable

api:

Or

Encryption enabled

api:
  encryption:
    key: !secret api_key

Im guessing the web installer does not enable encryption by default at pc installer does

I have one key for all devices and added it to serects

Is it not possible to add encryption to a web created device? I get some kind of error that has “dictionary” in it when trying to add a key from the esphome encryption key generator.

Thank you for the secrets idea.

Yes. It is possible just not created by default it seems. I forget.
Where/how are you trying to add it?

Dictionary error usually points to incorrect data entered but I forget where.

Like, api-key when it should be api_key or maybe it’s looking for longer or shorter key or characters limitation. The link previously provided has key generator for api (definitely a nice touch to docs).

EDIT

I also add wifi ssid/pass and the ota password to secrets

the key generator is what I was using. I was adding it directly below the api:

As in

api:
  encryption: "bunchofcharactersfromkeygenerator"
  services:

And it was throwing a fit. I will try again tomorrow and post a few screenshots in this thread.

I’m about frustrated enough for the night :slight_smile:
– In the example we are speaking of, I went ahead and just blew it up and started over, currently I am not using encryption on this specific device due the speakings of above.

When I work on this throughout the week, I will add a few screenshots to see what you and others think if it exhibits the same behavior when I try again.

look at my example. your missing “key”

Lord. That’s definitely it. I should’ve know it was something stupid. :-/ Thank you @tmjpugh!!! I apologize for such a dumb one. :slight_smile:

Please please stop asking your question on the subject line.

In order to use !secret, the addon requires a file called secrets.yaml.
that file would look something like:

api_key: “bunchofcharactersfromkeygenerator”

The reason for doing so is to be able to share your config with others without revealing your secrets :wink:

ps: you can also ‘share’ your esphome secrets with ha’s secret file; it would then look something like:

<<: !include ../secrets.yaml

This will allow you to just use one shared secrets file for both esphome and home assistant :innocent:

Sorry about that but can you give me the issue with that approach?- I don’t use forums very much


EDIT: I didn’t realize there were forum topics related to the subject for bad titles. I will do better about this in the future.

Thank you all for all of your help around this subject, I was making a mess around this subject.