Samba Backup: Create and store backups on a Samba share

I have the same errors.

I managed to get it working with this code:

type: entities
entities:
  - entity: sensor.samba_backup
    icon: 'mdi:file-replace-outline'
    name: Backup Status
  - type: attribute
    entity: sensor.samba_backup
    attribute: backups_local
    name: Local Backups
    #icon: 'mdi:file-outline'
  - type: attribute
    entity: sensor.samba_backup
    attribute: backups_remote
    #icon: 'mdi:file-move-outline'
    name: Remote Backups
  - type: attribute
    entity: sensor.samba_backup
    attribute: total_backups_succeeded
    #icon: 'mdi:file-check-outline'
    name: Succeeded Backups
  - type: attribute
    entity: sensor.samba_backup
    attribute: total_backups_failed
    #icon: 'mdi:file-cancel-outline'
    name: Failed Backups
  - type: attribute
    entity: sensor.samba_backup
    attribute: last_backup
    #icon: 'mdi:file-clock-outline'
    name: Last Backup
show_header_toggle: false
title: Samba Backup

Unfortunately I had to comment out the icons, I can’t get those to work for attributes.

@quizzical
I had the same issue and as you said removing the files that I had renamed solved it. One question, have you figured out how to “reset” the sensor statistics so I can get failures back at 0 again. It makes it easier to notice a failure (this issue went on for a while before I figured it out, so my failed count is high).

No sorry I don’t. By the way my failed count is 0, but I never reset it on purpose. Could for example be due to the fact that I did a fresh HA install and then restored a snapshot not so long ago.

Thanks. I tried updating the failed count via the dev state tool. It reset it to 0 but it did not stay at 0 beyond a restart, so the value is being stored somewhere, I just can’t figure out where. I tried uninstalling the add-on and then installing it again but no luck. The value is being stored somewhere in HA core, just not sure where. I will keep looking and update this post if I figure it out.

1 Like

On a normal entity card

Not sure what is going on, this is my current working card config:

entities:
  - entity: sensor.samba_backup
    icon: mdi:file-replace-outline
    name: Backup Status
  - attribute: backups_local
    entity: sensor.samba_backup
    icon: mdi:file-outline
    name: Local Backups
    type: attribute
  - attribute: backups_remote
    entity: sensor.samba_backup
    icon: mdi:file-move-outline
    name: Remote Backups
    type: attribute
  - attribute: total_backups_succeeded
    entity: sensor.samba_backup
    icon: mdi:file-check-outline
    name: Succeded Backups
    type: attribute
  - attribute: total_backups_failed
    entity: sensor.samba_backup
    icon: mdi:file-cancel-outline
    name: Failed Backups
    type: attribute
  - attribute: last_backup
    entity: sensor.samba_backup
    icon: mdi:file-clock-outline
    name: Last Backup
    type: attribute
show_header_toggle: false
title: Samba Backup
type: entities

I just tested your code and it works if I comment out the parts to set the icon for the attributes.
If I don’t do that I get these type of errors:

Configuration errors detected:
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.tap_action" is missing.
Required key "entities.1.view" is missing.
Required key "entities.1.view" is missing.
Required key "entities.1.view" is missing.
Required key "entities.1.conditions" is missing.
Required key "entities.1.url" is missing.
Required key "entities.1.entities" is missing.
Required key "entities.1.service" is missing.
Required key "entities.1.text" is missing.

Would be nice to be able to set the icons for the attributes too.

I can reproduce this if I add a new card. Have opened an issue.

3 Likes

Just started using this as I was tired of manually deleting backups from the dropbox sync add-on.

So far its working flawlessly! Thank you.

Just wondering if you’ve thought about integrating “generational backups” like this google drive backup add-on?

Thanks again for a seamless add-on. :slight_smile:

Thank you for this add-on. Share configured fine, receiving the following WARNING re null when calling service, and not seeing snapshot file in share folder:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[10:22:13] INFO: Host: 10.0.0.2
[10:22:13] INFO: Share: Backups
[10:22:13] INFO: Target Dir: HomeAssistant
[10:22:13] INFO: Keep local: 2
[10:22:13] INFO: Keep remote: 5
[10:22:13] INFO: Trigger time: 02:00
[10:22:13] INFO: Trigger days: Mon Wed Fri Sun
[10:22:27] INFO: Backup running ...
[10:22:27] INFO: Creating snapshot "Samba Backup 2021-07-17 10:22"
[10:22:28] INFO: Copying snapshot null (Samba_Backup_2021_07_17_10_22.tar) to share
[10:22:28] WARNING: null.tar does not exist
[10:22:28] WARNING: Could not copy snapshot null to share. Trying again ...
[10:22:33] WARNING: null.tar does not exist
[cmd] /run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

I am seeing this same issue

This eventually went away once a snapshot was created. I think I jumped the gun as it took almost an hour for the first snapshot to complete. Once was done, works great.

Hi there,

Using the addon here and there’s some breaking change incoming that might break the addon.

The ha cli command to snapshot will be replaced from ha snapshots to ha backups
As this is merged to dev i think it will be out on next beta. Maybe time to prepare the change for the addon ?

CLI will still have an alias to accept ha snapshotscommand but how much time ?

Hi there!

I’m trying to configure the add-on to access my Time Capsule but it keeps giving me an error, although the service smb from the Time Capsule is available on my network and accessible either on my Mac or IPAD (Documents app).
Do you know if there is any incompatibility specific to the Time Capsule?

1 Like

I like this addon a lot! Using it for some weeks now. I’m now closing down my Unifi network. My Hass server is running on a different VLAN than my NAS. It’s on my NAS I want this addon to store the backups.

Unfortunately when I setup a firewall rule to only allow SMB traffic from Hass to NAS it fails. When I open up all ports, it works. So I’m missing out on one or more ports which I should allow, can you help me with that. These ports are in my allow list now:
137
138
139
445

Thanks!

@thomasmauerer
Hello Thomas,
thank you for your Addon!

I was wondering if it is possible to use this addon not only for Samba shares but also for SFTP shares?

Thank you
Alex

I would also like to see this.

I configured this add-on and it worked
 once. Now, regardless of if ran manually or via automation, it will not back up.

Configuration:

host: 192.168.3.33
share: ha-backups
target_dir: ''
username: <username>
password: <password>
keep_local: all
keep_remote: all
trigger_time: manual
trigger_days:
  - Mon
  - Tue
  - Wed
  - Thu
  - Fri
  - Sat
  - Sun
exclude_addons: []
exclude_folders: []
backup_name: '{type} Snapshot {version} {date}`

Log:

[s6-init] making user provided files available at /var/run/s6/etc
exited 0.
[s6-init] ensuring user provided files have correct perms
exited 0.
[fix-attrs.d] applying ownership & permissions fixes

[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts

[cont-init.d] done.
[services.d] starting services
[services.d] done.
[13:11:20] INFO: Host: 192.168.3.33
[13:11:20] INFO: Share: ha-backups
[13:11:20] INFO: Target Dir:
[13:11:20] INFO: Keep local: all
[13:11:20] INFO: Keep remote: all
[13:11:20] INFO: Trigger time: manual

Is there something I have missed?

Thanks

The share name is ha-backups :heavy_check_mark:
But you didn’t define the target directory: target_dir: '' :interrobang:

The “ha-backups” is the root. Just in case I put a couple of folders in there, one with the same name and one with a new name. Restarted and reran. No backup. The trace shows it start then finish in 10 seconds. Normal log:

[s6-init] making user provided files available at /var/run/s6/etc
exited 0.
[s6-init] ensuring user provided files have correct perms
exited 0.
[fix-attrs.d] applying ownership & permissions fixes

[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts

[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:24:51] INFO: Host: 192.168.3.33
[21:24:51] INFO: Share: ha-backups
[21:24:51] INFO: Target Dir: ha-backups
[21:24:51] INFO: Keep local: all
[21:24:51] INFO: Keep remote: all
[21:24:51] INFO: Trigger time: manual

Just not enough details for problem determination for a quasi-newbie.
It worked the first time when I installed in a couple of weeks ago then nothing sense.