@@ -116,6 +116,8 @@ def send_data(self, feed, value):
116116 specified value to the feed identified by either name, key, or ID.
117117 Returns a Data instance with details about the newly appended row of data.
118118 Note that send_data now operates the same as append.
119+ :param string feed: Name/Key/ID of Adafruit IO feed.
120+ :param string value: Value to send.
119121 """
120122 return self .create_data (feed , Data (value = value ))
121123
@@ -126,6 +128,8 @@ def send_batch_data(self, feed, data_list):
126128 ID, feed key, or feed name. Data must be an instance of the Data class
127129 with at least a value property set on it. Returns a Data instance with
128130 details about the newly appended row of data.
131+ :param string feed: Name/Key/ID of Adafruit IO feed.
132+ :param Data data_list: Multiple data values.
129133 """
130134 path = "feeds/{0}/data/batch" .format (feed )
131135 data_dict = type (data_list )((data ._asdict () for data in data_list ))
@@ -136,58 +140,57 @@ def append(self, feed, value):
136140 specified value to the feed identified by either name, key, or ID.
137141 Returns a Data instance with details about the newly appended row of data.
138142 Note that unlike send the feed should exist before calling append.
143+ :param string feed: Name/Key/ID of Adafruit IO feed.
144+ :param string value: Value to append to feed.
139145 """
140146 return self .create_data (feed , Data (value = value ))
141147
142- def send_location_data (self , feed , value , lat , lon , ele ):
143- """Sends locational data to a feed
144-
145- args:
146- - lat: latitude
147- - lon: logitude
148- - ele: elevation
149- - (optional) value: value to send to the feed
148+ def send_location_data (self , feed , lat , lon , ele , value = None ):
149+ """Sends locational data to a feed.
150+ :param string feed: Name/Key/ID of Adafruit IO feed.
151+ :param int lat: Latitude.
152+ :param int lon: Longitude.
153+ :param int ele: Elevation.
154+ :param int value: Optional value to send, defaults to None.
150155 """
151- return self .create_data (feed , Data (value = value ,lat = lat , lon = lon , ele = ele ))
156+ return self .create_data (feed , Data (value = value ,lat = lat , lon = lon , ele = ele ))
152157
153158 def receive_time (self , time ):
154159 """Returns the time from the Adafruit IO server.
155-
156- args:
157- - time (string): millis, seconds, ISO-8601
160+ :param string time: Time to be returned: `millis`, `seconds`, `ISO-8601`.
158161 """
159162 timepath = "time/{0}" .format (time )
160163 return self ._get (timepath , is_time = True )
161164
162165 def receive (self , feed ):
163- """Retrieve the most recent value for the specified feed. Feed can be a
164- feed ID, feed key, or feed name. Returns a Data instance whose value
165- property holds the retrieved value .
166+ """Retrieve the most recent value for the specified feed. Returns a Data
167+ instance whose value property holds the retrieved value.
168+ :param string feed: Name/Key/ID of Adafruit IO feed .
166169 """
167170 path = "feeds/{0}/data/last" .format (feed )
168171 return Data .from_dict (self ._get (path ))
169172
170173 def receive_next (self , feed ):
171- """Retrieve the next unread value from the specified feed. Feed can be
172- a feed ID, feed key, or feed name. Returns a Data instance whose value
173- property holds the retrieved value .
174+ """Retrieve the next unread value from the specified feed. Returns a Data
175+ instance whose value property holds the retrieved value.
176+ :param string feed: Name/Key/ID of Adafruit IO feed .
174177 """
175178 path = "feeds/{0}/data/next" .format (feed )
176179 return Data .from_dict (self ._get (path ))
177180
178181 def receive_previous (self , feed ):
179- """Retrieve the previous unread value from the specified feed. Feed can
180- be a feed ID, feed key, or feed name. Returns a Data instance whose
181- value property holds the retrieved value .
182+ """Retrieve the previous unread value from the specified feed. Returns a
183+ Data instance whose value property holds the retrieved value.
184+ :param string feed: Name/Key/ID of Adafruit IO feed .
182185 """
183186 path = "feeds/{0}/data/previous" .format (feed )
184187 return Data .from_dict (self ._get (path ))
185188
186189 def data (self , feed , data_id = None ):
187- """Retrieve data from a feed. Feed can be a feed ID, feed key, or feed
188- name. Data_id is an optional id for a single data value to retrieve .
189- If data_id is not specified then all the data for the feed will be
190- returned in an array .
190+ """Retrieve data from a feed. If data_id is not specified then all the data
191+ for the feed will be returned in an array .
192+ :param string feed: Name/Key/ID of Adafruit IO feed.
193+ :param string data_id: ID of the piece of data to delete .
191194 """
192195 if data_id is None :
193196 path = "feeds/{0}/data" .format (feed )
@@ -197,41 +200,46 @@ def data(self, feed, data_id=None):
197200 return Data .from_dict (self ._get (path ))
198201
199202 def create_data (self , feed , data ):
200- """Create a new row of data in the specified feed. Feed can be a feed
201- ID, feed key, or feed name. Data must be an instance of the Data class
202- with at least a value property set on it. Returns a Data instance with
203- details about the newly appended row of data.
203+ """Create a new row of data in the specified feed.
204+ Returns a Data instance with details about the newly
205+ appended row of data.
206+ :param string feed: Name/Key/ID of Adafruit IO feed.
207+ :param Data data: Instance of the Data class. Must have a value property set.
204208 """
205209 path = "feeds/{0}/data" .format (feed )
206210 return Data .from_dict (self ._post (path , data ._asdict ()))
207211
208212 def delete (self , feed , data_id ):
209- """Delete data from a feed. Feed can be a feed ID, feed key, or feed
210- name. Data_id must be the ID of the piece of data to delete.
213+ """Delete data from a feed.
214+ :param string feed: Name/Key/ID of Adafruit IO feed.
215+ :param string data_id: ID of the piece of data to delete.
211216 """
212217 path = "feeds/{0}/data/{1}" .format (feed , data_id )
213218 self ._delete (path )
214219
215220 def toRed (self , data ):
216- """Hex color feed to red channel.
221+ """Hex color feed to red channel.
222+ :param int data: Color value, in hexadecimal.
217223 """
218224 return ((int (data [1 ], 16 ))* 16 ) + int (data [2 ], 16 )
219225
220226 def toGreen (self , data ):
221227 """Hex color feed to green channel.
228+ :param int data: Color value, in hexadecimal.
222229 """
223230 return (int (data [3 ], 16 ) * 16 ) + int (data [4 ], 16 )
224231
225232 def toBlue (self , data ):
226- """Hex color feed to blue channel.
233+ """Hex color feed to blue channel.
234+ :param int data: Color value, in hexadecimal.
227235 """
228236 return (int (data [5 ], 16 ) * 16 ) + int (data [6 ], 16 )
229237
230- # Feed functionality.
238+ # feed functionality.
231239 def feeds (self , feed = None ):
232240 """Retrieve a list of all feeds, or the specified feed. If feed is not
233- specified a list of all feeds will be returned. If feed is specified it
234- can be a feed name, key, or ID and the requested feed will be returned .
241+ specified a list of all feeds will be returned.
242+ :param string feed: Name/Key/ ID of Adafruit IO feed, defaults to None .
235243 """
236244 if feed is None :
237245 path = "feeds"
@@ -241,25 +249,23 @@ def feeds(self, feed=None):
241249 return Feed .from_dict (self ._get (path ))
242250
243251 def create_feed (self , feed ):
244- """Create the specified feed. Feed should be an instance of the Feed
245- type with at least the name property set .
252+ """Create the specified feed.
253+ :param string feed: Name/Key/ID of Adafruit IO feed .
246254 """
247255 path = "feeds/"
248256 return Feed .from_dict (self ._post (path , {"feed" : feed ._asdict ()}))
249257
250258 def delete_feed (self , feed ):
251- """Delete the specified feed. Feed can be a feed ID, feed key, or feed
252- name .
259+ """Delete the specified feed.
260+ :param string feed: Name/Key/ID of Adafruit IO feed .
253261 """
254262 path = "feeds/{0}" .format (feed )
255263 self ._delete (path )
256264
257265 # Group functionality.
258266 def groups (self , group = None ):
259- """Retrieve a list of all groups, or the specified group. If group is
260- not specified a list of all groups will be returned. If group is
261- specified it can be a group name, key, or ID and the requested group
262- will be returned.
267+ """Retrieve a list of all groups, or the specified group.
268+ :param string group: Name/Key/ID of Adafruit IO Group. Defaults to None.
263269 """
264270 if group is None :
265271 path = "groups/"
@@ -269,15 +275,15 @@ def groups(self, group=None):
269275 return Group .from_dict (self ._get (path ))
270276
271277 def create_group (self , group ):
272- """Create the specified group. Group should be an instance of the Group
273- type with at least the name and feeds property set .
278+ """Create the specified group.
279+ :param string group: Name/Key/ID of Adafruit IO Group .
274280 """
275281 path = "groups/"
276282 return Group .from_dict (self ._post (path , group ._asdict ()))
277283
278284 def delete_group (self , group ):
279- """Delete the specified group. Group can be a group ID, group key, or
280- group name .
285+ """Delete the specified group.
286+ :param string group: Name/Key/ID of Adafruit IO Group .
281287 """
282288 path = "groups/{0}" .format (group )
283289 self ._delete (path )
0 commit comments