IBM watson IoT integration difficulties

I’ve been trying to go through the Watson refrigerator demo project for my impExplorer Developer Kit to talk to IBM Watson IoT, but IBM’s cloud site has been updated to where you can’t follow the instructions.

Can anyone offer assistance in getting it to work on current IBM cloud? I’ve spent over 2 hrs on it and yes I’m in the industry so its even more frustrating to not be able to get it to work myself.

No problem getting impexplorer to talk to impcentral, its just can’t locate the watson API settings as they’ve either changed or now charge for watson’s tie in.

Hi,

Sorry about that … yes, IBM Watson keeps changing its setup and it’s challenging to keep our instructions updated. We’ll have a look shortly.

@terrencebarr thanks that would be greatly appreciated.
Additionally, I think updating this use case’s agent and and device code would be most helpful.

I think getting it updated would in fact be very helpful to developers as this was and is a fantastic development use case from which a lot of developers can launch from. All of the code is from 2017.

  • It’s using unsupported libraries (HTS221.device.lib.nut / LIS3DH.class.nut:1.3.0) and deprecated commands (imp.getmacaddress()). It does build though and sends packets but without mac address (deprecated) I wonder if IBM is properly tracking the device ID.

  • And yes - IBM appears to have either moved watson away from lite plan or has materially changed site you can no longer follow instructions.

  • I can confirm IBM is successfully sent the electricimp packets but its unable to dashboard it. (there is no watson dashboard for lite that I can see anymore at least - attempts to work with IBM or their support end in frustration)

Thanks!

Hi,

Here’s what I found:

  1. Yes, some libraries are unsupported, but should still work. imp.getmacaddress() also still works. The code registers a device with the correct deviceID and then uses that for every published event, as far as I can see.
  2. There still is a lite plan but the screen flow is slightly different now. To get to the dashboard you need to click on the user account in the upper right (not intuitive) and the API permission must now be “Standard” (which I think it wasn’t before).
  3. The publish command to Watson is sent successfully, and then it takes several minutes for data to show up in the device events dashboard. But Watson doesn’t appear to parse the event data correctly and therefore you cannot create a card to visualize it (e.g. there is no “RefrigeratorMonitor” Event and no “temperature” property).

My feeling is Watson changed the structure of the device events and our agent code needs to be adjusted accordingly. I can have someone else on my team who has worked more deeply with Watson in the past have a look at it, but this may take a couple of days. Or you could play with it yourself and try changing the structure of the JSON that is sent to Watson and see if that helps - I assume there is Watson documentation on that.

Best,
– Terrence

I’ve just had a look and yes the code and instructions are quite old. I think Terrence has pointed out the areas that are different. I have gotten a dashboard up and working using the code from this example (despite the outdated libraries). I did notice a couple oddities with IBM when trying to create the dashboard. I had to wait for data to start posting to IBM before I could create the dashboard blocks and if the device had not posted data it wasn’t available. I’ve done a quick update of the instructions on our development branch in the library here: https://github.com/electricimp/IBMWatson/tree/develop/Examples/SmartRefrigerator. The IBM instructions have some new screenshots so they should be easier to follow now.

@betsy first of all thank you so much for updating the instructions and verifying the code.
I was able to successfully get it up and running - thank you again
BTW 2 things:

  1. just as an FYI it seems ibm removed the realtime chart in the cards section. At least I cant seem to find it. No worries - easy to resolve otherways
  2. Reproducing everything exactly as you have on an imp001, it works just fine, gathers sensor data and sends to watson, however it constantly restarts due to out of memory. Any ideas what may be leading to it using the exact code above and new imp001? How would you troubleshoot this given the basic code that’s been out for years. Likely due to newer impmepls firmware incompatibility with old code?

|2020-01-25T22:04:33.435 +00:00|[Device]|Agent received update.
|2020-01-25T22:04:33.436 +00:00|[Device]|Env readings stored and checked.|
|2020-01-25T22:04:33.441 +00:00|[Device]|------------------------------------------------|
|2020-01-25T22:04:34.498 +00:00|[Status]|Device disconnected|
|2020-01-25T22:04:34.499 +00:00|[Exit Code]|imp restarted, reason: out of memory|
|2020-01-25T22:04:34.504 +00:00|[Status]|Device connected|
and
|2020-01-25T22:18:20.560 +00:00|[Agent]|Watson request successful.|
|2020-01-25T22:18:21.285 +00:00|[Status]|Device disconnected|
|2020-01-25T22:18:46.100 +00:00|[Exit Code]|imp restarted, reason: out of memory|
|2020-01-25T22:18:46.107 +00:00|[Status]|Device connected|

I would check your device code. impOS is fully compatible across releases so updates shouldn’t be an issue. Are you building large arrays with sensor data? Or working with blobs that are large and need to be re-allocated (eg. by adding data to them)? Hard to diagnose this without sight of the device code.

@smittytone its the code verbatim from @betsy -