Jump to content









Photo

Update properties of device

device

  • Please log in to reply
1 reply to this topic

#1 nacho.2363

nacho.2363

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 09 March 2016 - 09:35 AM

Hi,
 
I created a listener to update the device properties. If I said I invoke listener device level I have no problem.
 
device2 def = Device.find ("XXXX @ YYYYY");
 
The problem arises when you want to create a listener at group level or project for any device group or the project is updated when receiving a stream, the system does not identify the device that must be updated. I tried it with:
 
Device.findBy device2 def = ([ "id_group": "ZZZZ @ YYYYYYYY", "time_zone": "Europe / Madrid"]);
 
I you can explain how you should proceed?
 
Thank you very much for the clarification


#2 sdeancos

sdeancos

    Master of Puppets

  • Members
  • PipPipPip
  • 102 posts
  • LocationMadrid, Spain.

Posted 10 March 2016 - 02:03 PM

Hi,

 

You can to create properties in this way:

import com.carriots.sdk.Device

def my_device = Device.find('you_name_device@your_id_developer_here')

my_device.device_properties = ['key': 'value', 'more_key': 'more_value']
my_device.update()



If your property are created previously, you can to update any key:

my_device.device_properties['more_key'] = 'other_value'
my_device.update()

 

 

 

I hope this help you,

 

BR.







Also tagged with one or more of these keywords: device

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users