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
460 stars 64 forks source link

Return CPU temp on non-RPi devices #59

Closed OasisOfChaos closed 1 year ago

OasisOfChaos commented 2 years ago

Hi,

I have an OrangePi device that runs a custom version of Buster and does not have the vcgencmd binary. This makes the script always returns -1 for the temperature. This minor change checks if the 'file' /sys/class/thermal/thermal_zone0/temp exists and if it does, simply returns that value. In all other situations, it still returns -1.0.

I'm not sure if this fits in your view of this script (you may want to run it only on stock Pi's or something). If not, don't hesitate to ignore this PR :)

brunob45 commented 1 year ago

@ironsheep I too would like this change, do you know when this could be pulled into master?

Thank you

ironsheep commented 1 year ago

I may modify this slightly but thank you for contributing this!

ironsheep commented 1 year ago

Changes have been committed and will appear in v1.7.5 and later.

OasisOfChaos commented 1 year ago

Changes have been committed and will appear in v1.7.5 and later.

Thank you!