Transforms devicedriver which checks if value changed: if not, no sample forwarded

I upgraded my DIA framework recently to 2.3.1.1 and noticed that the “Transform” device driver changed, introducing a trap :slight_smile:

I use the Transform device to generate at regular interval simulation values. So my “dia.yml” contains:

devices:

  • name: alarm_clock0
    driver: devices.alarm_clock_device:AlarmClockDevice

  • name: SimulatedTempSensor
    driver: devices.transforms_device:TransformsDevice
    settings:

    • name: “temperature”
      unit: “”
      channels:
      • “alarm_clock.0.15_sec”
        expr: “23”

This emits a simulated constant temperature each 15 seconds.

It worked fine before my DIA version upgrade. But now, only the initial value is forwarded to the DIA channel SimulatedTempSensor.temperature

After working hard to try to find the bug in my code, I finish to discover that the Transforms DD writes the new sample to the output channel ONLY IF this value differs from the preceding.
Since my expression is limited to a constant, the value is never re-emitted.

I consider that this is a trap.
[ul]
[li] The documentation does not mention that the value has to change[/li][li] Even when not using a constant expression as I do, nothing guaranties that 2 consecutive values are always different[/li][/ul]

So, it would be nice if you provide an evolution of the Transforms DD, adding a new setting that allows to discard or not same consecutive values.