Is use the Mosquitto broker addon, and this is working for other MQTT Topics.
I don’t see any Samba Backup log items in the HomeAssistant log at all. Do I have to enable it?
Thanks,
Rien
Is use the Mosquitto broker addon, and this is working for other MQTT Topics.
I don’t see any Samba Backup log items in the HomeAssistant log at all. Do I have to enable it?
Thanks,
Rien
No it works without additional configuration.
Does your Mosquitto log (check the Mosquitto addon / log page) show any connection from a user called “addons”
Do you use an ACL like in Rusty’s post above?
What ACL do you mean ? The one from Mosquitto ?
My Mosquitto ACL file is like this (one line)
topic readwrite #
With a MQTT explorer I can publish samba_backup/status topic and the sensors entity works.
I still don’t understand why it is not working from the Samba backup.
See the startup log from my Mosquitto
INFO: Setup mosquitto configuration
[13:21:49] WARNING: SSL not enabled - No valid certs found!
[13:22:01] INFO: No local user available
[13:22:01] INFO: Initialize Hass.io Add-on services
[13:22:01] INFO: Initialize Home Assistant discovery
[13:22:01] INFO: Start Mosquitto daemon
1593256921: Loading config file /share/mosquitto/acl.conf
1593256921: mosquitto version 1.6.3 starting
1593256921: Config loaded from /etc/mosquitto.conf.
1593256921: Loading plugin: /usr/share/mosquitto/auth-plug.so
1593256921: |-- *** auth-plug: startup
1593256921: ├── Username/password checking enabled.
1593256921: ├── TLS-PSK checking enabled.
1593256921: └── Extended authentication not enabled.
1593256921: Opening ipv4 listen socket on port 1883.
1593256921: Opening ipv6 listen socket on port 1883.
1593256921: Opening websockets listen socket on port 1884.
1593256921: Warning: Mosquitto should not be run as root/administrator.
1593256921: New connection from 192.168.0.38 on port 1883.
1593256921: New client connected from 192.168.0.38 as mqtt-explorer-46bf6aea (p2, c1, k60).
1593256922: New connection from 192.168.0.186 on port 1883.
1593256922: New client connected from 192.168.0.186 as mcsMQTT on HomeSeer4 (p2, c1, k60).
1593256925: New connection from 192.168.0.186 on port 1883.
1593256925: New client connected from 192.168.0.186 as Domoticz903c419d-f18e-4d4d-baf1-ba6e7e881b2b (p2, c1, k40).
1593256970: New connection from 192.168.0.185 on port 1883.
1593256970: New client connected from 192.168.0.185 as auto-348C5364-0B10-C384-523F-9D6A9E473094 (p2, c1, k60).
1593257163: Client mqtt-explorer-46bf6aea disconnected.
1593257165: New connection from 192.168.0.38 on port 1883.
1593257165: New client connected from 192.168.0.38 as mqtt-explorer-46bf6aea (p2, c1, k60).
Then it should work if you add this to your ACL:
user addons
topic readwrite samba_backup/#
The problem here is that the client does not receive any information from the broker whether access to the topic was denied or not. So I cannot really do much.
Ok I’ll give it a try and let you know
Great addon, thanks!
Would be nice to be able to trigger the backup by posting a trigger on the mqtt topic.
Also, I’ve opened an issue regarding a whitespace in the target folder: https://github.com/thomasmauerer/hassio-addons/issues/7
Great addon, thanks!
Just wish it would use the mqtt broker defined in HA. (I use the add-on on 3 HA instances, but only have one mqtt broker, external to all 3 HA’s )
If you mean additionally to the time-based trigger, I see a technical problem then as a mqtt listener requires another process to be running. I want to avoid multi-processing here…
I don’t know if there is way to automatically retrieve the required config here. To my knowledge this only works with addons like the Mosquitto broker, as there is an existing service call for that.
Otherwise we would need a lot of additional configuration options: mqtt_host, mqtt_username, mqtt_password, mqtt_port and mqtt_topic (in order to distinguish between the instances). That’s not really beautiful…
It could be optional though. For the majority of users that don’t define these options, keep doing what it does now. If someone goes to the trouble of defining an external broker, override your current setup.
I do feel that you have a good grasp of ‘feature creep’, and have implemented some excellent features while resisting others. But maybe the ability to define an external broker requires some consideration?
It’s no use to me, but I can see how this would be useful to others.
I guess you could make an automation to listen for a specific message and trigger the process.
Is there a specific reason why you’ve chosen either time based or manual trigger and not both?
automation.yaml
- id: sambabackup
alias: Samba Backup
description: ''
trigger:
- payload: trigger
platform: mqtt
topic: samba_backup/status
- at: 00:00:00
platform: time
condition: []
action:
- data:
addon: 15d21743_samba_backup
input: trigger
service: hassio.addon_stdin
The whole addon is just a docker container running a single bash script. So we can only do one thing at a time: either check the current time or start listening on stdin for the manual trigger, but not both.
Sure, in an HA automation you can have multiple triggers. That’s not a problem.
Is there a way to setup a sensor in lovelace to see when the last backup was done for the remote backup?
Currently not. I guess we should really extend the mqtt support. This way we could also publish such statistics over to Home Assistant
Actually, there is. Create an automation :
- id: '1567689165700'
alias: Samba backup succeeded
trigger:
- platform: mqtt
topic: samba_backup/status
payload: 'SUCCEEDED'
action:
- data:
payload_template: '{{ now().strftime("%H:%M %d/%m/%y") }}'
topic: sensor/lastsambabackup
retain: true
service: mqtt.publish
and then create a sensor :
- platform: mqtt
name: "lastsambabackup"
state_topic: "sensor/lastsambabackup"
Problem solved, thank you
Very nice. Thank you
The latest release (v2.5) now also supports external mqtt brokers.
Auto-configuration does not work in this case as mentioned above. So you have to configure it by hand. All new options are explained in the README.
Thank you very much
Hi Thomas,
thank you for a very nice add-on and your support on the forums!
I am using it to make a daily backup of my whole system.
Today I have installed InfluxDB and would like to make an hourly backup of only this add-on.
My thoughts:
If there is a better way to achieve my goal I’m all ears!
Thanks again!