Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check the status of a cistern when SIP zone is active
#6
OK cool.

Just for the record, here is a tested example plugin that runs a loop while any station is on:

Code:
# !/usr/bin/env python
#  This example plugin runs a loop function while any station is on.

from blinker import signal
import gv
from time import sleep
import thread

running = False

def loop():
   global running
   while running:
       print "station running"
       print gv.srvals
       sleep(1)

### any station on ###
def check_running(name, **kw):
   global running
   running = any(gv.srvals) #  gv.srvals shows the state of the zones as a list with 1's for zones that are on an 0's for ones that are off.
   if running:
       thread.start_new_thread(loop, ())

zones = signal('zone_change')
zones.connect(check_running)

if __name__ == '__main__':
   pass
Reply


Messages In This Thread
RE: Check the status of a cistern when SIP zone is active - by dan - 2016 May 15, 04:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)