hjelev/rpi-mqtt-monitor

Feature Request: Updates Available on Host

Opened this issue · 12 comments

Thanks for taking the time to make this, it works really well!

I'd love to see an available updates entity if it's possible?

Thanks again!

This is a good idea, I'll add it to the road map.

I support the idea as well. :)

Same here, perhaps you can also add a switch to carry out updates on the Rpi?

My idea is to automate updates on my Rpi's. Unfortunately, you can't do this in HA via shell commands, as the connection is always cut after 60 seconds and you don't get a response as to whether it worked or not.

I have added apt updates sensor, its refreshed every hour by default.
You need to enable it manually after the update - its disabled by default.

@hjelev How does the updating from Home Assistant work? I have "git_update = True" and "update = True" in my config, it is running as a service, and Home Assistant is showing me that an update is available. I click the install button in Home Assistant and nothing appears to happen. Is there something else I need to do?

@hjelev How does the updating from Home Assistant work? I have "git_update = True" and "update = True" in my config, it is running as a service, and Home Assistant is showing me that an update is available. I click the install button in Home Assistant and nothing appears to happen. Is there something else I need to do?

I've experienced the same issue with one of my other systems that are not even RPi. After restarting the targeted system, the update from HA was successful.

You need to wait, sometimes it takes ~ 50 secs.
I need to display update progress but i don't know how to do it for now.

@hjelev , the MQTT script from HASS to Update works great. Thank you for this great work. The only thing missing is to be able to update the RPI via HASS and get a response whether it worked or not. Something like a return code or return output.

Maybe I am doing something wrong? I see this in Home Assistant:
Screenshot 2024-11-08 at 2 21 28 PM

Then I click on the entry:
Screenshot 2024-11-08 at 2 21 42 PM

Then I click the Install button and nothing happens. I have waited almost a full day. The files remain unchanged on the Raspberry Pi, and there is nothing in the log:

root@tipiemu:~# ls -la rpi-mqtt-monitor/src
total 60
drwxr-xr-x 3 root root  4096 Sep  1 14:12 .
drwxr-xr-x 6 root root  4096 Jul 21 20:23 ..
-rw-r--r-- 1 root root  1969 Oct 29 18:01 config.py
-rw-r--r-- 1 root root  1972 Aug 20 14:37 config.py~
-rw-r--r-- 1 root root  1980 Jul 21 20:22 config.py.example
drwxr-xr-x 2 root root  4096 Oct 29 18:01 __pycache__
-rw-r--r-- 1 root root 31890 Jul 21 20:22 rpi-cpu2mqtt.py
-rw-r--r-- 1 root root  3753 Jul 21 20:22 update.py
root@tipiemu:~# journalctl -u rpi-mqtt-monitor.service --no-pager
Oct 29 18:05:00 tipiemu systemd[1]: Stopping rpi-mqtt-monitor.service - RPI MQTT Monitor...
Oct 29 18:05:00 tipiemu python3[2825196]: Error connecting to MQTT broker:
Oct 29 18:05:00 tipiemu systemd[1]: rpi-mqtt-monitor.service: Deactivated successfully.
Oct 29 18:05:00 tipiemu systemd[1]: Stopped rpi-mqtt-monitor.service - RPI MQTT Monitor.
Oct 29 18:05:00 tipiemu systemd[1]: rpi-mqtt-monitor.service: Consumed 7h 58min 38.126s CPU time.
Oct 29 18:05:00 tipiemu systemd[1]: Started rpi-mqtt-monitor.service - RPI MQTT Monitor.
root@tipiemu:~# grep -i update rpi-mqtt-monitor/src/config.py
# Binary sensor that displays when there are updates
git_update = True
# Enable remote update of the script via Home Assistant
update = True
update_check_interval = 3600 # 1 hour

@webdeck in order for the auto update to work your git branch should be master and it should be ready to pull (no local changes), you can check this by executing git status command.

@hjelev I can run the update on the pi just fine - I am on master with no local changes. My question is how to run the update from Home Assistant. It doesn't do anything when I click the button there. What am I missing?