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

Bug: having 'power_status' set to True in settings raises an error on x86 arch host while sending initial mqtt config #102

Closed MaxVRAM closed 2 years ago

MaxVRAM commented 3 years ago

Tested only on an Intel NUC x86_64

The rpi_bad_power library imports fine in pip even on this system, but returns None, causing a NoneType error.

Sennevds commented 3 years ago

RPI bad power is like the name only for RPI so it won't work on other devices.

MaxVRAM commented 3 years ago

So the library imports without raising an error, even on systems where the function won't return a valid result, such as my x86 NUC.

Previously, there was only a check in the sensors.py to disable the power_status call if the library import raise an exception, but didn't account for a successful import and None return on incompatible architecture; this was crashing system_sensors on my NUC.

I solved this in my pull request by just adding a None check on the power status function after a successful library import.

Sennevds commented 3 years ago

Hi Max I think this issue can be closed no?