diff --git a/README.md b/README.md index 905a40b6..3e058d55 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ Currently the following service providers are supported: - [Lerum.se](./doc/source/lerum_se.md) - [Ronneby Miljöteknik](./doc/source/miljoteknik_se.md) - [SSAM.se](./doc/source/ssam_se.md) -- [srvatervinning.se](./doc/source/srv_se.md) +- [srvatervinning.se](./doc/source/srvatervinning_se.md) - [Sysav.se](./doc/source/sysav_se.md) - [Vasyd.se](./doc/source/vasyd_se.md) diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/srv_se.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/srvatervinning_se.py similarity index 75% rename from custom_components/waste_collection_schedule/waste_collection_schedule/source/srv_se.py rename to custom_components/waste_collection_schedule/waste_collection_schedule/source/srvatervinning_se.py index a6384bec..f8231048 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/srv_se.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/srvatervinning_se.py @@ -3,8 +3,8 @@ import requests from datetime import datetime from waste_collection_schedule import Collection -TITLE = "SRV, Sweden" -DESCRIPTION = "Source for SRV, Sweden" +TITLE = "SRV återvinning AB Sweden" +DESCRIPTION = "Source for SRV återvinning AB, Sweden" URL = "https://www.srvatervinning.se/sophamtning/privat/hamtinformation-och-driftstorningar" TEST_CASES = { "Skansvägen" : {"address":"Skansvägen" }, @@ -19,7 +19,12 @@ class Source: def fetch(self): - r = requests.get('https://www.srvatervinning.se/rest-api/srv-slamsok-rest-new/search?query='+self._address+'&city=') + params = { + "query" : self._address, + "city" : "", + } + url = 'https://www.srvatervinning.se/rest-api/srv-slamsok-rest-new/search' + r = requests.get(url, params) if r.status_code != 200: _LOGGER.error("Error querying calender data") @@ -32,7 +37,6 @@ class Source: for container in data["results"][0]["containers"]: type=container["contentType"] for calentry in container["calendars"]: - dates = {calentry["startDate"],type} date_obj = datetime.strptime(calentry["startDate"], '%Y-%m-%d').date() entries.append(Collection(date_obj,type)) diff --git a/doc/source/srv_se.md b/doc/source/srvatervinning_se.md similarity index 92% rename from doc/source/srv_se.md rename to doc/source/srvatervinning_se.md index b9b288ca..b9e77edd 100644 --- a/doc/source/srv_se.md +++ b/doc/source/srvatervinning_se.md @@ -7,7 +7,7 @@ Support for schedules provided by [SRV återvinning AB](https://www.srvatervinni ```yaml waste_collection_schedule: sources: - - name: srv_se + - name: srvatervinning_se args: address: address ``` @@ -22,7 +22,7 @@ waste_collection_schedule: ```yaml waste_collection_schedule: sources: - - name: srv_se + - name: srvatervinning_se args: address: "Skansvägen" diff --git a/info.md b/info.md index 834a5d7f..343eb618 100644 --- a/info.md +++ b/info.md @@ -158,7 +158,7 @@ Currently the following service providers are supported: - [Lerum.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/lerum_se.md) - [Ronneby Miljöteknik](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/miljoteknik_se.md) -- [srvatervinning.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/srv_se.md) +- [srvatervinning.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/srvatervinning_se.md) - [SSAM.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/ssam_se.md) - [Sysav.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/sysav_se.md) - [Vasyd.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/vasyd_se.md)