From 47714a2df9515bf2be9a16387c0a135db2e28b33 Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Wed, 4 Nov 2020 10:13:32 -0500 Subject: [PATCH] allow the property identifier in commands to be just an integer, it was inconsistent in the samples --- samples/Discover.py | 2 ++ samples/HTTPServer.py | 2 ++ samples/ReadProperty.py | 2 ++ samples/ReadProperty25.py | 2 ++ samples/ReadPropertyAny.py | 2 ++ samples/ReadPropertyForeign.py | 2 ++ samples/ReadPropertyJSON.py | 2 ++ samples/ReadRange.py | 2 ++ samples/ReadWriteProperty.py | 2 ++ samples/VendorReadWriteProperty.py | 2 +- samples/WriteLightingCommand.py | 2 ++ samples/WriteSomething.py | 3 ++- 12 files changed, 23 insertions(+), 2 deletions(-) diff --git a/samples/Discover.py b/samples/Discover.py index af9d501b..ec0fda58 100644 --- a/samples/Discover.py +++ b/samples/Discover.py @@ -548,6 +548,8 @@ def do_rp(self, args): devid = int(devid) obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/HTTPServer.py b/samples/HTTPServer.py index 9fa32d01..6662cda6 100755 --- a/samples/HTTPServer.py +++ b/samples/HTTPServer.py @@ -131,6 +131,8 @@ def do_read(self, args): # implement a default property, the bain of committee meetings if len(args) == 3: prop_id = args[2] + if prop_id.isdigit(): + prop_id = int(prop_id) else: prop_id = "presentValue" diff --git a/samples/ReadProperty.py b/samples/ReadProperty.py index fc031620..b636577f 100755 --- a/samples/ReadProperty.py +++ b/samples/ReadProperty.py @@ -43,6 +43,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/ReadProperty25.py b/samples/ReadProperty25.py index 56eb40be..62377858 100755 --- a/samples/ReadProperty25.py +++ b/samples/ReadProperty25.py @@ -46,6 +46,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/ReadPropertyAny.py b/samples/ReadPropertyAny.py index c429c8fd..5fb37acb 100755 --- a/samples/ReadPropertyAny.py +++ b/samples/ReadPropertyAny.py @@ -48,6 +48,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) # build a request request = ReadPropertyRequest( diff --git a/samples/ReadPropertyForeign.py b/samples/ReadPropertyForeign.py index 513c74f7..8ed571c7 100755 --- a/samples/ReadPropertyForeign.py +++ b/samples/ReadPropertyForeign.py @@ -57,6 +57,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/ReadPropertyJSON.py b/samples/ReadPropertyJSON.py index 0d240585..d5d3b971 100644 --- a/samples/ReadPropertyJSON.py +++ b/samples/ReadPropertyJSON.py @@ -51,6 +51,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/ReadRange.py b/samples/ReadRange.py index 54fb1542..cc537113 100755 --- a/samples/ReadRange.py +++ b/samples/ReadRange.py @@ -60,6 +60,8 @@ def do_readrange(self, args): addr = Address(args.pop(0)) obj_id = ObjectIdentifier(args.pop(0)).value prop_id = args.pop(0) + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/ReadWriteProperty.py b/samples/ReadWriteProperty.py index 7ee7d177..5dd2d3d5 100755 --- a/samples/ReadWriteProperty.py +++ b/samples/ReadWriteProperty.py @@ -51,6 +51,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/VendorReadWriteProperty.py b/samples/VendorReadWriteProperty.py index 91154685..ae440843 100755 --- a/samples/VendorReadWriteProperty.py +++ b/samples/VendorReadWriteProperty.py @@ -51,9 +51,9 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value - if prop_id.isdigit(): prop_id = int(prop_id) + if _debug: ReadWritePropertyConsoleCmd._debug(" - prop_id: %r", prop_id) datatype = get_datatype(obj_id[0], prop_id, VendorAVObject.vendor_id) diff --git a/samples/WriteLightingCommand.py b/samples/WriteLightingCommand.py index 51708be1..a616756e 100755 --- a/samples/WriteLightingCommand.py +++ b/samples/WriteLightingCommand.py @@ -52,6 +52,8 @@ def do_read(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value + if prop_id.isdigit(): + prop_id = int(prop_id) datatype = get_datatype(obj_id[0], prop_id) if not datatype: diff --git a/samples/WriteSomething.py b/samples/WriteSomething.py index df66a18a..67163a3a 100755 --- a/samples/WriteSomething.py +++ b/samples/WriteSomething.py @@ -47,7 +47,8 @@ def do_write(self, args): try: addr, obj_id, prop_id = args[:3] obj_id = ObjectIdentifier(obj_id).value - prop_id = int(prop_id) + if prop_id.isdigit(): + prop_id = int(prop_id) # build a request request = WritePropertyRequest(