ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
461 stars 64 forks source link

Make Updates check available #155

Open GrakovNe opened 1 month ago

GrakovNe commented 1 month ago

I've come across the following code:

try:
    response = requests.request('GET', 'http://kz0q.com/daemon-releases', verify=False, timeout=10)
    response.raise_for_status()
except requests.exceptions.RequestException as exc:
    print_line('- getDaemonReleases() RQST exception=({})'.format(exc), error=True)
    error = True

It seems that this code triggers a network request on each execution. Unfortunately, this causes significant performance issues for my Raspberry Pi Zero, as it consumes considerable CPU and RAM to process these frequent checks. Additionally, it leads to unnecessary network traffic, which impacts my home network.

While the daemon performs its core functionality perfectly for monitoring, I am unable to use it in its current form due to these resource constraints.

To address this, I would kindly like to propose an enhancement: implement a more efficient update-checking mechanism that only checks for updates once a day or, for example, once every 100 runs.

If you agree with this solution, I would be happy to submit a pull request with an implementation.

Thank you for your time and consideration!

bsimmo commented 4 weeks ago

There is a whole problem with this area of the code. 1st frequency of check cannot be changed (iirc) 2nd it cannot be turned off (see other issues) 3rd it fails and crashes the code if the server is offline (see other issues) 4th it should really check github for releases rather than rely on ironsheep to update his server. 5th probably something else.

I don't know how far any of this came, see other issues and if there are any pull requests.

This is only a nice to have function but does seem to cause the most problems with people.

If you know how to fix all of these, have a go I've not see ironside active on this project for a while thoughm

bsimmo commented 4 weeks ago

Forgot to add, some month back a 1.9.x branch was being developed, see the history, but it has not come about yet.