2016 May 15, 04:19 PM
OK cool.
Just for the record, here is a tested example plugin that runs a loop while any station is on:
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