I have a Shellyplugus that reports power and am trying to write an event that triggers off the power draw and turns on a lamp when power is drawn and turns off the lamp when power is 0. It doesnt work too well because the event keeps triggering every time the power changes very minutely. It seems like once a second the event is triggered because the power drain has changed by .01 watts.
Reading the MQTT manual, it looks like there's a numeric transformation function that can solve my problem, the IfDelta function. I interpret it to mean it outputs the previous value if a new value is less than a threshold, and outputs the new value if its greater than a threshold. Setting the threshold at 3 watts would effectively kill all the power fluctuations.
I put this in the Expression field of the plugin's subscription window:
IfDelta($$Value:,$$Previous:,3)
and all it reports is 0.00 watts in the device feature regardless of the magnitude of the power change.
Obviously I'm doing something wrong, but what?
Reading the MQTT manual, it looks like there's a numeric transformation function that can solve my problem, the IfDelta function. I interpret it to mean it outputs the previous value if a new value is less than a threshold, and outputs the new value if its greater than a threshold. Setting the threshold at 3 watts would effectively kill all the power fluctuations.
I put this in the Expression field of the plugin's subscription window:
IfDelta($$Value:,$$Previous:,3)
and all it reports is 0.00 watts in the device feature regardless of the magnitude of the power change.
Obviously I'm doing something wrong, but what?
Comment