UniversalDevicesInc / Polyglot

Polyglot Open Source
MIT License
24 stars 2 forks source link

How to handle a long integer? #45

Closed jimboca closed 7 years ago

jimboca commented 8 years ago

I am converting Camera IP addresses to long int's so I can store them in a single value on the ISY using uom=56. This shows properly in the Polyglot manifest shown here for GV2:

ihcam.log.2016-04-15:2016-04-15 10:58:10,852 DEBUG    ihcam CameraServer:add_manifest_cams: address=000c5ddc9d6c data={u'drivers': {u'GV8': 8, u'GV9': 1, u'GV2': 3232235886L, u'GV3': 8080, u'GV1': 0.1, u'GV6': 1, u'GV7': 0, u'GV4': 1, u'GV5': 1}, u'node_def_id': u'FoscamMJPEG', u'name': u'CameraFrontDoor', u'added': False}

and querying the node shows

DEBUG    [04-16-2016 15:26:35] requests.packages.urllib3.connectionpool: "GET /rest/ns/3/nodes/n003_000c5ddc9d6c/report/status/GV2/3232235886/56 HTTP/1.1" 200 0
INFO     [04-16-2016 15:26:35] polyglot.element_manager.isy: ISY:        ( 0.03) 200  OK: http://192.168.1.64:80/rest/ns/3/nodes/n003_000c5ddc9d6c/report/status/GV2/3232235886/56

But the ISY admin console show it as 2147483647 which is the max signed int value. Is there a way we can define this so it will show up properly as a long int? and maybe in the future this could be a standard uom and the admin console can show the real ip address? :smiley:

cjudi commented 8 years ago

When string support is added for options, there will also be a 'style' that can be specified in the definition of the option (such as 'text', 'date', 'datetime', 'ip address', 'password', etc.) so that the ISY GUI will present the value appropriately to the user.

As for long integers, there is no plan yet to allow for integers greater than 4 bytes.

jimboca commented 8 years ago

@cjudi Thanks. What about a 4 byte unsigned int, which is actually what I really meant to ask for :smile:

Although with your explanation of how these values will be handled I think we don't need to worry about it.