Legacy api password enable causes hass not to start

I need to use REST api calls, so i need to use legacy api password.

But when i put the following lines in configuration.yaml:

auth_providers:
   - type: homeassistant
   - type: legacy_api_password
     api_password: !secret api_password

The result is:

2019-09-02 12:04:08 ERROR (MainThread) [homeassistant.bootstrap] Error loading /root/.homeassistant/configuration.yaml: Secret api_password not defined
2019-09-02 12:04:08 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2019-09-02 12:04:08 INFO (MainThread) [homeassistant.core] Timer:starting

What shall i do?

Do you actually have a file called secrets.yaml and inside that file have a line that says api_password: mysecretpassword?

Done, now i got:

Configuration.yaml:

homeassistant:
  auth_providers:
    - type: homeassistant
    - type: legacy_api_password

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

Secrets.yaml:


# Use this file to store secrets like usernames and passwords.
# Learn more at https://home-assistant.io/docs/configuration/secrets/
some_password: welcome
api_password: mypasss

Result:

Config directory: /root/.homeassistant
2019-09-02 12:28:11 ERROR (MainThread) [homeassistant.auth.providers] Invalid configuration for auth provider legacy_api_password: required key not provided @ data['api_password']. Got None
2019-09-02 12:28:11 ERROR (MainThread) [homeassistant.config] Invalid config for [homeassistant]: required key not provided @ data['api_password']. Got None. (See /root/.homeassistant/configuration.yaml, line 1). 
2019-09-02 12:28:11 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2019-09-02 12:28:11 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/asyncio/tasks.py", line 240, in _step
    result = coro.send(None)
  File "/usr/local/lib/python3.5/site-packages/homeassistant/core.py", line 1127, in async_call
    raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification/create
2019-09-02 12:28:11 INFO (MainThread) [homeassistant.core] Timer:starting

Still not working

Also tried:

Configuration.yaml:

homeassistant:
  auth_providers:
    - type: homeassistant
    - type: legacy_api_password
      api_password: boletas
      
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
script: !include secrets.yaml

Result:

Config directory: /root/.homeassistant
2019-09-02 12:30:46 ERROR (Thread-2) [homeassistant.util.yaml.loader] YAML file /root/.homeassistant/configuration.yaml contains duplicate key "script". Check lines 8 and 9.
2019-09-02 12:30:46 INFO (Thread-3) [homeassistant.loader] Loaded script from homeassistant.components.script
2019-09-02 12:30:46 INFO (Thread-8) [homeassistant.loader] Loaded met from homeassistant.components.met
2019-09-02 12:30:46 INFO (Thread-9) [homeassistant.loader] Loaded group from homeassistant.components.group
2019-09-02 12:30:46 INFO (Thread-6) [homeassistant.loader] Loaded automation from homeassistant.components.automation
2019-09-02 12:30:46 INFO (Thread-3) [homeassistant.loader] Loaded persistent_notification from homeassistant.components.persistent_notification
2019-09-02 12:30:46 INFO (Thread-7) [homeassistant.loader] Loaded homeassistant from homeassistant.components.homeassistant
2019-09-02 12:30:46 INFO (Thread-7) [homeassistant.loader] Loaded webhook from homeassistant.components.webhook
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up persistent_notification
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain persistent_notification took 0.0 seconds.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up homeassistant
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain homeassistant took 0.0 seconds.
2019-09-02 12:30:46 INFO (Thread-2) [homeassistant.loader] Loaded http from homeassistant.components.http
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up group
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain group took 0.0 seconds.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up met
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain met took 0.0 seconds.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up http
2019-09-02 12:30:46 WARNING (MainThread) [homeassistant.components.http.auth] legacy_api_password support has been enabled.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.
2019-09-02 12:30:46 INFO (Thread-12) [homeassistant.loader] Loaded weather from homeassistant.components.weather
2019-09-02 12:30:46 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: expected a dictionary for dictionary value @ data['script']['api_password']. Got 'boletas'
expected a dictionary for dictionary value @ data['script']['some_password']. Got 'welcome'. (See /root/.homeassistant/configuration.yaml, line 9). Please check the docs at https://home-assistant.io/components/script/
2019-09-02 12:30:46 ERROR (MainThread) [homeassistant.setup] Setup failed for script: Invalid config.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up webhook
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up weather
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain weather took 0.0 seconds.
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.components.weather] Setting up weather.met
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setting up automation
2019-09-02 12:30:46 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds.
2019-09-02 12:30:48 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 2.78s
2019-09-02 12:30:48 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2019-09-02 12:30:48 INFO (MainThread) [homeassistant.core] Timer:starting

Http response:

404: Not Found

You should really read those error messages…

The first “revision” you didn’t even specify a password,
The second “revision” you told script to call secrets.yaml.

You’re all over the place here.

1 Like
homeassistant:
  auth_providers:
    - type: homeassistant
    - type: legacy_api_password
      api_password: !secret http_password
    - type: trusted_networks
      trusted_networks:
        - 192.168.1.0/24

in secrets.yaml:

http_password: YOURPASS

Didn’t know:
In configuration.yaml the variable is declared.
In secrets.yaml variable value is set.

Better tell it that way in: https://www.home-assistant.io/docs/authentication/providers/

Thanks.

You mean, like it literally states here?

homeassistant:
  auth_providers:
   - type: legacy_api_password
     api_password: !secret http_password

Keep in mind the API password has been deprecated for many releases now, and will be dropped. Instead of trying to make this work, you should be moving to use long lived access tokens or webhook triggers.

2 posts were split to a new topic: Home Assistant app on old iOS devices?