What is the best way to do a step function in a fuel stream? I thought about previousEventValue but that will not work with multiple devices on an event handler?
Step function in fuel stream?
Just thought I’d bump this one last time. I’m trying to properly show a switch being on or off in the fuelstream. Is there a better way to do this?
Yes, when device turns on, write ‘1’ to fuel stream…
When device turns off, write ‘0’ to the same fuel stream
Although, the way I do it is this:
When device turns on
Write ‘0’ to fuel stream… Wait 2 seconds… Write ‘1’ to fuel stream
When device turns off
Write ‘1’ to fuel stream… Wait 2 seconds… Write ‘0’ to fuel stream
The first method makes triangles, the second method, makes nice thick ‘bars’.
That would work. I was worried about getting two on events and you’d write 0, 1 and then another on event and you’d write 0, 1 again and it would end up jagged.
If too many pistons try to write to fuel streams simultaneously, then some data points may get lost in all the commotion. This is why I put in a small wait for reliability.
You should really write the previous state of the device and then the new value (with a small delay possibly as well)… which is what I meant. Was trying to avoid that complexity.
I usually only code this for one bulb per room. (the main bulb)
It usually gives me enough data, without different rooms stepping on any toes.
Yes, but 0 might not be the previous value. If you’re device is getting on on on on - possibly not always an issue but was trying to account for that.
The trigger should be something like:
IF device CHANGES TO on
this will resolve your concerns
Yea, but that’s not always how fuelstreams are written. In same case it’s just on a timer. So it requires changes- hence the original reason to ask this question.
-M
My pistons are not written like you said. So it won’t work without modifying the steps- sometimes quite invasively.
-M
If it is on a timer, then simply use a conditional IF like this:
IF device is on
Then write 1 to fuel stream
ELSE write 0 to fuel stream
END IF
Just be aware that with timers you will be making triangles, not rectangular bars
I think this function might do the trick:
previousValue([device;attribute])
-M