AppDaemon / appdaemon

:page_facing_up: Python Apps for Home Automation
Other
832 stars 417 forks source link

Warning about "secrtets" from apps where yaml is commented out #1960

Open Aephir opened 6 months ago

Aephir commented 6 months ago

What happened?

Whenever, I comment out some app in yaml, if that app config contains a reference to secrets.yaml, I get a warning in the logs.

To be clear: This happens when the yaml is commented out, not when it is uncommented. When I remove the comments, everything just works with no warnings.

It loads values from secrets.yaml just fine when the yaml is not commented. I also have a Home Assistant Community post about this.

FYI: The Addon does not report AppDaemon version, it just shows it as 4.x. I am musing the Addon v0.16.4

Version

4.x

Installation type

Home Assistant add-on

Relevant log output

2024-02-12 12:47:09.633652 WARNING AppDaemon: File '/config/apps/test/test.yaml' invalid structure - ignoring
2024-02-12 12:47:09.636354 WARNING AppDaemon: ------------------------------------------------------------
2024-02-12 12:47:09.636763 WARNING AppDaemon: Unexpected error loading config file: /config/apps/shopping_and_inventory/shopping_and_inventory.yaml
2024-02-12 12:47:09.637404 WARNING AppDaemon: ------------------------------------------------------------
2024-02-12 12:47:09.638709 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 578, in read_config_file
    return utils.read_config_file(file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 586, in read_config_file
    return read_yaml_config(path)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 724, in read_yaml_config
    if "secrets" in config:
       ^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Relevant code in the app or config file that caused the issue

Only the version WITH comments as shown here is problematic.

#test:
#    module: test
#    class: Test
#    ar: !secret autoremote_url_start
#    test_list: ["input_boolean.basement_lights_motion_control", "input_boolean.tv_room_lights_motion_control"]
#    grocy_api_key: !secret grocy_api_key
#    pin_automation: !secret alarm_code_automation

Anything else?

No response