mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
added east_northamptonshire_gov_uk
This commit is contained in:
@@ -198,8 +198,8 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Landkreis Rotenburg (Wümme)](/doc/source/abfall_io.md) / lk-awr.de
|
||||
- [Landkreis Roth](/doc/source/c_trace_de.md) / landratsamt-roth.de
|
||||
- [Landkreis Schweinfurt](/doc/source/awido_de.md) / landkreis-schweinfurt.de
|
||||
- [Landkreis Schwäbisch Hall](/doc/source/cmcitymedia_de.md) / cmcitymedia.de
|
||||
- [Landkreis Schwäbisch Hall](/doc/source/lrasha_de.md) / lrasha.de
|
||||
- [Landkreis Schwäbisch Hall](/doc/source/cmcitymedia_de.md) / cmcitymedia.de
|
||||
- [Landkreis Sigmaringen](/doc/source/abfall_io.md) / landkreis-sigmaringen.de
|
||||
- [Landkreis Südliche Weinstraße](/doc/source/awido_de.md) / suedliche-weinstrasse.de
|
||||
- [Landkreis Tirschenreuth](/doc/source/awido_de.md) / kreis-tir.de
|
||||
@@ -439,6 +439,7 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Derby City Council](/doc/source/derby_gov_uk.md) / derby.gov.uk
|
||||
- [East Cambridgeshire District Council](/doc/source/eastcambs_gov_uk.md) / eastcambs.gov.uk
|
||||
- [East Herts Council](/doc/source/eastherts_gov_uk.md) / eastherts.gov.uk
|
||||
- [East Northamptonshire and Wellingborough](/doc/source/east_northamptonshire_gov_uk.md) / east-northamptonshire.gov.uk
|
||||
- [Eastbourne Borough Council](/doc/source/environmentfirst_co_uk.md) / lewes-eastbourne.gov.uk
|
||||
- [Elmbridge Borough Council](/doc/source/elmbridge_gov_uk.md) / elmbridge.gov.uk
|
||||
- [Environment First](/doc/source/environmentfirst_co_uk.md) / environmentfirst.co.uk
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import requests
|
||||
from waste_collection_schedule import Collection # type: ignore[attr-defined]
|
||||
|
||||
|
||||
TITLE = "East Northamptonshire and Wellingborough"
|
||||
DESCRIPTION = "Source for East Northamptonshire and Wellingborough"
|
||||
URL = "east-northamptonshire.gov.uk"
|
||||
TEST_CASES = {
|
||||
"Raunds": {"uprn": "100031046896"},
|
||||
"Rusheden": {"uprn": "100031028202"},
|
||||
"Easton on the Hill": {"uprn": 100031040850},
|
||||
"Lutton": {"uprn": 200000735573},
|
||||
"Wellingborough": {"uprn": 100031193921},
|
||||
}
|
||||
|
||||
ICON_MAP = {
|
||||
"general": "mdi:trash-can",
|
||||
"recycling": "mdi:recycle",
|
||||
}
|
||||
|
||||
|
||||
API_URL = "https://api.northnorthants.gov.uk/test/wc-info/{uprn}"
|
||||
|
||||
DAYS = {
|
||||
'MON': 0,
|
||||
'TUE': 1,
|
||||
'WED': 2,
|
||||
'THU': 3,
|
||||
'FRI': 4
|
||||
}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, uprn: str):
|
||||
self._uprn: str = uprn
|
||||
print(self._uprn)
|
||||
|
||||
def fetch(self):
|
||||
r = requests.get(API_URL.format(uprn=self._uprn))
|
||||
r.raise_for_status()
|
||||
r.json()
|
||||
|
||||
data = r.json()
|
||||
|
||||
process_day = datetime.now()
|
||||
while process_day.weekday() != DAYS.get(data["day"]):
|
||||
process_day = process_day + timedelta(days=1)
|
||||
|
||||
reference_date = datetime(2022, 6, 20)
|
||||
entries = []
|
||||
|
||||
for _ in range(10):
|
||||
weeks_diff: int = int((process_day - reference_date).days / 7)
|
||||
if weeks_diff % 2 == 0:
|
||||
bin_type = "general" if data["schedule"] == "B" else "recycling"
|
||||
else:
|
||||
bin_type = "recycling" if data["schedule"] == "B" else "general"
|
||||
|
||||
entries.append(Collection(date=process_day.date(),
|
||||
t=bin_type, icon=ICON_MAP.get(bin_type)))
|
||||
|
||||
process_day = process_day + timedelta(days=7)
|
||||
|
||||
return entries
|
||||
32
doc/source/east_northamptonshire_gov_uk.md
Normal file
32
doc/source/east_northamptonshire_gov_uk.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# East Northamptonshire and Wellingborough
|
||||
|
||||
Support for schedules provided by [East Northamptonshire](east-northamptonshire.gov.uk) and [Wellingborough](wellingborough.gov.uk), serving East Northamptonshire and Wellingborough, GB.
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: east_northamptonshire_gov_uk
|
||||
args:
|
||||
uprn: UPRN
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**uprn**
|
||||
*(string | Integer) (required)*
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: east_northamptonshire_gov_uk
|
||||
args:
|
||||
uprn: 100031040850
|
||||
```
|
||||
|
||||
## How to get the source argument
|
||||
|
||||
An easy way to discover your Unique Property Reference Number (UPRN) is by going to <https://www.findmyaddress.co.uk/> and entering in your address details.
|
||||
2
info.md
2
info.md
@@ -30,7 +30,7 @@ Waste collection schedules from service provider web sites are updated daily, de
|
||||
| Slovenia | Moji odpadki, Ljubljana |
|
||||
| Sweden | 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 |
|
||||
| Switzerland | A-Region, Andwil, Appenzell, Berg, Bühler, Eggersriet, Gais, Gaiserwald, Goldach, Grosswangen, Grub, Heiden, Herisau, Horn, Hundwil, Häggenschwil, Lindau, Lutzenberg, Muolen, Mörschwil, Münchenstein, Rehetobel, Rorschach, Rorschacherberg, Schwellbrunn, Schönengrund, Speicher, Stein, Steinach, Teufen, Thal, Trogen, Tübach, Untereggen, Urnäsch, Wald, Waldkirch, Waldstatt, Wittenbach, Wolfhalden |
|
||||
| United Kingdom | Amber Valley Borough Council, Ashfield District Council, Basingstoke and Deane Borough Council, Binzone, Blackburn with Darwen Borough Council, Bracknell Forest Council, Bradford Metropolitan District Council, Braintree District Council, Breckland Council, Cambridge City Council, Canterbury City Council, Central Bedfordshire Council, Cheshire East Council, Chesterfield Borough Council, Chichester District Council, City of York Council, Colchester City Council, Cornwall Council, Derby City Council, East Cambridgeshire District Council, East Herts Council, Eastbourne Borough Council, Elmbridge Borough Council, Environment First, FCC Environment, Glasgow City Council, Guildford Borough Council, Harborough District Council, Harlow Council, Herefordshire City Council, Horsham District Council, Huntingdonshire District Council, Leicester City Council, Lewes District Council, Liverpool City Council, London Borough of Bromley, London Borough of Lewisham, London Borough of Merton, Maldon District Council, Manchester City Council, Mid-Sussex District Council, Middlesbrough Council, Newcastle City Council, Newcastle Under Lyme Borough Council, Newport City Council, North Herts Council, North Lincolnshire Council, North Somerset Council, Nottingham City Council, Oxford City Council, Peterborough City Council, Richmondshire District Council, Rushmoor Borough Council, Salford City Council, Sheffield City Council, South Cambridgeshire District Council, South Derbyshire District Council, South Hams District Council, South Norfolk and Broadland Council, South Oxfordshire District Council, Southampton City Council, Stevenage Borough Council, Stockport Council, Swindon Borough Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Uttlesford District Council, Vale of White Horse District Council, Walsall Council, Waverley Borough Council, West Berkshire Council, West Devon Borough Council, Wigan Council, Wiltshire Council, Wyre Forest District Council |
|
||||
| United Kingdom | Amber Valley Borough Council, Ashfield District Council, Basingstoke and Deane Borough Council, Binzone, Blackburn with Darwen Borough Council, Bracknell Forest Council, Bradford Metropolitan District Council, Braintree District Council, Breckland Council, Cambridge City Council, Canterbury City Council, Central Bedfordshire Council, Cheshire East Council, Chesterfield Borough Council, Chichester District Council, City of York Council, Colchester City Council, Cornwall Council, Derby City Council, East Cambridgeshire District Council, East Herts Council, East Northamptonshire and Wellingborough, Eastbourne Borough Council, Elmbridge Borough Council, Environment First, FCC Environment, Glasgow City Council, Guildford Borough Council, Harborough District Council, Harlow Council, Herefordshire City Council, Horsham District Council, Huntingdonshire District Council, Leicester City Council, Lewes District Council, Liverpool City Council, London Borough of Bromley, London Borough of Lewisham, London Borough of Merton, Maldon District Council, Manchester City Council, Mid-Sussex District Council, Middlesbrough Council, Newcastle City Council, Newcastle Under Lyme Borough Council, Newport City Council, North Herts Council, North Lincolnshire Council, North Somerset Council, Nottingham City Council, Oxford City Council, Peterborough City Council, Richmondshire District Council, Rushmoor Borough Council, Salford City Council, Sheffield City Council, South Cambridgeshire District Council, South Derbyshire District Council, South Hams District Council, South Norfolk and Broadland Council, South Oxfordshire District Council, Southampton City Council, Stevenage Borough Council, Stockport Council, Swindon Borough Council, Telford and Wrekin Council, Tewkesbury Borough Council, The Royal Borough of Kingston Council, Uttlesford District Council, Vale of White Horse District Council, Walsall Council, Waverley Borough Council, West Berkshire Council, West Devon Borough Council, Wigan Council, Wiltshire Council, Wyre Forest District Council |
|
||||
| United States of America | City of Pittsburgh, Republic Services, Seattle Public Utilities |
|
||||
<!--End of country section-->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user