Esempio n. 1
0
	def load(self):
		main_words.register_statement(PWMHandler)
		main_words.register_statement(PWMUpdate)
		main_words.register_statement(PWMSet)
		main_words.register_statement(VarPWMHandler)
		register_condition(PWMs.exists)
		register_condition(OnPWMCheck)
Esempio n. 2
0
 def load(self):
     main_words.register_statement(OnEventHandler)
     OnEventHandler.register_statement(OnPrio)
     main_words.register_statement(OnSkip)
     OnEventHandler.register_statement(OnName)
     OnEventHandler.register_statement(OnDoc)
     register_condition(OnHandlers.exists)
Esempio n. 3
0
	def load(self):
		main_words.register_statement(TimeslotHandler)
		main_words.register_statement(TimeslotUpdate)
		main_words.register_statement(TimeslotStart)
		main_words.register_statement(TimeslotStop)
		main_words.register_statement(VarTimeslotHandler)
		register_condition(RunningTimeslotCheck)
		register_condition(DuringTimeslotCheck)
Esempio n. 4
0
	def load(self):
		main_words.register_statement(AMQPconn)
		main_words.register_statement(AMQPstart)
		main_words.register_statement(AMQPstop)
		main_words.register_statement(AMQPlog)
		main_words.register_statement(AMQPtell)
		main_words.register_statement(AMQPlisten)
		register_condition(AMQPclients.exists)
Esempio n. 5
0
	def load(self):
		main_words.register_statement(MonitorMaker)
		main_words.register_statement(MonitorHandler)
		main_words.register_statement(MonitorUpdate)
		main_words.register_statement(MonitorSet)
		main_words.register_statement(MonitorStart)
		main_words.register_statement(MonitorStop)
		main_words.register_statement(VarMonitorHandler)
		register_condition(RunningMonitorCheck)
		register_condition(WaitingMonitorCheck)
Esempio n. 6
0
	def load(self):
		main_words.register_statement(OWFSconnect)
		main_words.register_statement(OWFSdisconnect)
		main_words.register_statement(OWFSdir)
		main_words.register_statement(OWFSscan)
		main_words.register_statement(OWFSset)
		main_words.register_statement(OWFSmonitor)
		register_input(OWFSinput)
		register_output(OWFSoutput)
		register_condition(OWFSconnected)
		register_condition(OWFSconnectedbus)
Esempio n. 7
0
	def load(self):
		mlen=0
		for v in globals().itervalues():
			m = getattr(v,"mode",None)
			if m is None: continue
			modes[m] = v
			if mlen < len(m): mlen = len(m)
		for v in modes.itervalues():
			AvgHandler.long_doc += v.mode+" "*(mlen-len(v.mode)+1)+v.doc+"\n"

		main_words.register_statement(AvgHandler)
		main_words.register_statement(AvgSet)
		main_words.register_statement(AvgReset)
		main_words.register_statement(VarAvgHandler)
		register_condition(Avgs.exists)
Esempio n. 8
0
	def load(self):
		main_words.register_statement(RRDconnect)
		main_words.register_statement(RRDsetfile)
		main_words.register_statement(RRDset)
		register_condition(RRDconnected)
		register_condition(RRDchannels.exists)
		register_condition(RRDservers.exists)
		register_condition(RRDfiles.exists)
Esempio n. 9
0
	def load(self):
		main_words.register_statement(NETlisten)
		main_words.register_statement(NETconnect)
		main_words.register_statement(NETsend)
		register_condition(Nets.exists)
		register_condition(NetListens.exists)
		register_condition(NETconnected)
Esempio n. 10
0
 def load(self):
     main_words.register_statement(FS20switches)
     main_words.register_statement(FS20send)
     register_condition(SwitchGroups.exists)
     register_condition(Switches.exists)
Esempio n. 11
0
	def load(self):
		PREFIX[PREFIX_ENERGY] = en_handler()
		main_words.register_statement(FS20en)
		main_words.register_statement(FS20enVal)
		register_condition(ENs.exists)
Esempio n. 12
0
File: rrd.py Progetto: pombreda/MoaT
	def load(self):
		main_words.register_statement(RRDHandler)
		main_words.register_statement(RRDset)
		main_words.register_statement(VarRRDHandler)
		register_condition(RRDs.exists)
Esempio n. 13
0
	def load(self):
		PREFIX[PREFIX_TX] = tx_handler()
		main_words.register_statement(FS20tx)
		main_words.register_statement(FS20txVal)
		register_condition(TXs.exists)
Esempio n. 14
0
	def load(self):
		register_condition(TrueCheck)
		register_condition(FalseCheck)
		register_condition(NoneCheck)
		register_condition(EqualCheck)
		register_condition(LessCheck)
		register_condition(GreaterCheck)
Esempio n. 15
0
from homevent.collect import Collection,Collected
from homevent.check import register_condition

from gevent.event import Event as gEvent
from gevent.queue import Channel,Queue
import gevent

from time import time
import os,sys
import datetime as dt

class Monitors(Collection):
	name = "monitor"
Monitors = Monitors()
Monitors.does("del")
register_condition(Monitors.exists)

class MonitorAgain(RuntimeError):
	"""The monitor is not ready yet; retry please"""
	pass

class MonitorError(RuntimeError):
	def __init__(self,w):
		self.monitor = w
	def __str__(self):
		return self.text % (" ".join(str(x) for x in self.monitor.name),)
	def __unicode__(self):
		return self.text % (" ".join(unicode(x) for x in self.monitor.name),)

class DupMonitorError(MonitorError):
	text = u"A monitor ‹%s› already exists"
Esempio n. 16
0
	def load(self):
		PREFIX[PREFIX_EM] = em_handler()
		PREFIX[PREFIX_EM2] = em2_handler()
		main_words.register_statement(FS20em)
		main_words.register_statement(FS20emVal)
		register_condition(EMs.exists)
Esempio n. 17
0
 def load(self):
     register_condition(ExistsPathCheck)
     register_condition(ExistsFileCheck)
     register_condition(ExistsDirCheck)
Esempio n. 18
0
File: rpc.py Progetto: pombreda/MoaT
	def load(self):
		main_words.register_statement(RPClisten)
		register_condition(RPCconns.exists)
		register_condition(RPCservers.exists)
Esempio n. 19
0
	def load(self):
		main_words.register_statement(SSHlisten)
		main_words.register_statement(SSHauth)
		main_words.register_statement(SSHdir)
		register_condition(AuthKeys.exists)
Esempio n. 20
0
from homevent.check import register_condition
from homevent.delay import DelayFor,DelayWhile,DelayUntil,DelayNext, DelayCancelled

import gevent
from gevent.event import AsyncResult

import os
import sys
import socket
import errno

class Inputs(Collection):
	name = "input"
Inputs = Inputs()
Inputs.does("del")
register_condition(Inputs.exists)

class Outputs(Collection):
	name = "output"
Outputs = Outputs()
Outputs.does("del")
register_condition(Outputs.exists)

class BadValue(RuntimeError):
	"""The input doesn't match the expected values"""
	def __init__(self, inp,val):
		self.inp = inp
		self.val = val
	def __str__(self):
		return "BadValue: read %s: bad value for %s" % (self.val,self.inp)
	
Esempio n. 21
0
def par(_): return os.path.join(os.pardir,_)
#if os.path.exists("modules"):
#	ModuleDirs.append("modules")
#elif os.path.exists(par("modules")) and os.path.exists(par("Makefile")):
#	ModuleDirs.append(par("modules"))

class ModuleExistsError(RuntimeError):
	"""A module with that name already exists."""
	pass

class Modules(Collection):
	name = "module"
	prio = 99
Modules = Modules()
Modules.does("del")
register_condition(Modules.exists)

class Module(Collected):
	"""\
		This is a loadable module. See homevent.config.py, the
		"Loader" and "Unloader" classes, for examples.
		"""

	name = "Module"
	storage = Modules.storage
	info = "some idiot programmer forgot to override me"
	path = None

	def __init__(self, *name):
		"""\
			Initialize a module. The arguments are passed in from the 
Esempio n. 22
0
	def load(self):
		main_words.register_statement(AVRconnect)
		main_words.register_statement(AVRsend)
		register_condition(AVRs.exists)
		register_condition(AVRconnected)
Esempio n. 23
0
		flags |= OWFlag.busret
		# flags |= 1<<8 ## ?
		flags |= OWtempformat.celsius << OWtempformat._offset
		flags |= OWdevformat.fdi << OWdevformat._offset

		log("onewire",DEBUG,"SEND", 0, len(data), typ, flags, rlen, 0, repr(data))
		self.write(struct.pack("!6i", \
			0, len(data), typ, flags, rlen, 0) +data)


class OWchans(Collection):
       name = "onewire connection"
OWchans = OWchans()
OWchans.does("del")
OWchans2 = {}
register_condition(OWchans.exists)

class OWFSchannel(OWFSassembler, NetActiveConnector):
	"""A receiver for the protocol used by OWFS."""
	storage = OWchans.storage
	storage2 = OWchans2
	typ = "onewire"

	def down_event(self, external=False):
		simple_event("onewire","disconnect",*self.name)

	def up_event(self, external=False):
		simple_event("onewire","connect",*self.name)

	def not_up_event(self, external=False):
		simple_event("onewire","error",*self.name)
Esempio n. 24
0
from homevent.base import Name
from homevent.twist import callLater, fix_exception
from homevent.context import Context
from homevent.check import register_condition
from homevent.logging import log,TRACE,DEBUG,ERROR
from homevent.collect import Collection,Collected

from time import time
import os
import datetime as dt

class Timeslots(Collection):
    name = "timeslot"
Timeslots = Timeslots()
Timeslots.does("del")
register_condition(Timeslots.exists)

class Timeslotted(object):
	pass
#	def slot_up(self):
#		pass
#	def slot_down(self):
#		pass

class TimeslotError(RuntimeError):
    def __init__(self,w):
        self.timeslot = w
    def __str__(self):
        return self.text % (" ".join(str(x) for x in self.timeslot.name),)
    def __unicode__(self):
        return self.text % (" ".join(unicode(x) for x in self.timeslot.name),)
Esempio n. 25
0
	def load(self):
		main_words.register_statement(LogHandler)
		main_words.register_statement(LogLevelHandler)
		register_condition(Loggers.exists)
Esempio n. 26
0
	def load(self):
		main_words.register_statement(WaitHandler)
		main_words.register_statement(VarWaitHandler)
		register_condition(Waiters.exists)