Announcement

Collapse
No announcement yet.

Dealing with timers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dealing with timers

    I am doing some work with energy management which involves timing how long devices are on or off. At midnight, I need to do some housekeeping with timers and don't know how to do some things. In all cases, the target timer already exists and does not need to be created.

    1. I need to take 'current day' timer and copy it to a 'yesterday' timer.
    2. Will need to add one timer to another timer's existing value

    I've looked and searched and have not found a way to do these things with events rather than a script.

    Any ideas?

    Robert

    #2
    Originally posted by logbuilder View Post
    I am doing some work with energy management which involves timing how long devices are on or off. At midnight, I need to do some housekeeping with timers and don't know how to do some things. In all cases, the target timer already exists and does not need to be created.

    1. I need to take 'current day' timer and copy it to a 'yesterday' timer.
    2. Will need to add one timer to another timer's existing value

    I've looked and searched and have not found a way to do these things with events rather than a script.

    Any ideas?

    Robert
    I don't think you can add a timer to another timer using an event or script. But you can use an Event to add two timers together using an immediate script and then store that in a counter.

    Let's say you create a counter with device reference 111, and your timers are devices 222 and 333, then you would create a simple event which has an Action to run a script. But you don't need a "full blown" scrip - just past a simple "Immediate" script. The following should work:

    &hs.setdevicevaluebyref(111,hs.devicevalue(222) +hs.devicevalue(333) ,True)

    Comment

    Working...
    X