def test_getValue_hex(self): pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 00") self.assertEqual(pdu.getValue("hex"), '00') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write a5") self.assertEqual(pdu.getValue("hex"), 'a5') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write ff") self.assertEqual(pdu.getValue("hex"), 'ff')
def test_getValue_time(self): pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write A6 0B 00") self.assertEqual(pdu.getValue("time"), 'fri 6:11:0') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B 20") self.assertEqual(pdu.getValue("time"), 'thu 0:27:32') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B") with self.assertRaises(KnxParseException): pdu.getValue("time")
def test_getValue_onoff(self): pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:07:30 2015:LPDU: BC 11 01 10 0E E1 00 80 2C :L_Data low from 1.1.1 to 2/0/14 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write (small) 00") self.assertEqual(pdu.getValue("onoff"), '0') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:07:30 2015:LPDU: BC 11 01 10 0E E1 00 80 2C :L_Data low from 1.1.1 to 2/0/14 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write (small) 01") self.assertEqual(pdu.getValue("onoff"), '1') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B 20") with self.assertRaises(KnxParseException): pdu.getValue("onoff")
def test_getValue_read(self): pdu = KnxPdu( self.devdict, self.groupdict, "Mon Aug 3 20:43:39 2015:LPDU: BC 11 01 12 01 E1 00 00 A1 :L_Data low from 1.1.1 to 2/2/1 hops: 06 T_DATA_XXX_REQ A_GroupValue_Read" ) self.assertEqual(pdu.getValue(""), '(read)')
def test_getValue_hex(self): pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 00" ) self.assertEqual(pdu.getValue("hex"), '00') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write a5" ) self.assertEqual(pdu.getValue("hex"), 'a5') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write ff" ) self.assertEqual(pdu.getValue("hex"), 'ff')
def test_getValue_onoff(self): pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:07:30 2015:LPDU: BC 11 01 10 0E E1 00 80 2C :L_Data low from 1.1.1 to 2/0/14 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write (small) 00" ) self.assertEqual(pdu.getValue("onoff"), '0') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:07:30 2015:LPDU: BC 11 01 10 0E E1 00 80 2C :L_Data low from 1.1.1 to 2/0/14 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write (small) 01" ) self.assertEqual(pdu.getValue("onoff"), '1') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B 20" ) with self.assertRaises(KnxParseException): pdu.getValue("onoff")
def test_getValue_time(self): pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write A6 0B 00" ) self.assertEqual(pdu.getValue("time"), 'fri 6:11:0') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B 20" ) self.assertEqual(pdu.getValue("time"), 'thu 0:27:32') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B" ) with self.assertRaises(KnxParseException): pdu.getValue("time")
def test_getValue_temp(self): pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 0C 83" ) self.assertEqual(pdu.getValue("temp"), '23.10') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 01 23" ) self.assertEqual(pdu.getValue("temp"), '2.91') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 0F ED" ) self.assertEqual(pdu.getValue("temp"), '40.58') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 8F ED" ) self.assertEqual(pdu.getValue("temp"), '-0.38') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 90 ED" ) self.assertEqual(pdu.getValue("temp"), '-72.44') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write FF ED" ) self.assertEqual(pdu.getValue("temp"), '-6225.92')
def test_getValue_prc(self): pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 00" ) self.assertEqual(pdu.getValue("%"), '0.00') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 5a" ) self.assertEqual(pdu.getValue("%"), '35.29') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write a5" ) self.assertEqual(pdu.getValue("%"), '64.71') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write ff" ) self.assertEqual(pdu.getValue("%"), '100.00') pdu = KnxPdu( self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B 20" ) with self.assertRaises(KnxParseException): pdu.getValue("%")
def test_getValue_prc(self): pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 00") self.assertEqual(pdu.getValue("%"), '0.00') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 5a") self.assertEqual(pdu.getValue("%"), '35.29') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write a5") self.assertEqual(pdu.getValue("%"), '64.71') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:15:03 2015:LPDU: BC 11 03 12 00 E2 00 80 00 21 :L_Data low from 1.1.3 to 2/2/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write ff") self.assertEqual(pdu.getValue("%"), '100.00') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:14:48 2015:LPDU: BC 11 01 1E 00 E4 00 80 A6 0B 00 84 :L_Data low from 1.1.1 to 3/6/0 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 80 1B 20") with self.assertRaises(KnxParseException): pdu.getValue("%")
def test_getValue_temp(self): pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 0C 83") self.assertEqual(pdu.getValue("temp"), '23.10') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 01 23") self.assertEqual(pdu.getValue("temp"), '2.91') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 0F ED") self.assertEqual(pdu.getValue("temp"), '40.58') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 8F ED") self.assertEqual(pdu.getValue("temp"), '-0.38') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write 90 ED") self.assertEqual(pdu.getValue("temp"), '-72.44') pdu = KnxPdu(self.devdict, self.groupdict, "Fri Sep 4 06:19:47 2015:LPDU: BC 11 1B 03 03 E3 00 80 0C 83 A5 :L_Data low from 1.1.27 to 0/3/3 hops: 06 T_DATA_XXX_REQ A_GroupValue_Write FF ED") self.assertEqual(pdu.getValue("temp"), '-6225.92')
def test_getValue_read(self): pdu = KnxPdu(self.devdict, self.groupdict, "Mon Aug 3 20:43:39 2015:LPDU: BC 11 01 12 01 E1 00 00 A1 :L_Data low from 1.1.1 to 2/2/1 hops: 06 T_DATA_XXX_REQ A_GroupValue_Read") self.assertEqual(pdu.getValue(""), '(read)')