Temperature sensor’s calibration

Recently I’ve purchased EnOcean starting kit as I think that energy harvesting solutions have big potential. They are batteries free therefore maintenance free. This is a big advantage comparing to other technologies. Anyway, the set has a temperature sensor which I’ve added to my OpenRemote controller and after linking it to a label I’ve noticed that its value has 2.5 centigrade offset comparing to my thermostat. Although, EnOcean claims that the sensor is calibrated I trust more my thermostat, the offset is simply too much!

Luckily for OpenRemote this is not a big problem. The solution is as follows:

  1. have 2 sensors, the real that’s read from the device and a virtual linked to the user interface. Both should be custom sensors with the empty custom states list;
  2. for the virtual sensor, you would have “In-memory Virtual Command” VTEMP, command: STATUS and address: VTEMP;
  3. have a rule on the real value, do your computation, then call the write command.

The rule is (checked and tested to work correctly):

rule "Correct Temperature"
  CustomState(source=="Temperature", $v: value)
  double correctedValue = Double.parseDouble($v.toString()) - 2.5;
  double fahrenheit = (correctedValue*9) / 5 + 32;
  execute.command("VTEMP", String.format("%.1f \u2103 / %.1f \u2109", correctedValue, fahrenheit));

Note that the above code does more than only temperature correction. It also adds Fahrenheit so the final UI display is:

2 thoughts on “Temperature sensor’s calibration

  1. Hi, can you please explain how you linked the virtual sensor to the UI?
    Is it correct that you created the two “In Memory Commands” and the Virtual Sensor is a sensor with the command of the “STATUS” command? What type of sensor you have used?

    • Marc, yes, indeed I have in memory command “VTEMP ON” which is used by the sensor which is then displayed in UI. The sensor is a Custom type as I haven’t yet found the reason to use any other type of sensors 😉

Leave a Reply