Python Plugin: PiMonitor Topic is solved

Python and python framework

Moderator: leecollings

User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Python Plugin: PiMonitor

Post by McMelloW »

Xorfor wrote: Monday 15 January 2018 21:27 That is also the reason that I wrote the Disc usage plugin (https://github.com/Xorfor/Domoticz-Disc-usage-Plugin). The standard Motherboard sensors only displays some directories. With the Disc usage plugin, I am able to also monitor mounted disks.

Question on using Dusic-usage-Plugin. There in not much information in the README.md about it.
Can I enter more then one disk in the hardware - device field? Something like this /dev/sda1;/dev/sda2

At this moment trying to monitor th Rpi SDcard by/dev/root. Set the interval to 2 minutes. Device stays at 0% See also a part of the added log. I hope you can give me some hints

Code: Select all

2018-03-10 12:37:20.106 (Disk Usage) Started.
2018-03-10 12:37:20.955 (Disk Usage) Entering work loop.
2018-03-10 12:37:20.955 (Disk Usage) Initialized version 1.1.0, author 'Xorfor'
2018-03-10 12:37:20.987 (Disk Usage) Debug log level set to: 'true'.
2018-03-10 12:37:20.987 (Disk Usage) Platform: Linux
2018-03-10 12:37:20.987 (Disk Usage - /dev/root) Updating device from 0:'0' to have values 0:'0'.
2018-03-10 12:37:20.993 (Disk Usage) 'Mode6':'Debug'
2018-03-10 12:37:20.993 (Disk Usage) 'HardwareID':'10'
2018-03-10 12:37:20.993 (Disk Usage) 'Address':'/dev/root'
2018-03-10 12:37:20.993 (Disk Usage) 'Author':'Xorfor'
2018-03-10 12:37:20.993 (Disk Usage) 'Port':'0'
2018-03-10 12:37:20.993 (Disk Usage) 'HomeFolder':'/home/pi/domoticz/plugins/Disc-usage/'
2018-03-10 12:37:20.994 (Disk Usage) 'DomoticzBuildTime':'2018-03-10 10:10:23'
2018-03-10 12:37:20.994 (Disk Usage) 'Mode2':'2'
2018-03-10 12:37:20.994 (Disk Usage) 'Key':'xfr_discusage'
2018-03-10 12:37:20.994 (Disk Usage) 'Version':'1.1.0'
2018-03-10 12:37:20.994 (Disk Usage) 'Name':'Disk Usage'
2018-03-10 12:37:20.994 (Disk Usage) 'DomoticzVersion':'3.8993'
2018-03-10 12:37:20.994 (Disk Usage) 'DomoticzHash':'a9ffe5a3'
2018-03-10 12:37:20.994 (Disk Usage) Device count: 1
2018-03-10 12:37:20.994 (Disk Usage) Device: 1 - ID: 93, Name: 'Disk Usage - /dev/root', nValue: 0, sValue: '0'
2018-03-10 12:37:20.994 (Disk Usage) Device ID: '93'
2018-03-10 12:37:20.995 (Disk Usage) Device Name: 'Disk Usage - /dev/root'
2018-03-10 12:37:20.995 (Disk Usage) Device nValue: 0
2018-03-10 12:37:20.995 (Disk Usage) Device sValue: '0'
2018-03-10 12:37:20.995 (Disk Usage) Device LastLevel: 0
2018-03-10 12:37:30.563 (Disk Usage) Calling message handler 'onHeartbeat'.
2018-03-10 12:37:30.563 (Disk Usage) onHeartbeat called
2018-03-10 12:37:30.590 (Disk Usage) Line: Mounted on Avail 1K-blocks
2018-03-10 12:37:30.590 (Disk Usage) Device: Mounted
2018-03-10 12:37:30.591 (Disk Usage) Freespace: on
2018-03-10 12:37:30.591 (Disk Usage) Size: Avail
2018-03-10 12:37:30.591 (Disk Usage) Line: / 21558092 30574396
2018-03-10 12:37:30.591 (Disk Usage) Device: /
2018-03-10 12:37:30.591 (Disk Usage) Freespace: 21558092
2018-03-10 12:37:30.591 (Disk Usage) Size: 30574396
2018-03-10 12:37:30.591 (Disk Usage) Line: /dev 470180 470180
2018-03-10 12:37:30.592 (Disk Usage) Device: /dev
2018-03-10 12:37:30.592 (Disk Usage) Freespace: 470180
2018-03-10 12:37:30.592 (Disk Usage) Size: 470180
2018-03-10 12:37:30.592 (Disk Usage) Line: /dev/shm 474788 474788
2018-03-10 12:37:30.592 (Disk Usage) Device: /dev/shm
2018-03-10 12:37:30.592 (Disk Usage) Freespace: 474788
2018-03-10 12:37:30.592 (Disk Usage) Size: 474788
2018-03-10 12:37:30.593 (Disk Usage) Line: /run 426908 474788
2018-03-10 12:37:30.593 (Disk Usage) Device: /run
2018-03-10 12:37:30.593 (Disk Usage) Freespace: 426908
2018-03-10 12:37:30.593 (Disk Usage) Size: 474788
2018-03-10 12:37:30.593 (Disk Usage) Line: /run/lock 5116 5120
2018-03-10 12:37:30.593 (Disk Usage) Device: /run/lock
2018-03-10 12:37:30.593 (Disk Usage) Freespace: 5116
2018-03-10 12:37:30.594 (Disk Usage) Size: 5120
2018-03-10 12:37:30.594 (Disk Usage) Line: /sys/fs/cgroup 474788 474788
2018-03-10 12:37:30.594 (Disk Usage) Device: /sys/fs/cgroup
2018-03-10 12:37:30.594 (Disk Usage) Freespace: 474788
2018-03-10 12:37:30.594 (Disk Usage) Size: 474788
2018-03-10 12:37:30.594 (Disk Usage) Line: /var/tmp 65536 65536
2018-03-10 12:37:30.594 (Disk Usage) Device: /var/tmp
2018-03-10 12:37:30.595 (Disk Usage) Freespace: 65536
2018-03-10 12:37:30.595 (Disk Usage) Size: 65536
2018-03-10 12:37:30.595 (Disk Usage) Line: /boot 20793 42137
2018-03-10 12:37:30.595 (Disk Usage) Device: /boot
2018-03-10 12:37:30.595 (Disk Usage) Freespace: 20793
2018-03-10 12:37:30.595 (Disk Usage) Size: 42137
2018-03-10 12:37:30.595 (Disk Usage) Line: /run/user/0 94956 94956
2018-03-10 12:37:30.595 (Disk Usage) Device: /run/user/0
2018-03-10 12:37:30.595 (Disk Usage) Freespace: 94956
2018-03-10 12:37:30.596 (Disk Usage) Size: 94956
2018-03-10 12:37:30.596 (Disk Usage) Device '/dev/root' not found!!!
2018-03-10 12:37:40.490 (Disk Usage) Calling message handler 'onHeartbeat'.
2018-03-10 12:37:40.493 (Disk Usage) onHeartbeat called

Greetings McMelloW
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

@McMelloW:

You can enter only 1 device in the Device field.

If you do a df you will see something like:

Code: Select all

$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7680696 1455996   5880052  20% /
devtmpfs          495548       0    495548   0% /dev
tmpfs             500156       0    500156   0% /dev/shm
tmpfs             500156   13284    486872   3% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             500156       0    500156   0% /sys/fs/cgroup
/dev/mmcblk0p1     41853   21329     20524  51% /boot
/dev/sdc1     1953511420 5287188  68224232  66% /mnt/Backup
tmpfs             100028       0    100028   0% /run/user/1000
You need to use the last column in the Device field. So in your case not /dev/root, but /.
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Python Plugin: PiMonitor

Post by McMelloW »

Thanks for your reply. It is working now. At least I see a percentage.
Disk Usage - 29.5665%; Df - 27%; motherboard sensor - 25.3%; RPi-Monitor (webinterface) 25.3% Which one is the right value???

Bare in mind!
If you update the hardware the device is not updated.
You have to delete the device first. After activating the hardware again a new device is created.
Greetings McMelloW
jumping
Posts: 14
Joined: Tuesday 19 July 2016 14:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9227
Location: Italy
Contact:

Re: Python Plugin: PiMonitor

Post by jumping »

Hello,
the plugin gives this error:

Code: Select all

 2018-03-18 20:02:39.746 Error: (Pi-Monitor) 'onHeartbeat' failed 'KeyError'.
2018-03-18 20:02:39.746 Error: (Pi-Monitor) ----> Line 190 in /home/pi/domoticz/plugins/xfr-pimonitor/plugin.py, function onHeartbeat
2018-03-18 20:02:39.746 Error: (Pi-Monitor) ----> Line 144 in /home/pi/domoticz/plugins/xfr-pimonitor/plugin.py, function onHeartbeat 
I have Domoticz v3.8976, please could you help me? thanks
Domoticz + Mysensors 2.0 ESP8266 GW + RFlink + Philips Hue 2.0 + Netatmo Thermostat
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

@jumping:

Strange error message! Is the Up Time still updated?
If you still have these problems, please update Domoticz to the latest beta version. When I wrote this plugin, I found some minor bugs in the Domoticz Python interface in changing the options from a device. They are already fixed a couple of weeks ago by one of the Domoticz developers.
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: PiMonitor

Post by assenzuid »

Same error here.
Running latets beta version.

Code: Select all

2018-03-20 21:14:44.475 Error: (Domoticz RPi Monitor) ----> Line 190 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onHeartbeat
2018-03-20 21:14:44.475 Error: (Domoticz RPi Monitor) ----> Line 144 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onHeartbeat
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

Ok, I removed the debug line, on which you got the error message. Hopefully this will solve the problem.
Also did some modifications in the declaration of the units.

So, a new version is available on https://github.com/Xorfor/Domoticz-PiMonitor-Plugin
jumping
Posts: 14
Joined: Tuesday 19 July 2016 14:49
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9227
Location: Italy
Contact:

Re: Python Plugin: PiMonitor

Post by jumping »

Code: Select all

2018-03-22 21:07:34.157 (Pi-Monitor) Stop directive received.
2018-03-22 21:07:34.177 (Pi-Monitor) Exiting work loop.
2018-03-22 21:07:34.203 (Pi-Monitor) Calling message handler 'onStop'.
2018-03-22 21:07:34.203 (Pi-Monitor) onStop called
2018-03-22 21:07:34.357 (Pi-Monitor) Stopping threads.
2018-03-22 21:07:34.357 (Pi-Monitor) Stopped.
2018-03-22 21:07:34.357 (Pi-Monitor) Started.
2018-03-22 21:07:34.532 (Pi-Monitor) Entering work loop.
2018-03-22 21:07:34.532 (Pi-Monitor) Initialized version 1.1.0, author 'Xorfor'
2018-03-22 21:07:34.536 (Pi-Monitor) Debug log level set to: 'true'.
2018-03-22 21:07:34.536 (Pi-Monitor) Creating images from file '/home/pi/domoticz/plugins/xfr-pimonitor/xfr_pimonitor.zip'.
2018-03-22 21:07:34.548 Error: (Pi-Monitor) 'onStart' failed 'KeyError'.
2018-03-22 21:07:34.548 Error: (Pi-Monitor) ----> Line 164 in /home/pi/domoticz/plugins/xfr-pimonitor/plugin.py, function onStart
2018-03-22 21:07:34.548 Error: (Pi-Monitor) ----> Line 59 in /home/pi/domoticz/plugins/xfr-pimonitor/plugin.py, function onStart 
mhhh I have some problems... :shock: :shock:
Domoticz + Mysensors 2.0 ESP8266 GW + RFlink + Philips Hue 2.0 + Netatmo Thermostat
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: PiMonitor

Post by assenzuid »

Still the same errors after updating to the latest version.

Code: Select all

2018-03-22 22:50:46.471 Error: (Domoticz RPi Monitor) 'onHeartbeat' failed 'KeyError'.
2018-03-22 22:50:46.472 Error: (Domoticz RPi Monitor) ----> Line 190 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onHeartbeat
2018-03-22 22:50:46.472 Error: (Domoticz RPi Monitor) ----> Line 144 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onHeartbeat
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

@jumping:
A while ago I had the same problem with an other plugin. Domoticz has problems to get the icons for this plugin. Please do the following:

1. Remove the Hardware where you used the PiMonitor plugin
2. Goto to Setup -> More Options -> Custom Icons
3. Select the PiMonitor icon
4. Click Delete
5. Add the Hardware again

@assenzuid:
You are still using the 'old' plugin. Please update to the latest plugin version.
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: PiMonitor

Post by assenzuid »

Xorfor wrote: Friday 23 March 2018 20:09 @jumping:
A while ago I had the same problem with an other plugin. Domoticz has problems to get the icons for this plugin. Please do the following:

1. Remove the Hardware where you used the PiMonitor plugin
2. Goto to Setup -> More Options -> Custom Icons
3. Select the PiMonitor icon
4. Click Delete
5. Add the Hardware again

@assenzuid:
You are still using the 'old' plugin. Please update to the latest plugin version.
No, using the latest version. Yesterday I downloaded the latest version of the plugin from GitHub
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

assenzuid wrote: Friday 23 March 2018 21:05 No, using the latest version. Yesterday I downloaded the latest version of the plugin from GitHub
The error is pointing to the 'old' debug line. Currently there is nothing in line 144 which can give you this error.

Did to restart Domoticz?

This is always required after a plugin update.
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: PiMonitor

Post by assenzuid »

Yeah, I believe I did that. Just reboot again and see what happens.

Still error message.

Code: Select all

2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) 'onStart' failed 'KeyError'.
2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) ----> Line 164 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) ----> Line 59 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
Capture.PNG
Capture.PNG (11.02 KiB) Viewed 3923 times
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Python Plugin: PiMonitor

Post by McMelloW »

assenzuid wrote: Saturday 24 March 2018 14:39 Yeah, I believe I did that. Just reboot again and see what happens.

Still error message.

Code: Select all

2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) 'onStart' failed 'KeyError'.
2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) ----> Line 164 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) ----> Line 59 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
Capture.PNG
@assenzuid
On Domoticz version V3.9052 and RPi Monitor 21-03-2018 (Version is still 1.1.0)
I get exact the same errors after a reboot or a Domoticz restart, but only once. After that no more errors.. I don't know or RPi Monitor is working OK after that.
Greetings McMelloW
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: PiMonitor

Post by assenzuid »

McMelloW wrote: Saturday 24 March 2018 14:53
assenzuid wrote: Saturday 24 March 2018 14:39 Yeah, I believe I did that. Just reboot again and see what happens.

Still error message.

Code: Select all

2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) 'onStart' failed 'KeyError'.
2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) ----> Line 164 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
2018-03-24 14:38:23.067 Error: (Domoticz RPi Monitor) ----> Line 59 in /home/pi/domoticz/plugins/PiMonitor/plugin.py, function onStart
Capture.PNG
@assenzuid
On Domoticz version V3.9052 and RPi Monitor 21-03-2018 (Version is still 1.1.0)
I get exact the same errors after a reboot or a Domoticz restart, but only once. After that no more errors.. I don't know or RPi Monitor is working OK after that.
Error is indeed once logged after ra reboot, plugin is working.
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

The error @line 59 is a different error. For some reason Domoticz is not able to find the icons in the database. It does not influence the working of the plugin. I is possible that the devices from this plugin does display the default Domoticz icon.
To remove this error or display the plugin icons, do the following as described in a previous post:
1. Remove the Hardware where you used the PiMonitor plugin
2. Goto to Setup -> More Options -> Custom Icons
3. Select the PiMonitor icon
4. Click Delete
5. Add the Hardware again
Else you can ignore this error.
assenzuid
Posts: 135
Joined: Friday 13 November 2015 9:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands, Emmen Area
Contact:

Re: Python Plugin: PiMonitor

Post by assenzuid »

Okay, I will give it a try
User avatar
McMelloW
Posts: 427
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Python Plugin: PiMonitor

Post by McMelloW »

Xorfor wrote: Saturday 24 March 2018 20:08 The error @line 59 is a different error. For some reason Domoticz is not able to find the icons in the database. It does not influence the working of the plugin. I is possible that the devices from this plugin does display the default Domoticz icon.
To remove this error or display the plugin icons, do the following as described in a previous post:
1. Remove the Hardware where you used the PiMonitor plugin
2. Goto to Setup -> More Options -> Custom Icons
3. Select the PiMonitor icon
4. Click Delete
5. Add the Hardware again
Else you can ignore this error.
Followed the steps 1-5. For me the problem is solved. Don't forget to update the version number when you make changes.
Last edited by McMelloW on Sunday 25 March 2018 12:50, edited 1 time in total.
Greetings McMelloW
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: PiMonitor

Post by Derik »

Dear developer..
Great plugin!!
Is there perhaps a option to reconnect/reboot the netwerk when the pi lost his connection?


Edit:
Did install this plugin on my BPi... And there is only the CPU temp isworking..
Perhaps a option to make the plugin for more devices working??

Install on my odroid Xu4 and the...CPU is also the only one...

Will help for develop if you need some data.

Thanks!!!
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Xorfor

Re: Python Plugin: PiMonitor

Post by Xorfor »

@Derik:

Thnx!!!

This plugin is especially written for the RPi and also to monitor my development RPi during testing plugins. I don't have any intention to make it working on other hardware. Else I have to use a tool like 'psutil', which I don't want.

But if you have any suggestions to improve the plugin with standard Linux commands, please contact me.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest