I´m thinking of a Nextcloud updater sensor which indicates there´s an update available. Nextcloud lacks of a functional notification feature for new versions, unfortunately that´s an “issue” from the beginning which lasts until today.
This is no plug’n’play manual, instead I´d like to know if maybe someone else already built something like that. Currently I use
In other areas there´s great progress in creating all kinds of update sensors, mainly for internal Home Assistant reasons: Update notifications! Core, HACS, Supervisor and Addons is a great inspiration for that.
Here´s my current approach (long story short: everything needed exists, it´s just not combined yet…):
What do we need? 3 things:
1) Current Nextcloud version.
1.a) Use Nextcloud - Home Assistant integration to get current version installed (
sensor.nextcloud_system_version), looks like
1.b) SSH to Nextcloud server (see SSH'ing from a command line sensor or shell command for general notes) and grab current version remotely, e. g. by cat + grep + cut the config.php
2) Latest Nextcloud version available (advanced: for current release channel selected)
2.a) Grab this directly from GitHub like @Tomahawk provided for another software (related to Home Assistant) here: deConz Addon - deConz Firmware integration sensor - #6 by Tomahawk
2.b) Get it from Nextcloud updater feed (https://updates.nextcloud.org/updater_server/). For this some Nextcloud instance information (version, release channel etc. - all in a specific format) is needed. So I think getting it remotely once again by SSH-ing to Nextcloud server is necessary.
UPDATE: According to Mailbenachrichtigung bei verfügbaren Nextcloud Updates - xela's Linux Blog the “new”
occ update:check also covers Nextcloud and is probably the easiest way to go. Output looks like:
[email protected]:~$ sudo -u www-data php /var/www/nextcloud/occ update:check Nextcloud 21.0.3 is available. Get more information on how to update at https://docs.nextcloud.com/server/21/admin_manual/maintenance/upgrade.html. Update for news to version 16.0.0 is available. 2 updates available
So it seems to cover ALL available updates, not only apps (which can be detected by using
occ app:update --showonly by the way).
3) Nextcloud Update Sensor
Finally we need to compare current (1) and latest (2) Nextcloud version and set sensor state accordingly.
Where I´m stuck currently: step 2.
I´m not sure which way - 2.a) or 2.b) - is the best to go. Both will probably need a bit of testing and tweaking until if finally works.
Currently I use an eMail based Nextcloud update notification based on Mailbenachrichtigung bei verfügbaren Nextcloud Updates - xela's Linux Blog.
Bringing Nextcloud and Home Assistant a bit closer would be awesome. Curious to see what others think about this.