Using Yoctopuce sensors in HWiNFO

Using Yoctopuce sensors in HWiNFO

While browsing the Internet, we came across a post on the HWiNFO forum asking whether Yoctopuce modules could be used in the HWiNFO software. This isn't the case by default, but as we like to be of service to our users, we've written a little Python script that adds this functionality.





HWiNFO is a hardware monitoring software. It enables users to collect detailed information on their computer's hardware components, such as the processor, graphics card, memory, hard disks, and so on. HWiNFO can also provide data on temperatures, voltages, fan speeds, and other computer component parameters.

By default, Yoctopuce modules do not appear in this software, as they do not declare themselves as native sensors recognized by Windows, but as HID peripherals. It's thanks to this choice that Yoctopuce modules can operate without driver installation. We explained the reason for this choice in a previous post.

However, HWiNFO offers the possibility of using other sensors thanks to a plugin mechanism they have called "Custom user sensors". In concrete terms, a custom user sensor is simply a key in the Windows registry containing the last measured value. So, by writing a small gateway that updates these keys with the value of Yoctopuce sensors, it is possible to add Yoctopuce sensors to HWiNFO.

The logical structure of an HWiNFO sensor is as follows: a device can contain several sensors. For example, a graphics card may contain several fans and temperature sensors. This logical structure corresponds well to the architecture of our modules. For example, a Yocto-Meteo-V2 has several sensors (temperature, pressure, and humidity).

This means that to publish a Yoctopuce sensor in HWiNFO, all you have to do is create a sub-key in the Windows registry in the following format:

HKEY_CURRENT_USER\Software\HWiNFO64\Sensors\Custom\yoctopuce_serial\sensortype

This key contains three values:

  • Name, which corresponds to the functionId of the Yoctopuce modules
  • Unit, which is the unit of the sensor
  • Value, which is the sensor's last measured value


The YoctoHWiNFO gateway

We decided to write a small program in Python that creates and updates these register keys. This gateway is available on GitHub.

To work, this gateway needs the Yoctopuce programming library, which you can install using pip.

pip install yoctopuce



Once you have installed the Yoctopuce library, simply run the script to make the modules available in HWiNFO.

C:\data\HWiNFO\HWiNFO>python YoctoHWiNFO.py Use hub usb Sensor LIGHTMK3-17EFC2.lightSensor added.



That's it, Yoctopuce sensors are now available
That's it, Yoctopuce sensors are now available



By default, this gateway adds Yoctopuce modules connected to USB ports, but it is possible to add sensors connected to a remote YoctoHub using the --remote_hub option.

C:\data\HWiNFO\HWiNFO>python YoctoHWiNFO.py --remote_hub 192.168.1.64 Use hub 192.168.1.64 Sensor YVOCMK02-AA4CB.voc added. Sensor RX420MA1-26FAD.genericSensor2 added. Sensor RX420MA1-26FAD.genericSensor1 added. Sensor METEOMK1-2AE60.temperature added. Sensor METEOMK1-2AE60.pressure added. Sensor METEOMK1-2AE60.humidity added. Sensor LIGHTMK3-32067.lightSensor added.



The -v option is used to increase the verbosity of the script. Level 1 displays all the operations performed, except for value updates. Level 2 logs all the value changes. The --use_HKEY_LOCAL_MACHINE option allows you to use the HKEY_LOCAL_MACHINE key instead of HKEY_CURRENT_USER.

The gateway source code is available on GitHub: https://github.com/yoctopuce-examples/HWiNFO_YoctoSensor It is royalty-free. It is inspired by the Prog-EventBased-Programming example included in our Python programming library.

Conclusion

Thanks to our programming library and HWiNFO extensions, you can add Yoctopuce sensors to the HWiNFO application. You can then monitor values not directly available in Windows, such as ambient brightness or air quality.




1 - harryg Friday,april 26,2024 15H05

Thanks for publishing this method. Can you please provide the same for Linux OS ?

2 - infoseeker Saturday,april 27,2024 17H25

I am the person you replied to on the HWiNFO forum, and Greatly appreciate your addressing the issue. I have Python 3.12 installed but, unfortunately, I am a plug and play person, not a developer, so this is all a bit Greek to me.

When I execute 'pip install yoctopuse' in the Windows Command module, I get 'ERROR: Could not find a version that satisfies the requirement yoctopuse (from versions: none) and 'ERROR: No matching distribution found for yoctopuse'

I assume I need to get the yoctopuse library, but have not been able to locate it to download.

Any directions appreciated

3 - martinm (Yocto-Team)Saturday,april 27,2024 18H53

It's yoctopuce with a C, not yoctopuse

4 - infoseeker Saturday,april 27,2024 20H38

Oops, my bad, will NOT happen again

5 - seb (Yocto-Team)Monday,april 29,2024 6H10

@harryg: To our knowledge, there is no version of HWiNFO that works on Linux.

6 - infoseeker Tuesday,april 30,2024 12H34

Got the library installed (spelling counts)

Running the script with updated path for location of HWiNFO on my machine
"c:\program files\HWiNFO\HWiNFO>python YoctoHWiNFO.py"
Gets me the following error
https://h8bs.com/script.jpg

7 - martinm (Yocto-Team)Tuesday,april 30,2024 15H01

@infoseeker : you are supposed to type python YoctoHWiNFO.py in a command line interpreter (cmd.exe) not in the python interpreter.

Yoctopuce, get your stuff connected.