Giter VIP home page Giter VIP logo

wasteplan_trv's Introduction

Wasteplan TRV

GitHub Release License hacs Project Maintenance BuyMeCoffee

Wasteplan component for Trondheim Renholdsverk (TRV). This component creates a calendar of pickup events.

Installation

  1. Ensure HACS is installed.
  2. Search for and install the "Wasteplan TRV" integration
  3. Install and restart Home Assistant
  4. Install Wasteplan TRV from the integrations screen.

Attributions

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines


⭐️ this repository if you found it useful ❤️

BuyMeCoffee

wasteplan_trv's People

Contributors

jonkristian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

csicar

wasteplan_trv's Issues

No 'version' key in the manifest file

WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'wasteplan_trv'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'wasteplan_trv'

Utilgjengelig API

Oppretter denne tråden for ordens skyld slik at informasjon ikke blir spredt ut i ulike "Issues".
Som dere kanskje har funnet ut så virker ikke sensorene lenger, dette skyldes at vi ikke lenger har tilgang til Trv api v1.

Jeg har sendt ut noen e-poster for å finne ut om det er mulig å få tilgang til nytt Api v2 som det ser ut til at de har gått over på men responsen var ikke særlig positiv desverre.

Vi har ikke hatt noe API tilgjengelig, og vi har heller ikke nå noe API du kan få benytte. Så tviler på at du har benyttet noe API fra oss.

Vi har dessverre ikke noe åpnet API for allmenheten, og ei heller planer for dette i nær fremtid. Men er enig med deg på at vi burde ha det. Vi får sette det på planen vår i forhold til digitalisering. Vi må bare finne tid til å prioritere dette, og tilgjengeliggjøre dette på en trygg måte.

Er ikke så mye annet å gjøre enn å vente.

Legger ved @erlendsellie sin waste-template som benytter scraping som en mellomløsning, tusen takk Erlend!

Wrong day/date in calendar

I assume this date in calendar means trash day is tuesday? It should be corrected to 27.06.2023 kl 00:00 - 27.06.2023 kl 24:00

26. juni 2023 kl. 00:00 - 27. juni 2023 kl. 00:00

Add support for new waste types

TRV has rolled out 2 new bins (waste types) Glass/Metal and Food waste. Would be nice to have those available as well :)

Great job on the integration! Comes in very handy when you've had shirmps and don't want to toss them in the bin too early 😆

Add support for "Containers" and housing association (borettslag).

Firstly, GREAT initiative.
I live in a small flat with housing association containers for trash (which are frequently full...).
I see on their web site that they now have two search fields, with one specifically for housing associations:
image

It returns an ID:
image

But this ID seems to not be supported (?) with this repository(whereas a nearby estate home's ID in the same street that I tested with - works well). I don't know if the API doesn't respond to "container" ID's, or if there is a difference in the reply, breaking the interpretation(?), or something completely different.

My expected results should be:
image

But in Home Assistant, I don't get any error, but "unknown"/"ikke kjent" for all values, except for plant waste :P .
image

Any possibility to look into what it would take to add support for housing association "containers"? Not competent at all myself.

Love the idea (and functionality)! Great job!

Sensor state formatting

Hey, thanks for maintaining this super useful addon! :)

I see that in your example screenshot the sensor state reads "Om 7 uker", but my sensors read "Uke 6". I never know what week it is, so "Om x uker" would be a lot more useful! Is this configurable somehow, or has it changed since the screenshot was taken?

image

Icon issues ?

Looks like there is a icon issue..
Last week and this week has the same icons, but waste in two weeks has a different icon.... ?
trv

(Last week it was only one bin that had "blank" icon, the rest was "filled"....)

device_state_attributes

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 10:03:56 (3 occurrences)
Last logged: 10:03:57

Entity sensor.restavfall (<class 'custom_components.wasteplan_trv.sensor.TRVSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.papir (<class 'custom_components.wasteplan_trv.sensor.TRVSensor'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.plastemballasje (<class 'custom_components.wasteplan_trv.sensor.TRVSensor'>) implements device_state_attributes. Please report it to the custom component author.

Issues with two gradients obtained within the same week

It looks like the sensor having som trouble when two gradients being obtained within the same week. This entails that the sensor in both of the two gradients in the same week showing value "0".
Screenshot of the actual "Tømmeplan":
image
Preview from Home Assistant:
image

("Tømmeplan" for waste containers, not ordinary bins)

Papir-sensor fungerer ikke

Sensor for papir viser "Ikke bestemt":
image

JSON-objektet returnert fra TRV inkluderer papp:

{
   "name":"\u00d8vre Flat\u00e5sveg 45, Kolstadhaugen B\/L",
   "type":"CONTAINERS",
   "plan":null,
   "calendar":[
      {
         "year":2023,
         "week":8,
         "date":null,
         "description":{
            "Restavfall":{
               "no":[
                  "Bleier og bind",
                  "B\u00f8ker med stive permer",
                  "CD-plater og videokasetter",
                  "Gavepapir",
                  "Glass som ikke er emballasje",
                  "Gummi, l\u00e6r, skinn",
                  "Husdyrekskrementer, katte- og fuglesand (sm\u00e5 mengder)",
                  "Ildfaste former",
                  "Kald aske",
                  "Krystall",
                  "Kosmetikk",
                  "Matavfall",
                  "Mat- og bakepapir",
                  "Plastleker, lego o.l.",
                  "Plast som ikke er emballasje",
                  "Porselen",
                  "Speil",
                  "Spr\u00f8ytespisser (pakkes godt inn i avispapir, brusflasker e.l.)",
                  "St\u00f8vsugerposer",
                  "Suppeposer",
                  "Tilgriset papp og papir",
                  "Tilgriset plastemballasje",
                  "T\u00f8rkepapir",
                  "Vindusglass, knust (pakkes godt inn)",
                  "Isopor (store mengder leveres til gjenvinningsstasjonen)",
                  "Fett (matolje og stekefett)"
               ],
               "en":[
                  "Diapers and sanitary napkins",
                  "Books, hardback",
                  "CDs\/DVDs\/VHS cassettes",
                  "Giftwrap",
                  "Glass and plastics, other than food containers\/packaging",
                  "Rubber and leather",
                  "Pet feces, cat and bird litter (small amounts, well wrapped)",
                  "Ovenproof dishes",
                  "Cold ash (well wrapped)",
                  "Crystal",
                  "Cosmetics",
                  "Food",
                  "Greaseproof paper",
                  "Plastic toys, Lego etc.",
                  "Porcelain",
                  "Mirrors",
                  "Needles\/syringes (well wrapped)",
                  "Vacuum cleaner bags",
                  "Soup packets",
                  "Soiled paper\/cardboard",
                  "Soiled plastic packaging",
                  "Paper towels\/napkins",
                  "Broken windows (well wrapped)",
                  "Polystyrene (large amounts can be brought to Heggstadmoen gjenvinningsstasjon)"
               ]
            }
         },
         "wastetype":"Restavfall",
         "wastetype_en":"Non-recyclable waste",
         "date_week_start":"2023-02-20",
         "date_week_end":"2023-02-26",
         "day_of_week":null
      },
      {
         "year":2023,
         "week":9,
         "date":null,
         "description":{
            "":{
               "no":[
                  
               ],
               "en":[
                  
               ]
            },
            "Restavfall":{
               "no":[
                  "Bleier og bind",
                  "B\u00f8ker med stive permer",
                  "CD-plater og videokasetter",
                  "Gavepapir",
                  "Glass som ikke er emballasje",
                  "Gummi, l\u00e6r, skinn",
                  "Husdyrekskrementer, katte- og fuglesand (sm\u00e5 mengder)",
                  "Ildfaste former",
                  "Kald aske",
                  "Krystall",
                  "Kosmetikk",
                  "Matavfall",
                  "Mat- og bakepapir",
                  "Plastleker, lego o.l.",
                  "Plast som ikke er emballasje",
                  "Porselen",
                  "Speil",
                  "Spr\u00f8ytespisser (pakkes godt inn i avispapir, brusflasker e.l.)",
                  "St\u00f8vsugerposer",
                  "Suppeposer",
                  "Tilgriset papp og papir",
                  "Tilgriset plastemballasje",
                  "T\u00f8rkepapir",
                  "Vindusglass, knust (pakkes godt inn)",
                  "Isopor (store mengder leveres til gjenvinningsstasjonen)",
                  "Fett (matolje og stekefett)"
               ],
               "en":[
                  "Diapers and sanitary napkins",
                  "Books, hardback",
                  "CDs\/DVDs\/VHS cassettes",
                  "Giftwrap",
                  "Glass and plastics, other than food containers\/packaging",
                  "Rubber and leather",
                  "Pet feces, cat and bird litter (small amounts, well wrapped)",
                  "Ovenproof dishes",
                  "Cold ash (well wrapped)",
                  "Crystal",
                  "Cosmetics",
                  "Food",
                  "Greaseproof paper",
                  "Plastic toys, Lego etc.",
                  "Porcelain",
                  "Mirrors",
                  "Needles\/syringes (well wrapped)",
                  "Vacuum cleaner bags",
                  "Soup packets",
                  "Soiled paper\/cardboard",
                  "Soiled plastic packaging",
                  "Paper towels\/napkins",
                  "Broken windows (well wrapped)",
                  "Polystyrene (large amounts can be brought to Heggstadmoen gjenvinningsstasjon)"
               ]
            }
         },
         "wastetype":"Papp og papir, Restavfall",
         "wastetype_en":"Papp og papir, Non-recyclable waste",
         "date_week_start":"2023-02-27",
         "date_week_end":"2023-03-05",
         "day_of_week":null
      },
      {
         "year":2023,
         "week":10,
         "date":null,
         "description":{
            "Restavfall":{
               "no":[
                  "Bleier og bind",
                  "B\u00f8ker med stive permer",
                  "CD-plater og videokasetter",
                  "Gavepapir",
                  "Glass som ikke er emballasje",
                  "Gummi, l\u00e6r, skinn",
                  "Husdyrekskrementer, katte- og fuglesand (sm\u00e5 mengder)",
                  "Ildfaste former",
                  "Kald aske",
                  "Krystall",
                  "Kosmetikk",
                  "Matavfall",
                  "Mat- og bakepapir",
                  "Plastleker, lego o.l.",
                  "Plast som ikke er emballasje",
                  "Porselen",
                  "Speil",
                  "Spr\u00f8ytespisser (pakkes godt inn i avispapir, brusflasker e.l.)",
                  "St\u00f8vsugerposer",
                  "Suppeposer",
                  "Tilgriset papp og papir",
                  "Tilgriset plastemballasje",
                  "T\u00f8rkepapir",
                  "Vindusglass, knust (pakkes godt inn)",
                  "Isopor (store mengder leveres til gjenvinningsstasjonen)",
                  "Fett (matolje og stekefett)"
               ],
               "en":[
                  "Diapers and sanitary napkins",
                  "Books, hardback",
                  "CDs\/DVDs\/VHS cassettes",
                  "Giftwrap",
                  "Glass and plastics, other than food containers\/packaging",
                  "Rubber and leather",
                  "Pet feces, cat and bird litter (small amounts, well wrapped)",
                  "Ovenproof dishes",
                  "Cold ash (well wrapped)",
                  "Crystal",
                  "Cosmetics",
                  "Food",
                  "Greaseproof paper",
                  "Plastic toys, Lego etc.",
                  "Porcelain",
                  "Mirrors",
                  "Needles\/syringes (well wrapped)",
                  "Vacuum cleaner bags",
                  "Soup packets",
                  "Soiled paper\/cardboard",
                  "Soiled plastic packaging",
                  "Paper towels\/napkins",
                  "Broken windows (well wrapped)",
                  "Polystyrene (large amounts can be brought to Heggstadmoen gjenvinningsstasjon)"
               ]
            }
         },
         "wastetype":"Restavfall",
         "wastetype_en":"Non-recyclable waste",
         "date_week_start":"2023-03-06",
         "date_week_end":"2023-03-12",
         "day_of_week":null
      },
      {
         "year":2023,
         "week":11,
         "date":null,
         "description":{
            "":{
               "no":[
                  
               ],
               "en":[
                  
               ]
            },
            "Plastemballasje":{
               "no":[
                  "Emballasjebrett (til kj\u00f8tt, fj\u00f8rfe o.l.)",
                  "Isbokser",
                  "Kaffeposer (plast)",
                  "Plastbeger (r\u00f8mmebeger o.l.)",
                  "Plastflasker og korker (ikke pant)",
                  "Plastfolie (innpakningsplast rundt nye m\u00f8bler o.l.)",
                  "Plastkanner",
                  "Plastposer",
                  "Plastspann (soddspann o.l.)",
                  "Sjokoladepapir",
                  "Shampoo- og balsamflasker",
                  "S\u00e5peemballasje"
               ],
               "en":[
                  "Food trays (for meat, poultry etc.)",
                  "Ice cream boxes",
                  "Coffee bags (plastic)",
                  "Plastic cups (for sour cream, yoghurt etc.)",
                  "Plastic bottles and corks (non-refundable)",
                  "Plastic wrapping (e.g. packaging for new furniture)",
                  "Plastic flower pots",
                  "Plastic bags",
                  "Plastic pails (e.g. \u201csodd\u201d soup pails)",
                  "Chocolate wrapping",
                  "Shampoo - and conditioner bottles",
                  "Soap packaging"
               ]
            },
            "Restavfall":{
               "no":[
                  "Bleier og bind",
                  "B\u00f8ker med stive permer",
                  "CD-plater og videokasetter",
                  "Gavepapir",
                  "Glass som ikke er emballasje",
                  "Gummi, l\u00e6r, skinn",
                  "Husdyrekskrementer, katte- og fuglesand (sm\u00e5 mengder)",
                  "Ildfaste former",
                  "Kald aske",
                  "Krystall",
                  "Kosmetikk",
                  "Matavfall",
                  "Mat- og bakepapir",
                  "Plastleker, lego o.l.",
                  "Plast som ikke er emballasje",
                  "Porselen",
                  "Speil",
                  "Spr\u00f8ytespisser (pakkes godt inn i avispapir, brusflasker e.l.)",
                  "St\u00f8vsugerposer",
                  "Suppeposer",
                  "Tilgriset papp og papir",
                  "Tilgriset plastemballasje",
                  "T\u00f8rkepapir",
                  "Vindusglass, knust (pakkes godt inn)",
                  "Isopor (store mengder leveres til gjenvinningsstasjonen)",
                  "Fett (matolje og stekefett)"
               ],
               "en":[
                  "Diapers and sanitary napkins",
                  "Books, hardback",
                  "CDs\/DVDs\/VHS cassettes",
                  "Giftwrap",
                  "Glass and plastics, other than food containers\/packaging",
                  "Rubber and leather",
                  "Pet feces, cat and bird litter (small amounts, well wrapped)",
                  "Ovenproof dishes",
                  "Cold ash (well wrapped)",
                  "Crystal",
                  "Cosmetics",
                  "Food",
                  "Greaseproof paper",
                  "Plastic toys, Lego etc.",
                  "Porcelain",
                  "Mirrors",
                  "Needles\/syringes (well wrapped)",
                  "Vacuum cleaner bags",
                  "Soup packets",
                  "Soiled paper\/cardboard",
                  "Soiled plastic packaging",
                  "Paper towels\/napkins",
                  "Broken windows (well wrapped)",
                  "Polystyrene (large amounts can be brought to Heggstadmoen gjenvinningsstasjon)"
               ]
            }
         },
         "wastetype":"Papp og papir, Plastemballasje, Restavfall",
         "wastetype_en":"Papp og papir, Plastic, Non-recyclable waste",
         "date_week_start":"2023-03-13",
         "date_week_end":"2023-03-19",
         "day_of_week":null
      },.
......
   ],
   "deviations":null,
   "plans_by_year":null,
   "id":1909
}

Container combinations missing

I'm trying to use this schedule: https://trv.no/plan/1909/
But I only get sensors that match that of the schedule in #4. Containers can have different schedules, depending on the needs of the housing association. Here, restavfall is picked up every week, paper every other week, and plastics every four weeks.
Can support for this be added?

Wrong week number at end of year

I've set up the integration from scratch, and I noticed these:

image

I'm hoping TRV isn't gonna wait one year before picking up plast/papir.

Integrasion appears to be broken after recent HA updates.

Logger: homeassistant.components.sensor
Source: custom_components/wasteplan_trv/sensor.py:120
Integration: sensor (documentation, issues)
First occurred: 09:57:22 (6 occurrences)
Last logged: 09:57:30
wasteplan_trv: Error on device update!

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 732, in async_device_update
await task
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/wasteplan_trv/sensor.py", line 120, in update
for entry in self._data.data["calendar"]:
TypeError: 'NoneType' object is not subscriptable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.