Skip to content

Commit

Permalink
Fix index out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
amaximus committed Nov 25, 2024
1 parent 93056c6 commit d23e7a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/bkk_stop/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def extra_state_attributes(self):
break
dt_now = datetime.now()
bkkjson["updatedAt"] = dt_now.strftime("%Y/%m/%d %H:%M")
self._state = bkkjson["vehicles"][0]["in"]
if 'vehicles' in bkkjson and len(bkkjson["vehicles"]) > 0:
self._state = bkkjson["vehicles"][0]["in"]

return bkkjson

Expand Down

0 comments on commit d23e7a2

Please sign in to comment.