@@ -119,7 +119,7 @@ def line(self):
119
119
return line
120
120
121
121
@property
122
- def device_state_attributes (self ):
122
+ def extra_state_attributes (self ):
123
123
"""Return extra attributes."""
124
124
attribution = CONF_ATTRIBUTION
125
125
if self ._timetable_date :
@@ -131,12 +131,12 @@ def device_state_attributes(self):
131
131
async def async_update (self ):
132
132
"""Update state."""
133
133
if self .data_is_outdated ():
134
- res = await async_http_request (self ._loop , self . _websession ,
134
+ res = await async_http_request (self ._websession ,
135
135
ZTM_ENDPOINT , self ._params )
136
136
if res .get ('error' , '' ):
137
137
_LOGGER .error ("Error: %s" , res ['error' ])
138
138
else :
139
- self ._timetable = self .map_results (res .get ('response' , []))
139
+ self ._timetable = self .map_results (res .get ('response' , [0 ]))
140
140
self ._timetable_date = dt_util .now ().date ()
141
141
_LOGGER .debug ("Downloaded timetable for line: %s stop: %s-%s" ,
142
142
self ._line , self ._stop_id , self ._stop_number )
@@ -227,10 +227,10 @@ def parse_raw_timetable(raw_result):
227
227
return result
228
228
229
229
230
- async def async_http_request (loop , websession , uri , params ):
230
+ async def async_http_request (websession , uri , params ):
231
231
"""Perform actual request."""
232
232
try :
233
- with async_timeout .timeout (REQUEST_TIMEOUT , loop = loop ):
233
+ with async_timeout .timeout (REQUEST_TIMEOUT ):
234
234
req = await websession .get (uri , params = params )
235
235
if req .status != 200 :
236
236
return {'error' : req .status }
@@ -239,4 +239,4 @@ async def async_http_request(loop, websession, uri, params):
239
239
except (asyncio .TimeoutError , aiohttp .ClientError ):
240
240
_LOGGER .error ("Cannot connect to ZTM API endpoint." )
241
241
except ValueError :
242
- _LOGGER .error ("Received non-JSON data from ZTM API endpoint" )
242
+ _LOGGER .error ("Received non-JSON data from ZTM API endpoint" )
0 commit comments