Trouble with ESPhome code

Hi all,

I am very new to ESPhome and am running into some issues with a few lines of code. It has to do with the secret.yaml and passwords in the code. The error message I am recieving for each password line is:

INFO ESPHome 2023.8.3
INFO Reading configuration /config/esphome/7-segment-clock.yaml...
ERROR Error while reading config: Invalid YAML syntax:

Secret 'hassio_api_password' not defined
  in "/config/esphome/7-segment-clock.yaml", line 30, column 13:
      password: !secret hassio_api_password

but I can’t tell what’s wrong. This is the ESPhome code:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${device_name} Fallback Hotspot"
    password: !secret wifi_fallback_api_password

logger:
  level: DEBUG
# Enable Home Assistant API
api:
  password: !secret hassio_api_password

ota:
  password: !secret ota_password

I am not getting an error on the wifi SSID or Password lines, but I am on each subsequent password line.

ALSO, I am not sure which passwords it wants for these passwords:

api:
  password: !secret hassio_api_password

ota:
  password: !secret ota_password

Sorry if this doesn’t make sense…it’s been a long day. But if anyone can point me in the right direction, I would greatly appreciate it!

Thanks!

The api password is depreciated.

The ota is a password required for Over The Air updates, and is optional.

You don’t have the declared all !secrets (passwords) in your secrets.yaml :point_down:

This is what I have in my secrets.yaml file. Am I missing something?

Thank you!!

You show your HA secrets.yaml but don’t have that linked in your esphome yaml? :thinking:

How do I use my Home Assistant secrets.yaml?

If you want to keep all your secrets in one place, make a secrets.yaml file in the esphome directory with these contents (so it pulls in the contents of your main Home Assistant secrets.yaml file from one directory higher):

<<: !include ../secrets.yaml

alternatively just use the “default” way with the secrets(.yaml) inside esphome :point_down:

Ah!!! I wasn’t aware of that in ESPhome. I was using the secrets.yaml in HA, but since I wasn’t using the one in ESPhome, it wasn’t linked.

The code now compiles perfectly.

Thank you so much!!!

1 Like

Can anybody help me understand how to control the segments in a seven segment LED clock? My data path is different than the one this code was written for, and I’m assuming this section determines which segments are located where, but I’m not sure.

int digitsLeds[10][ledsInDigitCount] = {
            {1,1,0,1,1,1,1},
            {0,0,0,1,0,0,1},
            {1,1,1,1,1,0,0},
            {1,0,1,1,1,0,1},
            {0,0,1,1,0,1,1},
            {1,0,1,0,1,1,1},
            {1,1,1,0,1,1,1},
            {0,0,0,1,1,0,1},
            {1,1,1,1,1,1,1},
            {1,0,1,1,1,1,1}
          };

Any help on deciphering how this works would be greatly appreciated!

Thanks!!

bonsoir,
Good evening,

il faut créer un fichier nommé secrets.yaml dans le repertoire config
you must create a file named secrets.yaml in the config directory

dans ce fichier, il faut créer une ligne:
in this file, you must create a line:


hassio_api_password: VotreMotDePasseSecret
ota_password: VotreMotDePasseOTA

pour créer le fichier, vous pouvez installer “file editor”
to create the file you can install “file editor”