Copy log file to NAS


I’m new to Home Assistant. I was using JeeDom previously, but I have just migrated to Home Assistant when JeedDom crashed once again after an update …

I was using jeedom to monitor my consumption of wood pellets in my boiler. For that, I’m using a ZWave Fibaro Wall Plug which measure the power consumption of the vaccum which bring the pellet to the boiler.

Each time the vaccum is triggered, I log a line which allow me to determine the quantity of pellet sucked in the boiler, and determine approximatly the overall consumption.

The log file is then sent to my nas where I can make my excel sheet review.

This was working fine in jeedom, and I would like to do the same in home assistant.

So what I have done :

  • Zwave installed and configured
  • Fibaro plug wall configured and monitored
  • Configuration.yaml file updated to declare my own log file :
# Adding additional notifier file
  - name: Log_Granule
    platform: file
    filename: /config/log_granule.log
    timestamp: TRUE
  • Automation created to trigger a notification in a dedicated log file :
Configuration of my automation
alias: Detection Aspiration
description: Detection Aspiration Granule
  - platform: numeric_state
    entity_id: sensor.metered_wall_plug_switch_power
      hours: 0
      minutes: 0
      seconds: 5
    above: 500
condition: []
  - service: notify.log_granule
      message: Detection Aspiration
      title: Title
mode: single
  • NAS samba point declared and mounted (both for backup and shared folder).
Share Folder configuration


  • backup on the NAS work perfectly well

And I’m stuck there. I don’t understand what to do to create an automated task which will copy my log file on the mount point I have declared.

I’m sure it’s not so difficult, but I’m a bit lost with all the different concept.

I have setup a workaround which work, but I don’t like it : I have configured a SSH Access to homeassistant, and I’m retrieving the file in the other way. I have writter a script in python which connect in sftp to homeassistant and retreive the file. But I would like to push it instead, and mainly, I would like to understant how to proceed :slight_smile:

Other question : is there a way to define the file name of the backup ? Because it’s not really easy to read :smiley:

01/10/2023  18:41 080f51ab.tar
01/10/2023  18:49 9bd03362.tar
02/10/2023  03:00 d62ba92b.tar
01/10/2023  18:46 dbed1896.tar

Thanks in advance !

Auto reply : I just get the anwser from another forum, but it might help here as well :

Shell_command is perfect for that :

configurtaion.yaml :

  copie_log: cp /config/log_granule.log /share/Zeus_Share/

And add an automation :

    - service: shell_command.copie_log

It works perfectly :slight_smile:

1 Like

Create an Automation for backup. In action select call a service. Use ‘Home Assistant Supervisor: Create a partial backup.’, Select “Folders, List of directories to include in the backup.”. Select the folder or folders with the log file you want to back up

1 Like

In call a service, select “Name” to configure your name for the backup.

1 Like