Jump to content









Photo

Device Update Properties

API Update Device

  • Please log in to reply
4 replies to this topic

#1 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 17 March 2013 - 10:48 AM

I've done a bit of looking at Status Streams and Device Properties.  There are some items, like serial number that I would like recorded in the Device Properties.  I'll certainly look at using Status Stream for the firmware function.

 

In studying the Device Update capability in the API, there isn't much information on what fields are required or not.  However in trying with HURL I get the below.  https://www.carriots...gement#d-update

 

{
  "code": "4003",
  "message": "Validation error",
  "details": {
    "type": [
      "This value is required."
    ],
    "name": [
      "This value is required."
    ],
    "id_asset": [
      "This value is required."
    ],
    "id_group": [
      "This value is required."
    ],
    "enabled": [
      "This value is required."
    ],
    "frequency_status": [
      "This value is required."
    ],
    "frequency_stream": [
      "This value is required."
    ],
    "time_zone": [
      "This value is required."
    ],
    "id_developer": [
      "This value is required."
    ]
  }
}

 

So, it looks like a lot of data is required.  My poor device just wants to PUT its serial number and a couple other properties.  The device knows its Developer ID and the properties it wants to update, not all these other items.  Is it possible to simply PUT to not require so much?  I'm trying to keep the code simple because of RAM size.

 

Or, perhaps there is a better way to update a Device's Properties.

 

Thank you.



#2 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 19 March 2013 - 10:29 AM

Hello.

 

I think the best way to do update a device property is sending a data stream to that device and bind a listener that updates the property using the SDK.

 

For example: 

 

import com.carriots.sdk.Device;

def device = Device.find('defaultDevice@carriots');
device.device_properties.propertyToBeUpdated=context.data.valueToUpdate;
device.update();

 

Hope it helps.

Alvaro Everlet

Carriots CTO


#3 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 19 March 2013 - 01:38 PM

Thank you Alvaro.  It is obvious to me that once my core firmware is working I will need to take a break and think clearly about Carriots so I understand it fully and can exercise this muscle you have built into it.  Thank you for writing and inspiring.  It is clear that Carriots is valuable way beyond storing data.



#4 mcastillo

mcastillo

    Carriots CEO

  • Administrators
  • 34 posts
  • LocationMadrid

Posted 19 March 2013 - 02:46 PM

It is clear that Carriots is valuable way beyond storing data.

 

Thank you Zambiot ! Our goal is to build a tool to create better and faster IOT products and services. We created Carriots because we needed these features when we were doing similar projects. Almost every feature in Carriots is associated to an internal Best-Practice for doing M2M/IOT projects. Part of the documentation we have to create is related to sharing those BP with the community. This forum is also a very valuable place to learn BP and needs from other users. So please feel free to share your thoughts on this topic.

 

Enjoy Carriots and use the force to prototype:

starwarsconversation.jpg



#5 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 22 March 2013 - 02:33 PM

I love it!







Also tagged with one or more of these keywords: API, Update, Device

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users