2026-01-09 20:37:06.396 [DEBUG] [.filter.SNT_HEATING_TMP_RETURL_FL1_2] - Check treshold
2026-01-09 20:37:06.397 [DEBUG] [.filter.SNT_HEATING_TMP_RETURL_FL1_2] - 0.1 °C 0.1 °C 32.31 °C -0.37 °C -546.40 °C
2026-01-09 20:37:06.397 [DEBUG] [.filter.SNT_HEATING_TMP_RETURL_FL1_2] - Delta too small at -0.37 °C
I have th_u = 0.1 °C but 0.1°C*(-1) = -546.40°C Why?
First of all, you are better off using one of the profiles from Basic Profiles. There really isn’t anything this code can do that can’t be handled by those without the code. That’s a major reason why I did not publish this transformation to the marketplace. It’s not needed.
Temperature doesn’t work like other units. 0 °C != 0 °F != 0 K. This makes doing math across temperatures complicated. The library normalizes everything to K first before doing the calculation and then converts it back to °C or °F. But sometimes that results in unexpected results, especially with multiplication and division.
I really cannot figure out how it came up with a value less than absolute zero but suspect something went wrong with that conversion during the calculation.
My recommendation would be to use the Basic Profiles - Transformation Services | openHAB Basic Profile, or rewrite this code to work without units by calling toUnit('°C').float on last, delta, and th_u.
It looks like the State Filter Profile should do everything I need, but I’m worried about missing data for certain periods. I want to ignore the threshold if the last change was more than a few hours ago. In that case, I only want to check the min–max range. However, I don’t see any time-based filters in the State Filter Profile. Can I check the last change time in the State Filter Profile?
I’m pretty certain that the profile still updates the Item even if the delta doesn’t exceed the threshold. So the data will still get through. The Item just won’t change state.
If you are worried about the sensor no longer reporting, set an expire on the Item. The update will keep the expire timer running even if the Item doesn’t change.
I switched to the profile filter. It works without JavaScript. It was not easy to configure without debugging. The main issue was that there was no unit in the channel. Finally, I have this configuration: = -20 °C, < 120 °C. You are right—the temperature is converted to Kelvin at comparison time:
2026-01-10 12:47:32.850 [DEBUG] [internal.profiles.StateFilterProfile] - Evaluating Condition('' GTE '-20 °C' ) with input: 32.25 °C (QuantityType). Link: 'SNT_HEATING_TMP_RETURL_FL1_2 -> mqtt:topic:87e124e83c:modbus_gate_climate_topics:modbus_gt_cli_COT_HEAT_10_temperature'
2026-01-10 12:47:32.850 [DEBUG] [internal.profiles.StateFilterProfile] - Performing a comparison between input '305.40 K' (QuantityType) and value '253.15 K' (QuantityType)
2026-01-10 12:47:32.851 [DEBUG] [internal.profiles.StateFilterProfile] - Evaluating Condition('' LT '120 °C' ) with input: 32.25 °C (QuantityType). Link: 'SNT_HEATING_TMP_RETURL_FL1_2 -> mqtt:topic:87e124e83c:modbus_gate_climate_topics:modbus_gt_cli_COT_HEAT_10_temperature'
2026-01-10 12:47:32.851 [DEBUG] [internal.profiles.StateFilterProfile] - Performing a comparison between input '305.40 K' (QuantityType) and value '393.15 K' (QuantityType)
2026-01-10 12:47:32.851 [DEBUG] [internal.profiles.StateFilterProfile] - Received state update from handler: 32.25 °C, forwarded as 32.25 °C