Python Plugin: Psutil Motherboard Sensors

Python and python framework
Post Reply
febalci
Posts: 349
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Python Plugin: Psutil Motherboard Sensors

Post by febalci » Sunday 16 September 2018 17:29

Using Ubuntu, I couldn't get any reliable information from Domoticz Native 'Motherboard Sensors' plugin. Especially the empty space for HDD was always giving wrong information. So I wrote this plugin for my own needs and decided to give up on native 'Motherboard Sensors'.

Installation:

Please install the 'psutil' Python module first:
sudo pip3 install psutil

When you first enable this Plugin It provides:
  • CPU Usage Percentage
  • Memory (Virtual) Memory Usage
  • All mounted HDD Usage Percentages
And, if supported by your platform:
  • Sensor Temperatures (Celcius)
  • Fan Speeds (RPM)
  • Battery Left Percentage
You can find this plugin in https://github.com/febalci/DomoticzPsutil

dextm80
Posts: 99
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 4.10159
Contact:

Re: Python Plugin: Psutil Motherboard Sensors

Post by dextm80 » Monday 12 November 2018 0:46

Hi! Nice work! I've this issue:


2018-11-11 23:44:43.723 Error: (PsUtil) 'onHeartbeat' failed 'KeyError'.
2018-11-11 23:44:43.723 Error: (PsUtil) ----> Line 247 in '/home/luigi/domoticz/plugins/psutil/plugin.py', function onHeartbeat
2018-11-11 23:44:43.723 Error: (PsUtil) ----> Line 159 in '/home/luigi/domoticz/plugins/psutil/plugin.py', function onHeartbeat

do you known what's the matter?
Domoticz on AsRock j3455-ITX 8gb ram - Aeotec ZWave Usb Stick - RFLink 433Mhz
1x Fibaro Wall Plug
1x Fibaro Motion Sensor
2x NeoCoolcam Wall Plug
Netatmo Weather Station - Netatmo Thermostat
Philips Hue Bridge

febalci
Posts: 349
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Psutil Motherboard Sensors

Post by febalci » Monday 12 November 2018 11:24

dextm80 wrote:
Monday 12 November 2018 0:46
Hi! Nice work! I've this issue:


2018-11-11 23:44:43.723 Error: (PsUtil) 'onHeartbeat' failed 'KeyError'.
2018-11-11 23:44:43.723 Error: (PsUtil) ----> Line 247 in '/home/luigi/domoticz/plugins/psutil/plugin.py', function onHeartbeat
2018-11-11 23:44:43.723 Error: (PsUtil) ----> Line 159 in '/home/luigi/domoticz/plugins/psutil/plugin.py', function onHeartbeat

do you known what's the matter?
It turns out the snap devices on ubuntu is causing a problem on both native domoticz motherboard sensors and this psutil motherboard sensors. Please check: https://github.com/domoticz/domoticz/issues/2822

On Ubuntu, the loop devices created with snap are changing the df -h output order. So the number of disk devices and their order changes everytime, which in native motherboard sensors gives the wrong result, or in psutil motherboard sensors, an error. As a quick fix i deleted all my snap devices; but since snap is a thing on ubuntu now, i need to correct this situation in my plugin someday.

Can you please check 'df -h' and look if any loop devices or canonical snap devices exist?

dextm80
Posts: 99
Joined: Tuesday 24 October 2017 18:32
Target OS: Linux
Domoticz version: 4.10159
Contact:

Re: Python Plugin: Psutil Motherboard Sensors

Post by dextm80 » Monday 12 November 2018 18:24

febalci wrote:
Monday 12 November 2018 11:24
dextm80 wrote:
Monday 12 November 2018 0:46
Hi! Nice work! I've this issue:


2018-11-11 23:44:43.723 Error: (PsUtil) 'onHeartbeat' failed 'KeyError'.
2018-11-11 23:44:43.723 Error: (PsUtil) ----> Line 247 in '/home/luigi/domoticz/plugins/psutil/plugin.py', function onHeartbeat
2018-11-11 23:44:43.723 Error: (PsUtil) ----> Line 159 in '/home/luigi/domoticz/plugins/psutil/plugin.py', function onHeartbeat

do you known what's the matter?
It turns out the snap devices on ubuntu is causing a problem on both native domoticz motherboard sensors and this psutil motherboard sensors. Please check: https://github.com/domoticz/domoticz/issues/2822

On Ubuntu, the loop devices created with snap are changing the df -h output order. So the number of disk devices and their order changes everytime, which in native motherboard sensors gives the wrong result, or in psutil motherboard sensors, an error. As a quick fix i deleted all my snap devices; but since snap is a thing on ubuntu now, i need to correct this situation in my plugin someday.

Can you please check 'df -h' and look if any loop devices or canonical snap devices exist?
this is my df -h report:

Code: Select all

File system     Dim. Usati Dispon. Uso% Montato su
udev            3,7G     0    3,7G   0% /dev
tmpfs           764M  3,0M    761M   1% /run
/dev/sda2        82G   46G     32G  59% /
tmpfs           3,8G  124M    3,7G   4% /dev/shm
tmpfs           5,0M  4,0K    5,0M   1% /run/lock
tmpfs           3,8G     0    3,8G   0% /sys/fs/cgroup
/dev/sdc1       916G   16G    855G   2% /media/sdd1
/dev/sdb1       1,8T  1,2T    572G  68% /media/sdb1
/dev/sdd1       459G  401G     35G  93% /media/sdc1
/dev/sda1       511M  6,2M    505M   2% /boot/efi
/dev/sde1       250G   19M    250G   1% /media/sdf1
/dev/sdf1       932G  298G    635G  32% /media/sde1
tmpfs           764M   40K    764M   1% /run/user/1000
Domoticz on AsRock j3455-ITX 8gb ram - Aeotec ZWave Usb Stick - RFLink 433Mhz
1x Fibaro Wall Plug
1x Fibaro Motion Sensor
2x NeoCoolcam Wall Plug
Netatmo Weather Station - Netatmo Thermostat
Philips Hue Bridge

Post Reply

Who is online

Users browsing this forum: elgringo and 7 guests