Step function in fuel stream?


#1

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?


#2

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?


#3

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’.


#4

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.


#5

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.


#6

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.


#7

This is exactly what I did here.


#8

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.


#9

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.


#10

The trigger should be something like:
IF device CHANGES TO on

this will resolve your concerns


#11

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


#12

Ok, you lost me. Can you explain in detail what you are trying to accomplish or prevent?


#13

My pistons are not written like you said. So it won’t work without modifying the steps- sometimes quite invasively.

-M


#14

For example, if I’m writing to my fuelstream on a timer it won’t work.


#15

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


#16

I think this function might do the trick:

previousValue([device;attribute])

-M