Change on Temperature and Frequency calls

Moderator: RevPiModIO

Post Reply
AndreC7
Posts: 9
Joined: 29 Feb 2024, 11:57

Change on Temperature and Frequency calls

Post by AndreC7 »

We had the following python code to monitor IoT Controller Temperature on the field

Code: Select all

while self.running:
            start_time = time.time()
            try:
                # Aquisição de temperatura e frequencia
                REVPI_TEMPERATURA = self.rpi.core.temperature
                REVPI_FREQUENCIA = self.rpi.core.frequency
                print('[RevPI Temp] {}'.format(REVPI_TEMPERATURA))
                print('[RevPI Freq] {}'.format(REVPI_FREQUENCIA))
                # Coleta dados saude do sistema
                regs = []
                regs.append(self.rpi.core.temperature)
                print('reg[0] {}'.format(regs[0]))
                regs.append(psutil.cpu_percent(interval=1))
                print('reg[1] {}'.format(regs[1]))
                mem=psutil.virtual_memory()
                regs.append(100.0 - (mem.available*100/mem.total))
                print('reg[2] {}'.format(regs[2]))
                disk=psutil.disk_usage('/')
                regs.append(disk.percent)
All values were correct. Now in new RevPi Connect, the RevPiModIO2 does not have anymore rpi.core.temperature and frequency
But the code below will print incorrect values
revpi.png
I get a b'4' as result from temperature reading.

How can I get back to regular values?
User avatar
RevPiModIO
KUNBUS
Posts: 364
Joined: 20 Jan 2017, 08:44
Contact:

Re: Change on Temperature and Frequency calls

Post by RevPiModIO »

In general, the "core" class is supported for all RevPi models and also the value for "temperature".

If the version of RevPiModIO is too old, it could happen that the "core" class is "None". Then the values do not exist.

To help with the problem, it would be nice if you run the following lines on your device directly in python3 and provide the results. A picture of the PiCtory configuration would also be helpful.

Code: Select all

pi@RevPi94373:~$ python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import revpimodio2
>>> rpi = revpimodio2.RevPiModIO(autorefresh=True)
>>> type(rpi.core)
<class 'revpimodio2.device.Connect5'>
>>> rpi.core.temperature
66
>>> rpi.io.Core_Temperature.value
67
>>> revpimodio2.__version__
'2.8.0'
>>> 
The correct PiCtory configuration (the correct Revolution Pi Model) is required.

Sven
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
AndreC7
Posts: 9
Joined: 29 Feb 2024, 11:57

Re: Change on Temperature and Frequency calls

Post by AndreC7 »

This is a brand new RevPi Connect 4.
Sem título.png
AndreC7
Posts: 9
Joined: 29 Feb 2024, 11:57

Re: Change on Temperature and Frequency calls

Post by AndreC7 »

I found that our installation script of the software app check on python packages and install revpimodio2 v2.4.2
But pip install command throws an error saying it will break system packages.

I guess version 2.4.2 does not work on RevPI Connect 4.
Will update script procedure to use latest revpimodio2.

Thanks for support.
User avatar
RevPiModIO
KUNBUS
Posts: 364
Joined: 20 Jan 2017, 08:44
Contact:

Re: Change on Temperature and Frequency calls

Post by RevPiModIO »

Hi!

RevPi Connect 4 is supported from RevPiModIO 2.6.0 - On older devices it is just a "Base-Device" without the .core.properties.

We distribute the RevPiModIO module via Debian packages. To update all packages on your RevPi device (recommended), simply run „apt update && apt full-upgrade“. If you only want to update revpimodio, you can use „apt update && apt install python3-revpimodio2“.

However, based on your output, I can see that you already have 2.8.0 installed in the global Python library on your system. Therefore, you should check the user-installed libraries (installed via pip as the user, without sudo). Pip will install libraries in „~/.local/lib/python3.x/site-packages/„ and will use that version first. If revpimodio is set to 2.4.2, it will use that version instead of 2.8.0 from the global library.

Sven
python3-RevPiModIO - https://revpimodio.org/ || Der RevPi ist das Beste, was passieren konnte!
Post Reply