Generic thermostat/temp sensor bug & questions

Hey there.

I’m pretty sure there is a bug concerning temperatures “somewhere in the ether”, with regards to temperature display (or I deeply misunderstand something).

  • I have a DS18B20 hooked up to the 1W interface of my pi. I have the thing added properly (I think), Vendor is One wire, type is Temperature Sensor. It is listed among the sensors of my things, the temperature is displayed correctly (~26.5 C)
  • If I add a new generic temperature sensor (-20…+50 C range), straight out of the box and just modify the input to the temperature of the DS18B20, the temperature is displayed incorrectly on the generic sensor (~12C)
  • If I add a generic thermostat and add the DS18B20 or the generic temp. sensor as temperature sensor input, the temperature is displayed incorrectly in both cases on the thermostat (~12 C)
  • If I make a magic on the relay and compare the input directly from DS18B20 vs the target temp of the thermostat, it is flipping the relay based on the real temp reading (~26C), but it is not working properly when I am using the thermostat Heating On/off way (flipping around ~12C)

Steps I have taken to check my sanity:

  • Count the total number of DS18B20 sensors hooked up (1 piece)
  • All values are in °C.
  • All minimum and maximum temperatures are wide enough not to jumble up things.
  • Rebooted, re-added new generic temp. and thermo.
1 Like

Hi @itarill

The generic things input values usually take a range from 0-1 or 0-100. They are mostly intended to be used with analog GPIOs that produce values from 0-3.3V or so. nymea scales the output value of the physical device to the range input range of the generic thing.

So for example if a temperature sensors on an analog GPIO would give 0V at -20°C and 3.3V at +50°C then it would be mapped to an input range of 0 - 1 on the generic temperature sensor. This again will be scaled up to the min/max values of the generic temperature sensor thing settings, by default -20 - +50°C
Some examples values:

  • -20°C on the sensor → 0V on the analog GPIO → 0 on the generic temp input → -20°C on the generic temp temperature state
  • 0°C on the sensor → 0,942V on the analog GPIO → 0,285 on the generic temp input → 0°C on the generic temp temperature state

To adjust those ranges one can edit the min/max values in the thing settings of the generic sensor. That said, it probably doesn’t make too much sense to hook up an actual temperature sensor as input for the generic temperature sensor thing as it would basically just duplicate the UI entry without adding much value.

It’s different for the generic thermostat thing though:
I’ve just checked the code for that one and apparently it doesn’t have any calibration settings for the temperature and is hardcoded from -20 - +50°C. That would be a problem, given the one-wire sensor gives values ranging from -55°C - 125°C. Tbh I didn’t really consider this use case to hook up an actual temperature sensor to the generic thermostat, however, that sure is a perfectly valid use case.
The fix would probably to add calibration settings to the generic thermostat thing just like the generic temperature sensor has.