mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 00:04:11 +01:00
add rambo_se
This commit is contained in:
@@ -931,6 +931,7 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Landskrona - Svalövs Renhållning](/doc/source/lsr_nu.md) / lsr.nu
|
||||
- [Lerum Vatten och Avlopp](/doc/source/lerum_se.md) / vatjanst.lerum.se
|
||||
- [Linköping - Tekniska Verken](/doc/source/tekniskaverken_se.md) / tekniskaverken.se
|
||||
- [North / Middle Bohuslän - Rambo AB](/doc/source/rambo_se.md) / rambo.se
|
||||
- [Region Gotland](/doc/source/gotland_se.md) / gotland.se
|
||||
- [Ronneby Miljöteknik](/doc/source/miljoteknik_se.md) / fyrfackronneby.se
|
||||
- [Samverkan Återvinning Miljö (SÅM)](/doc/source/samiljo_se.md) / samiljo.se
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
from waste_collection_schedule import Collection # type: ignore[attr-defined]
|
||||
|
||||
TITLE = "North / Middle Bohuslän - Rambo AB"
|
||||
DESCRIPTION = "Source for North / Middle Bohuslän - Rambo AB."
|
||||
URL = "https://www.rambo.se/"
|
||||
TEST_CASES = {
|
||||
"Grebbestad Ö.långgat./Storg., Grebbestad": {
|
||||
"address": "Grebbestad Ö.långgat./Storg., Grebbestad"
|
||||
},
|
||||
"Grebbestadsvägen 6, Tanumshede": {"address": "Grebbestadsvägen 6, Tanumshede"},
|
||||
"Torgvägen 1, Centrum, Hedekas": {"address": "Torgvägen 1, Centrum, Hedekas"},
|
||||
"Örekilsvägen Munkedals Reningsverk 10, Munkedal": {
|
||||
"address": "Örekilsvägen Munkedals Reningsverk 10, Munkedal"
|
||||
},
|
||||
"Storgatan 39, Smögen": {"address": "Storgatan 39, Smögen"},
|
||||
}
|
||||
|
||||
|
||||
ICON_MAP = {
|
||||
"Hushållsavfall": "mdi:trash-can",
|
||||
"Matavfall": "mdi:leaf",
|
||||
"Kärl": "mdi:trash-can",
|
||||
}
|
||||
|
||||
|
||||
API_URL = "https://rambo.se/wp-json/app/v1/{}"
|
||||
|
||||
HEADERS = {
|
||||
"accept": "application/json, text/plain, */*",
|
||||
"X-App-Identifier": "www.rambo.se/hamtdag",
|
||||
}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, address: str):
|
||||
self._address: str = address
|
||||
|
||||
def fetch(self):
|
||||
args = {
|
||||
"address": self._address.split(",")[0],
|
||||
}
|
||||
|
||||
# get json file
|
||||
r = requests.get(API_URL.format("address-flat"), params=args, headers=HEADERS)
|
||||
r.raise_for_status()
|
||||
|
||||
data = r.json()
|
||||
|
||||
plant_number = None
|
||||
for hit in data:
|
||||
if (
|
||||
"address" in hit
|
||||
and hit["address"].strip().lower() == self._address.strip().lower()
|
||||
):
|
||||
plant_number = hit["plant_number"].replace(" ", "+")
|
||||
break
|
||||
|
||||
if not plant_number:
|
||||
raise Exception(
|
||||
"Address not found write it exactly as it is on the website"
|
||||
)
|
||||
|
||||
r = requests.get(
|
||||
API_URL.format("next-pickup-web"),
|
||||
params={"plant-number": plant_number},
|
||||
headers=HEADERS,
|
||||
)
|
||||
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
|
||||
entries = []
|
||||
for d in data["types"]:
|
||||
date = datetime.strptime(d["pickup_date"], "%Y-%m-%d").date()
|
||||
icon = ICON_MAP.get(d["type"]) # Collection icon
|
||||
type = d["type"]
|
||||
entries.append(Collection(date=date, t=type, icon=icon))
|
||||
|
||||
return entries
|
||||
34
doc/source/rambo_se.md
Normal file
34
doc/source/rambo_se.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# North / Middle Bohuslän - Rambo AB
|
||||
|
||||
Support for schedules provided by [North / Middle Bohuslän - Rambo AB](https://www.rambo.se/), serving North / Middle Bohuslän, Sweden.
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: rambo_se
|
||||
args:
|
||||
address: ADDRESS
|
||||
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**address**
|
||||
*(String) (required)*
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: rambo_se
|
||||
args:
|
||||
address: Grebbestad Ö.långgat./Storg., Grebbestad
|
||||
|
||||
```
|
||||
|
||||
## How to get the source argument
|
||||
|
||||
Find the parameter of your address using [https://www.rambo.se/](https://www.rambo.se/) and write them exactly like on the web page.
|
||||
2
info.md
2
info.md
@@ -31,7 +31,7 @@ Waste collection schedules from service provider web sites are updated daily, de
|
||||
| Norway | BIR (Bergensområdets Interkommunale Renovasjonsselskap), IRiS, Min Renovasjon, Movar IKS, Oslo Kommune, ReMidt Orkland muni, Sandnes Kommune, Stavanger Kommune, Trondheim |
|
||||
| Poland | Ecoharmonogram, Poznań/Koziegłowy/Objezierze/Oborniki, Warsaw, Wrocław |
|
||||
| Slovenia | Moji odpadki, Ljubljana |
|
||||
| Sweden | Affärsverken, Jönköping - June Avfall & Miljö, Landskrona - Svalövs Renhållning, Lerum Vatten och Avlopp, Linköping - Tekniska Verken, Region Gotland, Ronneby Miljöteknik, Samverkan Återvinning Miljö (SÅM), SRV Återvinning, SSAM, Sysav Sophämntning, Uppsala Vatten och Avfall AB, VA Syd Sophämntning |
|
||||
| Sweden | Affärsverken, Jönköping - June Avfall & Miljö, Landskrona - Svalövs Renhållning, Lerum Vatten och Avlopp, Linköping - Tekniska Verken, North / Middle Bohuslän - Rambo AB, Region Gotland, Ronneby Miljöteknik, Samverkan Återvinning Miljö (SÅM), SRV Återvinning, SSAM, Sysav Sophämntning, Uppsala Vatten och Avfall AB, VA Syd Sophämntning |
|
||||
| Switzerland | A-Region, Alchenstorf, Andwil, Appenzell, Berg, Bühler, Eggersriet, Gais, Gaiserwald, Goldach, Grosswangen, Grub, Heiden, Herisau, Horn, Hundwil, Häggenschwil, Lindau, Lutzenberg, Muolen, Mörschwil, Münchenstein, Real Luzern, Rehetobel, Rorschach, Rorschacherberg, Schwellbrunn, Schönengrund, Speicher, Stein, Steinach, Teufen, Thal, Trogen, Tübach, Untereggen, Urnäsch, Wald, Waldkirch, Waldstatt, Wittenbach, Wolfhalden |
|
||||
| United Kingdom | Aberdeenshire Council, Adur & Worthing Councils, Allerdale Borough Council, Amber Valley Borough Council, Anglesey, Ashfield District Council, Ashford Borough Council, Aylesbury Vale District Council, Basildon Council, Basingstoke and Deane Borough Council, Bath & North East Somerset Council, Bedford Borough Council, Binzone, Blackburn with Darwen Borough Council, Borough Council of King's Lynn & West Norfolk, Bracknell Forest Council, Bradford Metropolitan District Council, Braintree District Council, Breckland Council, Bristol City Council, Broadland District Council, Broxtowe Borough Council, Buckinghamshire Waste Collection - Former Chiltern, South Bucks or Wycombe areas, Burnley Council, Cambridge City Council, Canterbury City Council, Cardiff Council, Central Bedfordshire Council, Cherwell District Council, Cheshire East Council, Cheshire West and Chester Council, Chesterfield Borough Council, Chichester District Council, City of Doncaster Council, City Of Lincoln Council, City of York Council, Colchester City Council, Conwy County Borough Council, Cornwall Council, Crawley Borough Council (myCrawley), Croydon Council, Derby City Council, Dudley Metropolitan Borough Council, Durham County Council, East Cambridgeshire District Council, East Herts Council, East Northamptonshire and Wellingborough, East Renfrewshire Council, East Riding of Yorkshire Council, Eastbourne Borough Council, Elmbridge Borough Council, Environment First, Exeter City Council, Falkirk, Fareham Council, FCC Environment, Fenland District Council, Fife Council, Gateshead Council, Glasgow City Council, Guildford Borough Council, Gwynedd, Harborough District Council, Haringey Council, Harlow Council, Hart District Council, Herefordshire City Council, Highland, Horsham District Council, Huntingdonshire District Council, iTouchVision, Joint Waste Solutions, Kirklees Council, Lancaster City Council, Leicester City Council, Lewes District Council, Lisburn and Castlereagh City Council, Liverpool City Council, London Borough of Bexley, London Borough of Bromley, London Borough of Camden, London Borough of Lewisham, London Borough of Merton, Maidstone Borough Council, Maldon District Council, Manchester City Council, Mansfield District Council, Mendip District Council, Mid-Sussex District Council, Middlesbrough Council, Milton Keynes council, Newcastle City Council, Newcastle Under Lyme Borough Council, Newport City Council, North Herts Council, North Kesteven District Council, North Lincolnshire Council, North Somerset Council, North Yorkshire Council - Hambleton, Nottingham City Council, Oxford City Council, Peterborough City Council, Portsmouth City Council, Reading Council, Redbridge Council, Reigate & Banstead Borough Council, Rhondda Cynon Taf County Borough Council, Richmondshire District Council, Rotherham Metropolitan Borough Council, Runnymede Borough Council, Rushcliffe Brough Council, Rushmoor Borough Council, Salford City Council, Sedgemoor District Council, Sheffield City Council, Somerset Council, Somerset County Council, Somerset West & Taunton District Council, South Cambridgeshire District Council, South Derbyshire District Council, South Gloucestershire Council, South Hams District Council, South Holland District Council, South Norfolk Council, South Oxfordshire District Council, South Somerset District Council, South Tyneside Council, Southampton City Council, Stevenage Borough Council, Stockport Council, Stockton-on-Tees Borough Council, Stoke-on-Trent, Stratford District Council, Surrey Heath Borough Council, Swindon Borough Council, Tameside Metropolitan Borough Council, Telford and Wrekin Council, Test Valley Borough Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Tonbridge and Malling Borough Council, UK Bin Collection Schedule (UKBCD) project, Uttlesford District Council, Vale of White Horse District Council, Walsall Council, Warrington Borough Council, Warwick District Council, Waverley Borough Council, Wealden District Council, Welwyn Hatfield Borough Council, West Berkshire Council, West Devon Borough Council, West Dunbartonshire Council, Wigan Council, Wiltshire Council, Windsor and Maidenhead, Wirral Council, Woking Borough Council, Wokingham Borough Council, Wyre Forest District Council |
|
||||
| United States of America | Albuquerque, New Mexico, USA, City of Bloomington, City of Cambridge, City of Gastonia, NC, City of Georgetown, TX, City of Oklahoma City, City of Pittsburgh, Louisville, Kentucky, USA, Newark, Delaware, USA, Olympia, Washington, USA, ReCollect, Recycle Coach, Republic Services, Seattle Public Utilities, Tucson, Arizona, USA |
|
||||
|
||||
Reference in New Issue
Block a user