Sennevds / system_sensors

Logging of system sensor specific for the RPI and sending them to a MQTT broker
MIT License
367 stars 113 forks source link

Consider rebranding/readme from RPI specific to any Linux system? #70

Open MaxVRAM opened 3 years ago

MaxVRAM commented 3 years ago

Since there's been a bit of change to the code base and it now running nicely on any Linux system (personally have it running on aarch64, armv61 and x86 64/32 bit platforms), perhaps this tool should be rebranded and readme updated to reflect its potential.

I'm happy to dig through the readme if you're keen.

MaxVRAM commented 3 years ago

Now that I'm looking at it, It's really just the title. Could be worth adding a mention in the readme still.

Sennevds commented 3 years ago

Yeah the project evolved from RPI specific to something more general. Cleaning of the readme is always welcome!

floriskruisselbrink commented 3 years ago

Nice project! And I also really like to use this on non-rpi hosts (macmini running ubuntu in my case).

I think a little more work is involved. The mqtt config topics for home assistants autodiscovery still add 'RPI' as manufacturer and 'RPI {deviceName}' as model for all the devices created.

And personally I have at least one error running this on something non-rpi, the underVoltage stuff doesn't work. Is there a dependency missing in requirements.txt or should this maybe become disableable as well?

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "src/system_sensors.py", line 66, in run
    self.execute(*self.args, **self.kwargs)
  File "src/system_sensors.py", line 109, in updateSensors
    + f'"power_status": "{get_rpi_power_status()}",'
  File "src/system_sensors.py", line 183, in get_rpi_power_status
    return _underVoltage.get()
AttributeError: 'NoneType' object has no attribute 'get'

_underVoltage doesn't seem to get initialized, because the from rpi_bad_power import new_under_voltage import doesn't do anything.

Sennevds commented 3 years ago

Undervoltage wouldn't work because this is RPI specific. You can disable it in the settings. I will see when I got time to change the manufacture and model to something generic

brantje commented 3 years ago

@Sennevds Thank you for this project, loving it. I've modified it a bit to suite my needs. You can find my changes here (diff).

In the future i want to extend it, make it more modular so different type of services can be monitored

sturgeo commented 3 years ago

May I ask how you have it on other platforms? I have this working great on r-pi's but when trying a Ubuntu VM the sensors get added to HA but all the values are unknown.

Edit: I've just started it manually rather than via the service and get the below:

`python3 src/system_sensors.py src/settings.yaml send config message Connected to broker cat: /sys/class/thermal/thermal_zone0/temp: No such file or directory Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "src/system_sensors.py", line 66, in run self.execute(*self.args, **self.kwargs) File "src/system_sensors.py", line 104, in updateSensors

Edit Again: I manually removed the temperature and power sensors from the code, all is working well now for a VM.

MBombeck commented 3 years ago

May I ask how you have it on other platforms? I have this working great on r-pi's but when trying a Ubuntu VM the sensors get added to HA but all the values are unknown.

Edit: I've just started it manually rather than via the service and get the below:

python3 src/system_sensors.py src/settings.yaml send config message Connected to broker cat: /sys/class/thermal/thermal_zone0/temp: No such file or directory Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "src/system_sensors.py", line 66, in run self.execute(*self.args, **self.kwargs) File "src/system_sensors.py", line 104, in updateSensors + f'"temperature": {get_temp()},' File "src/system_sensors.py", line 149, in get_temp reading = check_output(["cat", "/sys/class/thermal/thermal_zone0/temp"]).dec ode("UTF-8") File "/usr/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['cat', '/sys/class/thermal/thermal_zone 0/temp']' returned non-zero exit status 1.

Edit Again: I manually removed the temperature and power sensors from the code, all is working well now for a VM.

Can you share your version?

sturgeo commented 3 years ago

system_sensors - Copy.txt

Can you share your version?

Please see attached, I've also renamed all the references from RPi to VM.

MBombeck commented 3 years ago

system_sensors - Copy.txt

Can you share your version?

Please see attached, I've also renamed all the references from RPi to VM.

Works on my vm perfectly well. Thank you <3

mariomare22 commented 3 years ago

system_sensors - Copy.txt

Can you share your version?

Please see attached, I've also renamed all the references from RPi to VM.

Hello! thanks for this! works perfectly on ubuntu! only one thing, I am not getting available updates :-( what am I missing?