Samba Backup: Create and store backups on a Samba share

great, thanks for improving the component. Do you plan on integrating an autopurge feature. On the Samba-share I take care myself but in HA i would need an extra automation.

That is what the “keep_remote” configuration option is for. Set it to the max number of backups you want to keep on your external samba share.

How do I stop the addon using mqtt?

I removed my MQTT sensor and restarted home assistant and then the addon but still see this in the log:

[13:53:25] INFO: Found local mqtt broker - topic is "samba_backup/#"

And no longer have a sensor.smba_backup

Do I have to remove the topic from the broker as well?

EDIT: never mind. Just found the reason in the documentation. Adding a startup sensor-restore now.

I tried to avoid a hard break. Mqtt notifications are currently only deprecated, but are still published like before. This is the reason why you see this log line. Just delete the mqtt sensor in Home Assistant, then you won’t no longer receive mqtt notifications.

The new sensor will automatically appear in Home Assistant when the first status change happens. But you can also use the mentioned automation in order to get the sensor directly at startup.

All good. Thanks!

How does the add-on determine if it’s a full or partial snapshot? I am interested in automating my backups, but would like to have it do a monthly full, and then weekly partial? Is this possible?

Set up an automated backup in the addon config to do a weekly partial.

Use an automation to do the full backup once a month, overriding the config (see the documentation). I’m going to set this up soon so can post my automation if needed.

1 Like

hi, sorry if the question is a little bit dumb, but do i get this right, that with this addon i can upload the created snapshot e.g. to a windows pc (windows server 2016) ?

i tried to configure properly, but im way too far away even understanding, if this addon fits my needs.

on the server i have a drive d: and a folder d:\hassio_snaps the whole drive d: is accessible via network. how should i set the configuration ?

many thanks.

I’d love to see your automation, could you post it, or DM me?

I’ll post it here when done.

Hey @thomasmauerer any chance we can override the target_dir when using a manual trigger?

Very nice card as well, would you like to share the code of it as well?

To be honest I see too many things going wrong with this approach. Just a few examples: cleanup snapshots if target varies, the sensor cannot reliably count the number of currently stored snapshots, overwritten directory may not exist, etc.

No problem. Just thought I’d ask. Thanks for considering it.

Here you go Erik, it’s a pretty standard entities card:

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
8 Likes

I see now what I missed, the sensor sensor.samba.backup which was added in 4.0. :grimacing:
Thanks anyway!

Many thanks for the new version !
Maybe a stupid question: I already have the sensor.samba_backup, how do I remove it ?

#Automation to restore the sensor when Home Assistant restarts
automation:  
- alias: Restore Samba Backup sensor on startup
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - data:
      addon: 15d21743_samba_backup
      input: restore-sensor
    service: hassio.addon_stdin
  mode: single

The automation, suggested in the docs, gives me the following error by the way:

2020-09-16 10:10:44 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: required key not provided @ data['action']. Got None
required key not provided @ data['trigger']. Got None. (See /config/configuration.yaml, line 38).  

Did you set an id for the automation?

The id is optional. In fact it’s better if you don’t assign one if you are using YAML. That way you don’t end up with orphan disabled automations in the entity registry if you ever delete the automation.

Erik, try it like this:

- alias: Restore Samba Backup sensor on startup
  trigger:
  - event: start
    platform: homeassistant
  action:
  - service: hassio.addon_stdin
    data:
      addon: 15d21743_samba_backup
      input: restore-sensor
  mode: single

It should not make any difference but that is how I have it and it is working.

1 Like