mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
added remidt.no Orkland muni
This commit is contained in:
@@ -283,6 +283,7 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
|
||||
- [Min Renovasjon](/doc/source/minrenovasjon_no.md) / norkart.no
|
||||
- [Oslo Kommune](/doc/source/oslokommune_no.md) / oslo.kommune.no
|
||||
- [ReMidt Orkland muni](/doc/source/remidt_no.md) / remidt.no
|
||||
- [Stavanger Kommune](/doc/source/stavanger_no.md) / stavanger.kommune.no
|
||||
</details>
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import datetime
|
||||
|
||||
import requests
|
||||
import urllib
|
||||
|
||||
from waste_collection_schedule import Collection # type: ignore[attr-defined]
|
||||
|
||||
TITLE = "ReMidt Orkland muni"
|
||||
DESCRIPTION = "Source for Orkland muni."
|
||||
URL = "https://www.remidt.no"
|
||||
TEST_CASES = {
|
||||
"Follovegen": {"address": "Follovegen 1 B"},
|
||||
"Makrellsvingen": {"address": "Makrellsvingen 14 - 20"},
|
||||
"Taubaneveien": {"address": "Taubaneveien 46"},
|
||||
"Mistfjordveien": {"address": "Mistfjordveien 1299"},
|
||||
}
|
||||
|
||||
API_URL = "https://kalender.renovasjonsportal.no/api/address/" # or station"
|
||||
|
||||
ICON_MAP = { # Optional: Dict of waste types and suitable mdi icons
|
||||
"Restavfall": "mdi:trash-can",
|
||||
"Glass og metallemballasje": "mdi:bottle-soda",
|
||||
"Matavfall": "mdi:leaf",
|
||||
"Papir": "mdi:package-variant",
|
||||
"Plastemballasje": "mdi:recycle",
|
||||
}
|
||||
|
||||
# Parser for HTML input (hidden) text
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, address: str):
|
||||
self.address = address
|
||||
|
||||
def fetch(self):
|
||||
entries = []
|
||||
|
||||
r = requests.get(
|
||||
API_URL+urllib.parse.quote(self.address)
|
||||
)
|
||||
r.raise_for_status()
|
||||
address_id = r.json()["searchResults"][0]["id"]
|
||||
|
||||
r = requests.get(
|
||||
API_URL+address_id+"/details/"
|
||||
)
|
||||
r.raise_for_status()
|
||||
disposals = r.json()["disposals"]
|
||||
|
||||
for disposal in disposals:
|
||||
entries.append(Collection(
|
||||
date=datetime.datetime.fromisoformat(
|
||||
disposal["date"]).date(), # Collection date
|
||||
t=disposal["fraction"], # Collection type
|
||||
icon=ICON_MAP.get(disposal["fraction"]), # Collection icon
|
||||
))
|
||||
|
||||
return entries
|
||||
22
doc/source/remidt_no.md
Normal file
22
doc/source/remidt_no.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# zaw-online
|
||||
|
||||
Support for schedules provided by [remidt.no](https://www.remidt.no/#!/main) serving Norway Orkland muni.
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: remidt_no
|
||||
args:
|
||||
address: Follovegen 1 A
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**address**
|
||||
*(string) (required)*
|
||||
|
||||
## How to get the source arguments
|
||||
|
||||
Visit [remidt.no](https://www.remidt.no/#!/main) and make sure, address is written exactly like in the search bar.
|
||||
2
info.md
2
info.md
@@ -24,7 +24,7 @@ Waste collection schedules from service provider web sites are updated daily, de
|
||||
| Lithuania | Kauno švara |
|
||||
| Netherlands | ACV Group, Alpen an den Rijn, Area Afval, Avalex, Avri, Bar Afvalbeheer, Circulus, Cyclus NV, Dar, Den Haag, GAD, Gemeente Almere, Gemeente Berkelland, Gemeente Cranendonck, Gemeente Hellendoorn, Gemeente Lingewaard, Gemeente Meppel, Gemeente Middelburg + Vlissingen, Gemeente Peel en Maas, Gemeente Schouwen-Duiveland, Gemeente Sudwest-Fryslan, Gemeente Venray, Gemeente Voorschoten, Gemeente Wallre, Gemeente Westland, HVC Groep, Meerlanden, Mijn Blink, PreZero, Purmerend, RAD BV, Reinigingsbedrijf Midden Nederland, Reinis, Spaarne Landen, Stadswerk 072, Twente Milieu, Waardlanden, Ximmio, ZRD |
|
||||
| New Zealand | Auckland Council, Christchurch City Council, Gore, Invercargill & Southland, Horowhenua District Council, Waipa District Council, Wellington City Council |
|
||||
| Norway | Min Renovasjon, Oslo Kommune, Stavanger Kommune |
|
||||
| Norway | Min Renovasjon, Oslo Kommune, ReMidt Orkland muni, Stavanger Kommune |
|
||||
| Poland | Ecoharmonogram, Warsaw |
|
||||
| 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, SRV Återvinning, SSAM, Sysav Sophämntning, VA Syd Sophämntning |
|
||||
|
||||
Reference in New Issue
Block a user