Skip to content

Commit

Permalink
added (hard-coded)duration and removed unused data from response
Browse files Browse the repository at this point in the history
  • Loading branch information
TekniskSupport committed Feb 15, 2022
1 parent 0d005e9 commit fa58422
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/resrobot/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ async def add_sensors(hass, config, async_add_devices, api_key, fetch_interval,
params = {}
timeout = 5000
time = None
resource = _ENDPOINT + '&accessId='+ api_key + '&id=' + str(location) + '&maxJourneys='+ str(max_journeys)
resource = _ENDPOINT + '&accessId='+ api_key + '&id=' + str(location) + '&maxJourneys='+ str(max_journeys) + '&duration=90'
sensors = []
helpers = []
helper = 'helper_'+name
base_resource = resource

if time_offset:
time = dateparser.parse("in " + str(time_offset) + " minutes")
resource = resource + '&time='+ time.strftime("%H:%M") + '&date=' + time.strftime('%Y-%m-%d')
Expand Down Expand Up @@ -180,6 +181,9 @@ def filterResults(self, trips):
trips[k]["means_of_transport"] = trip["Product"][0]["catCode"]
trips[k]["num"] = trip["Product"][0]["num"]
del trips[k]["Product"]
del trips[k]["JourneyDetailRef"]
del trips[k]["JourneyStatus"]
del trips[k]["ProductAtStop"]
for f in self._filter:
if "line" in f and "num" in trip and str(trip["num"]) not in allowedLines and allowedLines != []:
deleteItems.append(trip)
Expand Down

0 comments on commit fa58422

Please sign in to comment.