Esempio n. 1
0
    def setRampRateOn(self, level=0xFF, rate=0x1f):
        """setRampRateOn(level, rate)
		set future ramp rate and switch on to level (0-255) at rate (0-31)"""
        cmd2 = (level & 0xf0) | ((rate & 0x1f) >> 1)
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x2e,
                                 cmd2, -1))
Esempio n. 2
0
    def setRampRateOff(self, rate=0x1f):
        """setRampRateOff(rate)
		set future ramp rate and switch off at rate (0-31)"""
        cmd2 = (rate & 0x1f) >> 1
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x2f,
                                 cmd2, -1))
 def processMsg(self, msg):
     tmp = msg.getByte("command1") & 0xFF
     if (tmp != 0x2e):
         out(self.name + " got unexpected msg: " + msg.toString())
         return 0
     if msg.isExtended():
         out(self.name + " existing schedule:")
         printScheduleMsg(msg)
         idx = 3 * self.period
         data = message.getMsgData(msg)
         data = [(data[k] & 0xFF) for k in range(len(data))]
         data[idx] = self.time & 0xFF
         data[idx + 1] = self.cool & 0xFF
         data[idx + 2] = self.heat & 0xFF
         nmsg = message.createExtendedMsg2(
             InsteonAddress(self.thermostat.address), 0x2e,
             (0x03 + self.day) & 0xFF, data)
         out(self.name + " new schedule:")
         printScheduleMsg(nmsg)
         iofun.writeMsg(nmsg)
         out(self.name + " sent new schedule: " + nmsg.toString())
         return 1
     else:
         out(self.name + " got ack, waiting for ext msg!")
         return 0
 def processMsg(self, msg):
     tmp = msg.getByte("command1") & 0xFF
     if tmp != 0x2E:
         out(self.name + " got unexpected msg: " + msg.toString())
         return 0
     if msg.isExtended():
         out(self.name + " existing schedule:")
         printScheduleMsg(msg)
         idx = 3 * self.period
         data = message.getMsgData(msg)
         data = [(data[k] & 0xFF) for k in range(len(data))]
         data[idx] = self.time & 0xFF
         data[idx + 1] = self.cool & 0xFF
         data[idx + 2] = self.heat & 0xFF
         nmsg = message.createExtendedMsg2(
             InsteonAddress(self.thermostat.address), 0x2E, (0x03 + self.day) & 0xFF, data
         )
         out(self.name + " new schedule:")
         printScheduleMsg(nmsg)
         iofun.writeMsg(nmsg)
         out(self.name + " sent new schedule: " + nmsg.toString())
         return 1
     else:
         out(self.name + " got ack, waiting for ext msg!")
         return 0
Esempio n. 5
0
	def sendOff(self, group):
		"""sendOff(group)
		sends ALLLink broadcast OFF message to group "group" """
		msg = message.createStdMsg(InsteonAddress("00.00.00"), 0x0f,
									0x13, 0xFF, group)
		iofun.writeMsg(msg)
		iofun.out("sent msg: " + msg.toString())
Esempio n. 6
0
    def sendOff(self, group):
        """sendOff(group)
		sends ALLLink broadcast OFF message to group "group" """
        msg = message.createStdMsg(InsteonAddress("00.00.00"), 0x0f, 0x13,
                                   0xFF, group)
        iofun.writeMsg(msg)
        iofun.out("sent msg: " + msg.toString())
	def sendMsg(self, msg):
		self.started()
		iofun.addListener(self)
		if self.timer:
			self.timer.cancel()
		self.timer = Timer(5.0, self.giveUp)
		self.timer.start()
		iofun.writeMsg(msg)
		out("sent msg: " + msg.toString())
 def __bcast(self, group, cmd1, cmd2):
     msg = Msg.s_makeMessage("SendStandardMessage")
     flags = 0xCF
     adr = InsteonAddress(0x00, 0x00, group & 0xFF)
     msg.setAddress("toAddress", adr)
     msg.setByte("messageFlags", flags)
     msg.setByte("command1", cmd1)
     msg.setByte("command2", cmd2)
     iofun.writeMsg(msg)
 def __bcast(self, group, cmd1, cmd2):
     msg = Msg.s_makeMessage("SendStandardMessage")
     flags = 0xcf
     adr = InsteonAddress(0x00, 0x00, group & 0xFF)
     msg.setAddress("toAddress", adr)
     msg.setByte("messageFlags", flags)
     msg.setByte("command1", cmd1)
     msg.setByte("command2", cmd2)
     iofun.writeMsg(msg)
Esempio n. 10
0
 def msgReceived(self, msg):
     if msg.isPureNack():
         return
     if msg.getByte("Cmd") == 0x69 or msg.getByte("Cmd") == 0x6a:
         if msg.getByte("ACK/NACK") == 0x15:
             self.done()
     elif msg.getByte("Cmd") == 0x57:
         self.dbMsg(msg)
         iofun.writeMsg(Msg.s_makeMessage("GetNextALLLinkRecord"))
     else:
         out("got unexpected msg: " + msg.toString())
Esempio n. 11
0
	def msgReceived(self, msg):
		if msg.isPureNack():
			return;
		if msg.getByte("Cmd") == 0x69 or msg.getByte("Cmd") == 0x6a :
			if msg.getByte("ACK/NACK") == 0x15:
				self.done()
		elif msg.getByte("Cmd") == 0x57:
			self.dbMsg(msg)
			iofun.writeMsg(Msg.s_makeMessage("GetNextALLLinkRecord"))
		else:
			out("got unexpected msg: " + msg.toString())
Esempio n. 12
0
	def start(self):
		self.db.clear()
		iofun.addListener(self)
		msg = message.createExtendedMsg(InsteonAddress(self.addr), 0x2f, 0, [])
		msg.setByte("userData1", 0);
		msg.setByte("userData2", 0);
		msg.setByte("userData3", 0);
		msg.setByte("userData4", 0);
		msg.setByte("userData5", 0);
		iofun.writeMsg(msg)
		outchars("sent db query msg, incoming records: ")
		self.timer = Timer(20.0, self.giveUp)
		self.timer.start()
Esempio n. 13
0
 def start(self):
     self.db.clear()
     iofun.addListener(self)
     msg = message.createExtendedMsg(InsteonAddress(self.addr), 0x2f, 0, [])
     msg.setByte("userData1", 0)
     msg.setByte("userData2", 0)
     msg.setByte("userData3", 0)
     msg.setByte("userData4", 0)
     msg.setByte("userData5", 0)
     iofun.writeMsg(msg)
     outchars("sent db query msg, incoming records: ")
     self.timer = Timer(20.0, self.giveUp)
     self.timer.start()
Esempio n. 14
0
    def instantOn(self, level):
        """instantOn(level)
		switch on instantly to level"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x21,
                                 level, -1))
Esempio n. 15
0
    def fastOff(self):
        """fastOff()
		switch off immediately"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x14,
                                 0, -1))
def writeMsg(msg):
    iofun.writeMsg(msg)
Esempio n. 17
0
	def incrementalBright(self):
		"""incrementalBright()
		brighten light incrementally"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x15, 0x00, -1))
Esempio n. 18
0
	def onFast(self, level=0xFF):
		"""onFast(level)
		switch light on fast, to given level"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x12, level, -1))
Esempio n. 19
0
	def off(self):
		"""off()
		switch off"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x13, 0x00, -1))
Esempio n. 20
0
	def rampRateOn(self, level=0xFF, rate = 0x1f):
		"""rampRateOn(level, rate)
		switch on to given light level (0-255) at given rate (0-31)"""
		cmd2 = (level & 0xf0) | ((rate & 0x1f) >> 1);
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x2e, cmd2, -1))
Esempio n. 21
0
	def startManualChangeDown(self):
		"""startManualChangeDown()
		start manual change, dim down"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x17, 0x00, -1))
Esempio n. 22
0
    def getDDBCount(self):
        """getDDBCount()
		Data Base Delta flag gets incremented with any change in the Database """
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x1F,
                                 0x01, -1))
Esempio n. 23
0
	def start(self):
		self.db.clear()
		self.keepRunning = True
		iofun.addListener(self)
		iofun.writeMsg(Msg.s_makeMessage("GetFirstALLLinkRecord"))
 def __sendMsg(self, msg):
     iofun.writeMsg(msg)
     out("sent msg: " + msg.toString())
Esempio n. 25
0
 def start(self):
     self.db.clear()
     self.keepRunning = True
     iofun.addListener(self)
     iofun.writeMsg(Msg.s_makeMessage("GetFirstALLLinkRecord"))
Esempio n. 26
0
    def instantOff(self):
        """instantOff()
		switch off instantly"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x21,
                                 0, -1))
Esempio n. 27
0
    def getFlags(self):
        """getFlags()
		Reads and displays operating flags"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x1F,
                                 0x00, -1))
Esempio n. 28
0
	def on(self, level=0xFF):
		"""on(level)
		switch on to given light level"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x11, level, -1))
Esempio n. 29
0
	def instantOff(self):
		"""instantOff()
		switch off instantly"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x21, 0, -1))
Esempio n. 30
0
	def rampRateOff(self, rate = 0x1f):
		"""rampRateOff(rate)
		switch off at rate (0-31)"""
		cmd2 = (rate & 0x1f) >> 1
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x2f, cmd2, -1))
Esempio n. 31
0
    def onFast(self, level=0xFF):
        """onFast(level)
		switch light on fast, to given level"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x12,
                                 level, -1))
Esempio n. 32
0
	def beep(self):
		"""beep()
		make device beep"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x30, 0x00, -1))
Esempio n. 33
0
	def instantOn(self, level):
		"""instantOn(level)
		switch on instantly to level"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x21, level, -1))
Esempio n. 34
0
	def offFast(self):
		"""offFast()
		switch light off fast"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x14, 0x00, -1))
Esempio n. 35
0
	def fastOn(self, level):
		"""fastOn(level)
		switch immediately to level"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x12, level, -1))
Esempio n. 36
0
	def incrementalDim(self):
		"""incrementalDim()
		dim light incrementally"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x16, 0x00, -1))
    def beep(self):
        """beep()
		sends beep command to the device"""
        msg = message.createStdMsg(InsteonAddress(self.address), 0x0f, 0x30,
                                   0x00, -1)
        iofun.writeMsg(msg)
Esempio n. 38
0
	def stopManualChange(self):
		"""stopManualChange()
		stop manual change"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x18, 0x00, -1))
def writeMsg(msg):
	iofun.writeMsg(msg)
 def __sendMsg(self, msg):
     iofun.writeMsg(msg)
     out("sent msg: " + msg.toString())
Esempio n. 41
0
    def incrementalBright(self):
        """incrementalBright()
		brighten light incrementally"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x15,
                                 0x00, -1))
    def beep(self):
        """beep()
		sends beep command to the device"""
        msg = message.createStdMsg(InsteonAddress(self.address), 0x0F, 0x30, 0x00, -1)
        iofun.writeMsg(msg)
Esempio n. 43
0
    def startManualChangeDown(self):
        """startManualChangeDown()
		start manual change, dim down"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x17,
                                 0x00, -1))
Esempio n. 44
0
    def offFast(self):
        """offFast()
		switch light off fast"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x14,
                                 0x00, -1))
Esempio n. 45
0
	def fastOff(self):
		"""fastOff()
		switch off immediately"""
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x14, 0, -1))
Esempio n. 46
0
    def incrementalDim(self):
        """incrementalDim()
		dim light incrementally"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x16,
                                 0x00, -1))
Esempio n. 47
0
    def fastOn(self, level):
        """fastOn(level)
		switch immediately to level"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x12,
                                 level, -1))
Esempio n. 48
0
    def stopManualChange(self):
        """stopManualChange()
		stop manual change"""
        iofun.writeMsg(
            message.createStdMsg(InsteonAddress(self.getAddress()), 0x0F, 0x18,
                                 0x00, -1))
Esempio n. 49
0
	def setRampRateOn(self, level=0xFF, rate = 0x1f):
		"""setRampRateOn(level, rate)
		set future ramp rate and switch on to level (0-255) at rate (0-31)"""
		cmd2 = (level & 0xf0) | ((rate & 0x1f) >> 1);
		iofun.writeMsg(message.createStdMsg(
			InsteonAddress(self.getAddress()), 0x0F, 0x2e, cmd2, -1))