Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "The 'name' option is not supported on non-supervised installations" when running in HA Core (Docker) #65

Closed
SemoTech opened this issue Aug 1, 2022 · 22 comments

Comments

@SemoTech
Copy link

SemoTech commented Aug 1, 2022

Installed via HACS and added the Integration. Configured an Automation with defaults successfully, but when it runs it errors out.

What am I missing or need to edit for this to run on HA Core?

image

image

Thank you.

@jcwillox
Copy link
Owner

jcwillox commented Aug 8, 2022

Oh yeah sorry totally forgot about that on HA core. I'll fix this, but simply you won't be able to have custom names for the backups, they will all be named based on f"Core {HAVERSION}".

@SemoTech
Copy link
Author

SemoTech commented Aug 8, 2022

Oh yeah sorry totally forgot about that on HA core. I'll fix this, but simply you won't be able to have custom names for the backups, they will all be named based on f"Core {HAVERSION}".

No worries @jcwillox thats fine and appreciate you figuring it out and fixing it.
Do advise once the fix is ready so I can update and retry. Thank you.

@jcwillox
Copy link
Owner

jcwillox commented Aug 9, 2022

Release 1.2.0 will partially fix this issue, however, you will need to manually clear the "Backup Name" field in the blueprint. I've also updated the blueprint to include instructions to clear that field on Home Assistant Core.

@SemoTech
Copy link
Author

SemoTech commented Aug 9, 2022

Thank you kindly @jcwillox for fixing.

I have updated to v1.2.0, deleted the blueprint and re-installed it. I also looked through the updated blueprint and found this code but not sure what I would have to change and where to fix the name error:

backup_name:
      name: "Name template used for backups"
      description: |
        On Home Assistant Core (non-supervised) this field will need to be blank as it's not supported
      default: |
        {{ backup_type | title }}Backup: {{
          now().strftime(
            "%A, "
            ~ iif(backup_type == "hourly", "%-I:%M %p, ", "")
            ~ "%B %-d, %Y"
          )
        }}

Kindly advise....

@SemoTech
Copy link
Author

SemoTech commented Aug 9, 2022

I think I got it. I edited the "Automation" entry, not the "blueprint", and placed a "#" comment in front of the 'name' field, in the "Backup Option (optional) section. After saving the section it now looks like the below ('name' field disappeared) and the backup was successfully created with a similar random name as if it was done manually.

image

Will there ever be an option for naming the backups in HA Core?
Also, will the cleanup options work in HA Core?

My thanks!

@jcwillox
Copy link
Owner

jcwillox commented Aug 9, 2022

Great! Sort of you need to delete the text inside the name field shown in the image below.

Home Assistant.jpg

Home Assistant2.jpg

I hope they will support naming the backups, but thats not up to me, you could create a feature request for it on the community forums if you want (there may even be one already I haven't checked). Additionally would be good if they supported adding a password.

The automatic deletion of backups thankfully does work with HA Core.

@SemoTech
Copy link
Author

SemoTech commented Aug 9, 2022

Thanks @jcwillox . Great to hear that removing backups (cleanup) works. Will of course post a feature request for the rename and the password.

OK, just to make sure I am doing it right for HA Core, the code from your automatic_backups.yaml must change from:

input:
   backup_name:
     name: Name template used for backups
     description: 'On Home Assistant Core (non-supervised) this field will need to
       be blank as it''s not supported

       '
     default: "{{ backup_type | title }}Backup: {{\n  now().strftime(\n    \"%A,
       \"\n    ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n    ~ \"%B
       %-d, %Y\"\n  )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January 2, 2006 #}\n{#
       DailyBackup: Monday, January 2, 2006 #}\n"
     selector:
       template: {}

to

  input:
    backup_name:
      name:
      description: 'On Home Assistant Core (non-supervised) this field will need to
        be blank as it''s not supported

        '
      default: "{{ backup_type | title }}Backup: {{\n  now().strftime(\n    \"%A,
        \"\n    ~ iif(backup_type == \"hourly\", \"%-I:%M %p, \", \"\")\n    ~ \"%B
        %-d, %Y\"\n  )\n}}\n{# HourlyBackup: Monday, 3:04 PM, January 2, 2006 #}\n{#
        DailyBackup: Monday, January 2, 2006 #}\n"
      selector:
        template: {}

Is that correct?

And if so, any chance you could maybe add a toggle option for 'HA Core' that does it automatically, so that future releases do not break these manual changes?

Thank you.

@jcwillox
Copy link
Owner

jcwillox commented Aug 9, 2022

You don't need to edit the actual blueprint, just delete the contents of the text box in the UI when you're creating the automation, like in the two images.

I did think of adding a toggle for that, and I may still, however, I just had a better idea. I will need to check if this is actually possible but the Auto Backup integration should have direct access to the backup files unlike with the supervised version, which means I can edit the backup after it is created and change the name. This would allow the name option to work on HA Core as well.

@SemoTech
Copy link
Author

SemoTech commented Aug 9, 2022

Got it.

That's a brilliant workaround @jcwillox. I will then wait to make any changes and wait to hear from you if the post backup creation file rename works, as well as when you release the updated version...

Thank you.

@SemoTech
Copy link
Author

Hey @jcwillox hope you're having a relaxing weekend. Looking forward to your next version, with the rename feature for HA Core....

@jcwillox
Copy link
Owner

Yep the feature is done and I should have released it already 👌 I'll get on it now

@jcwillox
Copy link
Owner

I've released the feature now in version 1.3.0 🎉, this means the blueprint should now work without any changes needed.

@SemoTech
Copy link
Author

I've released the feature now in version 1.3.0 🎉, this means the blueprint should now work without any changes needed.

You're the best @jcwillox Thank you! Grabbing and installing now...

@SemoTech
Copy link
Author

Hey @jcwillox Just a heads up that while the nightly backup worked, yey! it was not renamed. Here is what it created in the /backups folder:

-rw-r--r-- 1 root root 50472960 Aug 14 02:30 3939ac2d.tar

I also saw a bunch of errors in the HA main log related to your backup, any suggestions on how to fix?

2022-08-13 19:11:17.125 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: Failed to load blueprint: Unable to find vorion/create-automated-backups-every-day.yaml (See /config/configuration.yaml, line 8). 

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 209, in _load_blueprint

    blueprint_data = yaml.load_yaml(self.blueprint_folder / blueprint_path)

  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 154, in load_yaml

    with open(fname, encoding="utf-8") as conf_file:

FileNotFoundError: [Errno 2] No such file or directory: '/config/blueprints/automation/vorion/create-automated-backups-every-day.yaml'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 103, in _try_async_validate_config_item

    config = await async_validate_config_item(hass, config, full_config)

  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 70, in async_validate_config_item

    return await blueprints.async_inputs_from_config(config)

  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 298, in async_inputs_from_config

    blueprint = await self.async_get_blueprint(bp_conf[CONF_PATH])

  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 276, in async_get_blueprint

    blueprint = await self.hass.async_add_executor_job(

  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run

    result = self.fn(*self.args, **self.kwargs)

  File "/usr/src/homeassistant/homeassistant/components/blueprint/models.py", line 211, in _load_blueprint

    raise FailedToLoad(

homeassistant.components.blueprint.errors.FailedToLoad: Failed to load blueprint: Unable to find vorion/create-automated-backups-every-day.yaml

Thank you!

@jcwillox
Copy link
Owner

Great, yeah look at that last line of the error, the blueprint your trying to use doesn't exist. Probably just reinstall the Automatic Backups blueprint and recreate the automation.

@SemoTech
Copy link
Author

Great, yeah look at that last line of the error, the blueprint your trying to use doesn't exist. Probably just reinstall the Automatic Backups blueprint and recreate the automation.

Ahhh... well I deleted the automation then did an in-place update of the Auto-backup blueprint, and maybe HA did not properly cleanup the previous version. I will now delete the Automation as well as the blueprint, and install the latest blueprint from scratch then re-create the automation.
Thank you.

@SemoTech
Copy link
Author

@jcwillox I did a full cleanup, installed Auto-Backup v1.3.0 from HACS and restarted. Just need the proper blueprint now...

Seems the reason for the error was that I imported the blueprint from HERE and it was not yours. Do you have a link for your blueprint? Thank you.

@jcwillox
Copy link
Owner

Yeah that'd do it, all my blueprints are in this repository jcwillox/home-assistant-blueprints, there's also a link to it in the Auto Backup docs.

@SemoTech
Copy link
Author

Perfect, got it @jcwillox I was looking for it but did not read the install docs again... cause I knew better :-)

All installed so now fingers crossed for 2:30PM backup and notification (installed your notification one too)...

Thanks again!

@SemoTech
Copy link
Author

Hi @jcwillox, the backup occurred again just fine at 2:30AM, but again it was not renamed. I checked the logs and found nothing related to the auto backup, and no errors. I also did not get any notifications on my iPhone as configured in the automation from your auto backup notifications blueprint. Any ideas how to can debug this? Thank you and sorry for the trouble.

@jcwillox
Copy link
Owner

Sounds like something must have gone wrong, you can test if the rename feature is working by just using a service call like this.

service: auto_backup.backup
data:
  name: Hello World

Would you be able to share a screenshot or copy of your blueprint configuration?

@matthgyver
Copy link

Hi,

I have a same problem.
I called the service like you say and got this:

-rw-r--r--  1 root root  96M déc.  17 18:05 3dddea27.tar

Any idea please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants