@@ -66,7 +66,7 @@ async def connect(self):
6666 self .authorization = response_data ["token" ]
6767 self .authorized = True
6868 # The API doesn't respond with 401 but there will be no JSON
69- except json .decoder .JSONDecodeError :
69+ except ( json .decoder .JSONDecodeError , TypeError , KeyError ) :
7070 self .authorized = False
7171 raise exceptions .ElmaxConnectionError ("Credentials are not valid" )
7272
@@ -134,12 +134,12 @@ async def list_control_panels(self):
134134
135135 return control_panels_list
136136
137- async def get_endpoints (self , device_id , pin ):
137+ async def get_endpoints (self , control_panel_id , pin ):
138138 """List all endpoints of a control panel."""
139139 if self .authorized is False :
140140 await self .connect ()
141141
142- url = URL (BASE_URL ) / ENDPOINT_DISCOVERY / device_id / str (pin )
142+ url = URL (BASE_URL ) / ENDPOINT_DISCOVERY / control_panel_id / str (pin )
143143
144144 headers ["Authorization" ] = self .authorization
145145
@@ -155,12 +155,12 @@ async def get_endpoints(self, device_id, pin):
155155 if response_data [AREA ]:
156156 self ._areas = response_data [AREA ]
157157
158- async def get_status (self , entity_id ):
158+ async def get_status (self , endpoint_id ):
159159 """Get the status of an endpoint."""
160160 if self .authorized is False :
161161 self .connect ()
162162
163- url = URL (BASE_URL ) / ENDPOINT_STATUS_ENTITY_ID / entity_id
163+ url = URL (BASE_URL ) / ENDPOINT_STATUS_ENTITY_ID / endpoint_id
164164
165165 headers ["Authorization" ] = self .authorization
166166
0 commit comments