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

Add success and log messages attributes to sensor #166

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

chriss158
Copy link

Hi Thomas,

I have added the following attributes to the sensor:

  • LAST_BACKUP_SUCCESSFUL -> Display in a simple boolean value if the last backup was successful
  • LAST_LOG_MESSAGES -> Show the last log messages starting with the last "Backup running ...".

This way it's easier to check if something failed and see the error messages immediately.
For example, I have a node-red flow that sends me a notification after the backup is done. If something failed, the log message is attached to the notification.

Some notes on the implementation:

  • I changed the path of the .samba_backup.sensor file to the config folder instead of the backup folder. The backup folder is used by HA and I think this folder should not be used by addon for custom files.
  • Known issue: The last log message "Backup finished" is not in the LAST_LOG_MESSAGES attribute. I think the output via bashio::logs.info and calling ha addon logs self is too close together. Even with a sleep of 20 seconds I cannot get it to show up in LAST_LOG_MESSAGES.

Thanks again for reviewing 👍

@chriss158 chriss158 changed the title Success error msg Add Success and log messages attributes to sensor Jan 24, 2024
@chriss158 chriss158 changed the title Add Success and log messages attributes to sensor Add success and log messages attributes to sensor Jan 24, 2024
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

Successfully merging this pull request may close these issues.

1 participant