def specific_action(self, action = "disarm"): if action.lower() == "arm_away": action_id = 3 elif action.lower() == "arm_home": action_id = 2 elif action.lower() == "disarm": action_id = 1 elif action.lower() == "arm_latchkey": action_id = 4 elif action.lower() == "arm_partition": action_id = 5 elif action.lower() == "arm_quick": action_id = 6 elif action.lower() == "arm_home_quick": action_id = 7 elif action.lower() == "arm_instant": action_id = 8 #elif action.lower() == "check_code": # action_id = 9 else: print "Wrong event was specified for TAG" sys.exit(0) pkt = SPC.device_cmd(self.serial, self.short_id, 4, 69, chr(self.bin_partitions) + chr(action_id) + self.bin_user_code) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'arm_away' )
def tag_action(self, tag_id=0, action="away" ''',part_bitmap=0'''): action_id = 3 if action.lower() == "away": action_id = 3 elif action.lower() == "home": action_id = 2 elif action.lower() == "disarm": action_id = 1 elif action.lower() == "away_latchkey": action_id = 4 elif action.lower() == "arm_part": action_id = 5 elif action.lower() == "quick_away": action_id = 6 elif action.lower() == "quick_home": action_id = 7 elif action.lower() == "arm_instant": action_id = 8 elif action.lower() == "check_code": action_id = 9 else: print "Wrong event was specified for TAG" sys.exit(0) packet = SPC.device_cmd(self.serial, self.short_id, 4, 73, chr(self.bin_partitions) + chr(action_id) + '\x28\x00\x00\x00\x00' + chr(tag_id) + '\x00\x00\x00') packet_f2 = SPC.make_packet( 0xF2, 9, packet ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'tag_action={0}'.format(action) )
def set_temperature(self, iTemperature = -40.0): # Temperature: 0x00 - out of range (low) # 0xFC - out of range (high) # 0x01 = -40.0, 0x02 = -39.5, 0x03 = -39.0, ... , oxFA = +84.5, 0xFB = +85.0 TempHex = 0 iTemperature = float(iTemperature) if (iTemperature > 85.0): TempHex = 0xFC elif (iTemperature >= -40.0): TempHex = int(((iTemperature + 40.0) * 2) + 1) pkt = SPC.device_cmd(self.serial, self.short_id, 5, 24, chr(TempHex)) #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'set_temperature={0}'.format(iTemperature) )
def violate(self): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 1, chr(2)) # Passive Motion ? #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'violate' )
def freezer_trouble(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 34, chr(IsOpen)) send_host_cmd(pkt)
def probe(self, IsOpen=1): # ? pkt = SPC.device_cmd(self.serial, self.short_id, 5, 50, chr(IsOpen)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'probe={0}'.format(IsOpen) )
def hello(self): #Seems to be Keep-alive message pkt_ka = SPC.device_cmd(self.serial, self.short_id, 5, 64, chr(0)) #send_host_cmd(pkt_ka) packet_f2 = SPC.make_packet( 0xF2, 9, pkt_ka ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'hello ka' )
def hot(self, IsOpen=1): # > 28(35) pkt = SPC.device_cmd(self.serial, self.short_id, 5, 24, chr(self.aTemp[int(not(IsOpen))])) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'hot={0}'.format(IsOpen) )
def aux_button(self): pkt = SPC.device_cmd(self.serial, self.short_id, 4, 74, chr(1)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'aux_button' )
def enable_partitions(self): pkt = SPC.device_cmd(self.serial, self.short_id, 4, 118, chr(self.h_partitions)) #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'enable_partitions' )
def fire(self): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 34, chr(1)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'fire' )
def panic(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 33, chr(IsOpen)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'panic' )
def clean_me(self): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 10, chr(2)) #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'clean_me' )
def supervision(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 116, chr(IsOpen)) #ser_old.send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'supervision={0}'.format(IsOpen) )
def aux(self, IsOpen=1): bMask = 0xFF * IsOpen #Open all 8 auxilary inputs, according to mask 0b11111111 = 0xFF pkt = SPC.device_cmd(self.serial, self.short_id, 5, 17, chr(bMask)) # Magnet with Auxiliary Input #ser_old.send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'aux={0}'.format(IsOpen) )
def smoke_trouble(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 46, chr(IsOpen)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'smoke_trouble={0}'.format(IsOpen) )
def open(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 8, chr(IsOpen)) # Switch / Magnetic #pkt = '\x29\x30\x0B\x04\xF8\x00\x4A\xED\x04\x88\x23\xF9\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0B\xE4\x00\x2D\x02\x00\x00\x05\x03\x08\x01\x01\x7F\x0A' packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'open/close={0}'.format(IsOpen) )
def disarm(self): pkt = SPC.device_cmd(self.serial, self.short_id, 4, 69, chr(self.bin_partitions)+'\x01'+self.bin_user_code) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'disarm' )
def glass_break(self): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 6, chr(2)) # Glass Break #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'glass_break' )
def emergency(self): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 35, chr(1)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'emergency' )
def trouble(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 51, chr(IsOpen)) # CO Sensor Trouble #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'trouble={0}'.format(IsOpen) )
def flood(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 16, chr(IsOpen)) #send_host_cmd(pkt) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'gas_alert={0}'.format(IsOpen) )
def cold(self, IsOpen=1): # < 19 pkt = SPC.device_cmd(self.serial, self.short_id, 5, 24, chr(self.aTemp[IsOpen])) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'cold={0}'.format(IsOpen) )
def jamming(self, IsOpen=1): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 48, chr(IsOpen)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'jamming={0}'.format(IsOpen) )
def update(self): pkt = SPC.device_cmd(self.serial, self.short_id, 5, 253, chr(0)) packet_f2 = SPC.make_packet( 0xF2, 9, pkt ) # F2 protocol packet self.SendPacketTo_PortOrFile( packet_f2, 'update={0}'.format(1) )