One of the most common uses of the Yocto-Temperature is to monitor the temperature in server rooms. Many customers have asked us about applications using our modules under Windows and able to send warning emails in case of temperature increase. To the point that we decided to create one, just like this, because we are really nice people :-)
Indeed, the Yocto-Temperature is ideal for this task: it works by USB, does not require a driver, and is tiny. If, on top of this, you put it in the appropriate enclosure, the magnets of the enclosure allow you to fix it on a server rack is less time than it takes to tell.
Thanks to the magnets included in the enclosures, the Yoctopuce modules can stick to server racks.
The idea for this week is therefore to provide a minimal application (which can still be used in production) which allows you to monitor the temperature measured by a Yocto-Temperature. This application sends a warning email when the temperature goes above a given threshold. To make sure that the application runs all the time, it is provided as a Windows service.
This raises an issue for the configuration: a Windows service doesn't have an interface. Therefore, we also created a second Windows application which allows you to configure the service, that is to specify when and to whom to send a warning email.
The proposed solution is based on a Windows service
Prerequisites
This application is written in C# .NET: the Microsoft .NET framework 4 must therefore be installed on your machine for the application to be able to run.
Installation
There is no installer. You need the ThermalControlSvc.exe,ThermalControlSvc.exe.config, yapi.dll and ThermalControlCfg.exe files. Put them in a directory of your choice and, from this directory, run the following command line:
ThermalControlSvc.exe /INSTALL
This command installs and starts the Thermal control Windows service. You then only need to configure it.
Configuration
Run the ThermalControlCfg.exe application. This application connects itself to the service and displays the measured temperature, allowing you to check that you have indeed remembered to connect a Yocto-Temperature to your machine :-).
Configuration is performed under the "Configuration" tab. You must enter the credentials necessary to connect the service to the email server from which you want to send the warning emails. You must also specify the email address of the person who must receive these emails, and the threshold from which the service must start to send warning emails.If you wish to do so, you can also customize the content of the warning email.
Configuration interface
Inner workings
The inner workings of the service are very simple: as soon as the measured temperature goes up 0.5°C above the given threshold, the service switches to warning mode. When the temperature goes down 0.5°C below the threshold, the service switches back to standard mode. In warning mode, the service sends a warning email every four hours.
Uninstalling
To uninstall everything, run the following command:
ThermalControlSvc.exe /UNINSTALL
and delete the files.
Bonus
You can stop the ThermalControlSvc.exe service with the command:
ThermalControlSvc.exe /STOP
And you can restart it with the command:
ThermalControlSvc.exe /START
If you assign a logical name to your module, it is used instead of the serial number in warning emails, which is useful if you monitor several rooms.
It is also possible to run ThermalControlSvc.exe in "debug" mode without having to install it as a service. Simply run the following command:
ThermalControlSvc.exe /RUN
Beware, in "debug" mode, the settings stored the Windows registry base are not saved in the same location. You'll need to reconfigure the application if you run it as a service.
The application works with any Yoctopuce module equipped with a temperature sensor. It is designed to monitor a Yocto-Temperature, but it works as well with a Yocto-Meteo.
Downloading
You can download the application with the C# sources from here. Obviously, this application is provided as is, without any kind of warranty. But this shouldn't prevent you from contacting Yoctopuce support if you encounter difficulties in making it work.