@@ -76,7 +76,7 @@ async def send_get_request(self, uri: str) -> str:
7676 return text
7777
7878 async def send_post_request (
79- self , uri : str , command : str , params : dict , is_async : bool = True
79+ self , uri : str , command : str , params : dict [ str , Any ] , is_async : bool = True
8080 ) -> str :
8181 """Sends a POST request to the specified API URI. Used to send commands
8282 to the Director.
@@ -104,7 +104,7 @@ async def send_post_request(
104104 check_response_for_error (text )
105105 return text
106106
107- async def get_all_items_by_category (self , category : str ) -> list [dict ]:
107+ async def get_all_items_by_category (self , category : str ) -> list [dict [ str , Any ] ]:
108108 """Returns a list of items related to a particular category.
109109
110110 Parameters:
@@ -115,23 +115,26 @@ async def get_all_items_by_category(self, category: str) -> list[dict]:
115115 outlet_wireless_dimmer, voice-scene
116116 """
117117 data = await self .send_get_request (f"/api/v1/categories/{ category } " )
118- return json .loads (data )
118+ result : list [dict [str , Any ]] = json .loads (data )
119+ return result
119120
120- async def get_all_item_info (self ) -> list [dict ]:
121+ async def get_all_item_info (self ) -> list [dict [ str , Any ] ]:
121122 """Returns a list of all the items on the Director."""
122123 data = await self .send_get_request ("/api/v1/items" )
123- return json .loads (data )
124+ result : list [dict [str , Any ]] = json .loads (data )
125+ return result
124126
125- async def get_item_info (self , item_id : int ) -> list [dict ]:
127+ async def get_item_info (self , item_id : int ) -> list [dict [ str , Any ] ]:
126128 """Returns a list of the details of the specified item.
127129
128130 Parameters:
129131 `item_id` - The Control4 item ID.
130132 """
131133 data = await self .send_get_request (f"/api/v1/items/{ item_id } " )
132- return json .loads (data )
134+ result : list [dict [str , Any ]] = json .loads (data )
135+ return result
133136
134- async def get_item_setup (self , item_id : int ) -> dict :
137+ async def get_item_setup (self , item_id : int ) -> dict [ str , Any ] :
135138 """Returns the setup info of the specified item.
136139
137140 Parameters:
@@ -140,16 +143,18 @@ async def get_item_setup(self, item_id: int) -> dict:
140143 data = await self .send_post_request (
141144 f"/api/v1/items/{ item_id } /commands" , "GET_SETUP" , {}, False
142145 )
143- return json .loads (data )
146+ result : dict [str , Any ] = json .loads (data )
147+ return result
144148
145- async def get_item_variables (self , item_id : int ) -> list [dict ]:
149+ async def get_item_variables (self , item_id : int ) -> list [dict [ str , Any ] ]:
146150 """Returns a list of the variables available for the specified item.
147151
148152 Parameters:
149153 `item_id` - The Control4 item ID.
150154 """
151155 data = await self .send_get_request (f"/api/v1/items/{ item_id } /variables" )
152- return json .loads (data )
156+ result : list [dict [str , Any ]] = json .loads (data )
157+ return result
153158
154159 async def get_item_variable_value (
155160 self , item_id : int , var_name : str | list [str ] | tuple [str , ...] | set [str ]
@@ -207,40 +212,43 @@ async def get_all_item_variable_value(
207212 f"Empty response received from Director! The variable { var_name } "
208213 f"doesn't seem to exist for any items."
209214 )
210- json_dict = json .loads (data )
215+ json_dict : list [ dict [ str , Any ]] = json .loads (data )
211216 for item in json_dict :
212217 if item .get ("value" ) == "Undefined" :
213218 item ["value" ] = None
214219 return json_dict
215220
216- async def get_item_commands (self , item_id : int ) -> list [dict ]:
221+ async def get_item_commands (self , item_id : int ) -> list [dict [ str , Any ] ]:
217222 """Returns the commands available for the specified item.
218223
219224 Parameters:
220225 `item_id` - The Control4 item ID.
221226 """
222227 data = await self .send_get_request (f"/api/v1/items/{ item_id } /commands" )
223- return json .loads (data )
228+ result : list [dict [str , Any ]] = json .loads (data )
229+ return result
224230
225- async def get_item_network (self , item_id : int ) -> list [dict ]:
231+ async def get_item_network (self , item_id : int ) -> list [dict [ str , Any ] ]:
226232 """Returns the network information for the specified item.
227233
228234 Parameters:
229235 `item_id` - The Control4 item ID.
230236 """
231237 data = await self .send_get_request (f"/api/v1/items/{ item_id } /network" )
232- return json .loads (data )
238+ result : list [dict [str , Any ]] = json .loads (data )
239+ return result
233240
234- async def get_item_bindings (self , item_id : int ) -> list [dict ]:
241+ async def get_item_bindings (self , item_id : int ) -> list [dict [ str , Any ] ]:
235242 """Returns the bindings information for the specified item.
236243
237244 Parameters:
238245 `item_id` - The Control4 item ID.
239246 """
240247 data = await self .send_get_request (f"/api/v1/items/{ item_id } /bindings" )
241- return json .loads (data )
248+ result : list [dict [str , Any ]] = json .loads (data )
249+ return result
242250
243- async def get_ui_configuration (self ) -> dict :
251+ async def get_ui_configuration (self ) -> dict [ str , Any ] :
244252 """Returns a dictionary of the Control4 App UI Configuration enumerating
245253 rooms and capabilities
246254
@@ -323,4 +331,5 @@ async def get_ui_configuration(self) -> dict:
323331 }
324332 """
325333 data = await self .send_get_request ("/api/v1/agents/ui_configuration" )
326- return json .loads (data )
334+ result : dict [str , Any ] = json .loads (data )
335+ return result
0 commit comments