Jump to content

Error on Device Discovery - API change?


DaveStLou
Go to solution Solved by Goose66,

Recommended Posts

@Goose66, I reinstalled the PG3 Bond node server (v3.0.9) and I'm receiving the following error when I attempt to discover devices:

2022-08-03 12:42:24,292 Thread-155 udi_interface      DEBUG    bondapi:getDeviceList: in API getDeviceList()...
2022-08-03 12:42:24,470 Thread-155 udi_interface      WARNING  bondapi:_call_api: HTTP GET in _call_api() failed: 404 Client Error: Not Found for url: http://10.42.8.89/v2/devices/__
2022-08-03 12:42:24,472 Thread-155 udi_interface      ERROR    udi_interface:write: Exception in thread
2022-08-03 12:42:24,472 Thread-155 udi_interface      ERROR    udi_interface:write: Thread-155
2022-08-03 12:42:24,473 Thread-155 udi_interface      ERROR    udi_interface:write: :
2022-08-03 12:42:24,474 Thread-155 udi_interface      ERROR    udi_interface:write: Traceback (most recent call last):
2022-08-03 12:42:24,474 Thread-155 udi_interface      ERROR    udi_interface:write: File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
2022-08-03 12:42:24,479 Thread-155 udi_interface      ERROR    udi_interface:write: self.run()
2022-08-03 12:42:24,480 Thread-155 udi_interface      ERROR    udi_interface:write: File "/usr/local/lib/python3.8/threading.py", line 870, in run
2022-08-03 12:42:24,483 Thread-155 udi_interface      ERROR    udi_interface:write: self._target(*self._args, **self._kwargs)
2022-08-03 12:42:24,484 Thread-155 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/00:0d:b9:52:bf:24_13/bondns/nslib.py", line 80, in _discover_handler
2022-08-03 12:42:24,486 Thread-155 udi_interface      ERROR    udi_interface:write: self.discover()
2022-08-03 12:42:24,487 Thread-155 udi_interface      ERROR    udi_interface:write: File "./bondns.py", line 226, in discover
2022-08-03 12:42:24,489 Thread-155 udi_interface      ERROR    udi_interface:write: bridge.discoverDevices()
2022-08-03 12:42:24,490 Thread-155 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/00:0d:b9:52:bf:24_13/bondns/nodes.py", line 102, in discoverDevices
2022-08-03 12:42:24,491 Thread-155 udi_interface      ERROR    udi_interface:write: devices = self.connection.getDeviceList()
2022-08-03 12:42:24,492 Thread-155 udi_interface      ERROR    udi_interface:write: File "/var/polyglot/pg3/ns/00:0d:b9:52:bf:24_13/bondns/bondapi.py", line 264, in getDeviceList
2022-08-03 12:42:24,495 Thread-155 udi_interface      ERROR    udi_interface:write: devInfo = response.json() # type: ignore
2022-08-03 12:42:24,496 Thread-155 udi_interface      ERROR    udi_interface:write: AttributeError
2022-08-03 12:42:24,496 Thread-155 udi_interface      ERROR    udi_interface:write: :
2022-08-03 12:42:24,497 Thread-155 udi_interface      ERROR    udi_interface:write: 'NoneType' object has no attribute 'json'

I tried loading the PG2 version of the Bond node sever and it has a similar API error on discovery so I wonder if the API has changed?

2022-08-03 12:44:26,788 Controller polyinterface      DEBUG    bondapi:getDeviceList: in API getDeviceList()...
2022-08-03 12:44:26,963 Controller polyinterface      WARNING  bondapi:_call_api: HTTP GET in _call_api() failed: 404 Client Error: Not Found for url: http://10.42.8.89/v2/devices/__
2022-08-03 12:44:26,965 Controller polyinterface      ERROR    polyinterface:_parseInput: _parseInput: failed controller.runCmd(DISCOVER) 'bool' object has no attribute 'json'
Traceback (most recent call last):
  File "/var/polyglot/.local/lib/python3.8/site-packages/polyinterface/polyinterface.py", line 842, in _parseInput
    self.nodes[input[key]['address']].runCmd(input[key])
  File "/var/polyglot/.local/lib/python3.8/site-packages/polyinterface/polyinterface.py", line 745, in runCmd
    fun(self, command)
  File "./bond-poly.py", line 1086, in cmd_discover
    self.discover()
  File "./bond-poly.py", line 1262, in discover
    bridge.discoverDevices()
  File "./bond-poly.py", line 820, in discoverDevices
    devices = self.bondBridge.getDeviceList()
  File "/var/polyglot/node servers/BondBridge/bondapi.py", line 224, in getDeviceList
    devInfo = response.json()
AttributeError: 'bool' object has no attribute 'json'

I doubt it's related, but the Discover button (in the PG3 version again) is showing this way:

image.png.fd317d7629af3d1d49ab847a854370f6.png

For the record, I've tried restarting the node server several times and restarting both polisy and isy as well as rebooting polisy entirely.

Edited by DaveStLou
Link to comment

I am seeing essentially the same error.  

I just loaded a new device in the bond app and tried to get the device node added to the node server.  When I execute the Discover the result is only the Bridge Node is added and none of the fans are added. 

I tried deleting the Bond PG3 and re-installing and it did not change anything.

The only thing different from when I did something similar about a month ago, is that the firmware was updated to v3.3.13 firmware via the Bond Bridge App.

Suggestions?

Link to comment

Sorry guys, my Bond Bridge, Polisy, and other equipment are all still packed up. I move into a townhome on August 20 and will have access to some of it, but permanently lose access to my iAquaLink pool controller, MyQ garage door openers, DSC Alarm panel and more. I'll see what I can do in September to address some of these issues.

  • Like 1
Link to comment

I have been working with the command line options for querying the Bond Bridge in an attempt to understand the errors in the log file.  Initially I was seeing a http 401 authentication error when the Discover command is issued.  Then today, after deleting the Bond PG3 Node server, re-installing and setting up the configuration settings (hostname and token), I saw a http 404 error.  I have been working with @Michel Kohanim  to assure that any valuable information was forwarded to the developer and that process was in motion.

As @DaveStLou had noted we were both seeing issues on v3.3.13 firmware.  Communications with Bond Support did not raise any issues with the v3.3.13 firmware, but in the back of my mind I was always wondering.

So this afternoon, I did factory reset the Bond Bridge.  This was a recommendation of the Bond Bridge Support team and the process to rollback the firmware to what it was when it was manufactured is as follows...

  • Do a backup of the Bond Bridge (click on Advanced in the Bridge on your phone app)
  • Remove power from the bond unit
  • Press and hold the reset switch located next to the USB cable connector
  • Restore power to the bond unit while holding the reset switch
  • Hold the reset switch until the ring flashes white (about 10 sec)... keep holding
  • Light ring will turn solid red (5 LEDs)
  • Release the reset switch
  • Once the ring returns to flashing green, proceed with setup. The bond firmware will be updated automatically

I was hoping that I would not have to reinstall the devices, but in my case doing a restore after the factory reset would not work.  It kept complaining that I am not on the same WiFi network as my Bond Bridge, but I was.  So, I re-added all the devices again in the Bond App.

After the factory reset, I noticed that my WiFI configuration was still in the app and the token for the Bond Bridge had not changed. 

  • Note, after the factor reset, my unit did not return to a flashing green... it returned to a flashing blue state, which perhaps reflects why the WiFi and other settings were still intact... your results might be different.  When I had a flashing green in the past I had to re-enter the WiFi setup.  I did not try to reset a 2nd time to see if I could get a flashing green, I just proceeded as I just didn't give it a thought at the time. 
  • After the reset, my firmware had returned to v2.22.6.  Yours might be different depending on when your unit was manufactured.
  • Also please check your token changes.   You will need to assure that data entry is correct in the Bond PG3 Node server Configuration settings

After all was said and done, I went back to the Bond PG3 Node server (I did not do a Restart, although I feel I probably should have).  Then power cycled the Bond Bridge to unlock and then performed a Discover.  Watching the log file as I did this, there were no errors and the devices started loading.

What is the interaction between the Bond PG3 Node server and the changes that were in the Bond Bridge v3.3.13 firmware?  I have no idea and perhaps @Goose66can comment when he gets a chance to look at what is going on.

At this point, all the nodes/devices are back in IoP.  Now, I just need to assure the programs are all clean.

I hope this works for everyone else that sees this same problem.  If you can get back operational,  be cautious about firmware updates.

  • Thanks 2
Link to comment

I did some testing from the Polisy command line using the Get Device Information as documented in the Bond API.

I was able to successfully get the device information and then the information on the connected devices.

My firmware is still on v3.3.13.

[admin@polisy ~]$ curl -H "BOND-Token: *REDACTED" -i http://10.42.8.89/v2/devices
HTTP/1.1 200 OK
BOND-Flags: 4
Content-Length: 62
Content-Type: application/json; charset=utf-8

{"_":"3cb09490","__":"00000000","708bb457":{"_":"c66fbccb"}}

[admin@polisy ~]$ curl -H "BOND-Token: *REDACTED*" -i http://10.42.8.89/v2/devices/708bb457
HTTP/1.1 200 OK
BOND-Flags: 4
Content-Length: 363
Content-Type: application/json; charset=utf-8

{"name":"Ceiling","type":"CF","location":"Guest Room","template":"B2","actions":["DecreaseSpeed","IncreaseSpeed","SetSpeed","StartDimmer","Stop","ToggleLight","TogglePower","TurnLightOff","TurnLightOn","TurnOff","TurnOn"],"_":"c66fbccb","__":"89a4338e","commands":{"_":"dcb6ad47"},"state":{"_":"86b7414a"},"properties":{"_":"82bde9cf"},"skeds":{"_":"00000000"}}

I did find this interesting note under the 64-bit Keys heading:

As of v3.0.0 firmware, Bond products have moved to 64-bit keys as resource identifiers, instead of the previous 32-bit keys. So, rather than a device being identified by an 8-digit hex string, the ids for newly created devices will be 16-digit hex strings.

However, it goes on to explain that the API is "libral(sic) in what it accepts" so they still support the shorter keys (like mine is showing) so it doesn't seem that would break the node server discovery function.

Link to comment

Sorry for being out of pocket for so long. Moving is not as easy as I remember it from 24 years ago. Anyway, the Bond Bridge is unboxed, updated to the new firmware, and in the Master BR, and while the fan has to go back (couldn't get it to balance), I will add it to the Bond Bridge for testing and get the Node server working - hopefully by this coming weekend.

 

Edited by Goose66
  • Like 3
Link to comment

A quick update: ran some test functions on the API code and found the problem. Seems the latest version of the bridge firmware added an additional hash value in the device list (identified as "_ _" instead of the existing "_" that is used internally. However, I was only screening out "_" from the list of devices for further query. Quick fix.

However, I can't get the latest version of Polyglot v3 (or IoP, for that matter) to install on my Polisy, so I am unable to test the Node server with the API changes. I have to go out of town today and attend to a family matter and won't be back until Monday. I will circle back to it then.

  • Like 3
Link to comment

@ISY4Me, thanks for the factory reset tip. My firmware is now back at 2.22.6 and the NS is working perfectly as far as I can tell. I'm new to this, so perhaps it's missing some functionality that I'm not aware of. I'm only controlling a single device, and the discovery function in the PG3 NS dashboard successfully found it after the bridge showed up on the admin console.

Link to comment
On 8/31/2022 at 10:36 AM, Goose66 said:

A quick update: ran some test functions on the API code and found the problem. Seems the latest version of the bridge firmware added an additional hash value in the device list (identified as "_ _" instead of the existing "_" that is used internally. However, I was only screening out "_" from the list of devices for further query. Quick fix.

However, I can't get the latest version of Polyglot v3 (or IoP, for that matter) to install on my Polisy, so I am unable to test the Node server with the API changes. I have to go out of town today and attend to a family matter and won't be back until Monday. I will circle back to it then.

@Goose66 I'd rather not rollback the firmware on my Bond Bridge. What's a realistic ETA on resolution?

Link to comment

Still completely dead in the water as to Polisy, PG3, and IoP. At this stage, my Polisy is a brick. We've reached a point in the architecture evolution where node server development is 20% coding and 80% trying to keep a development environment running. Hopefully will get some time from Michel on my service ticket this afternoon. 

Link to comment
  • 2 weeks later...
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      36.5k
    • Total Posts
      367.6k
×
×
  • Create New...