Help doing the math


#1

Working some more on my refrigerator piston and I’ve got it set so that it’ll show how long the door was opened for the most recent opening and now wanting to keep a running total of time throughout the day. My idea was to use sum({TotalTime}+{DoorOpen}) where total time is the variable for running total in seconds and door open is the most recent time in seconds. DoorOpen works perfect. What am I doing wrong?


#2

Never mind the wiki helps. Should be a comma instead of plus sign.


#3

That works, or you can make the expression:
Set variable {TotalTime} = TotalTime + DoorOpen

temp


#4

WCmore is right. Don’t use the ‘sum’.

{TotalTime} = TotalTime + DoorOpen

Example: If your TotalTime is already at 12, then you would get the following

{TotalTime (12)} = TotalTime(12) + DoorOpen(2) = {TotalTime (14)}

The next run:

{TotalTime (14)} = TotalTime(14) + DoorOpen(3) = {TotalTime (17)}

You want to keep adding the ‘DoorOpen’ time to the ‘TotalTime’


#5

Wondering if you folks can help me out with something else in this piston. It’s the same piston but questioning if I’m using the best method to set piston state. The middle part where it’s saying open closed works - in fact it all works, but slightly lags. Don’t expect it to be instant but wondering if it’s the normal lag to be expected or whether it’s due to my method.


#6

I think the Dashboard updates every ten seconds, but with “Piston States”, I usually notice an update a couple of seconds after the command is processed.