bachya / aiorecollect

🗑 A Python 3, asyncio-based library for the Recollect Waste API
MIT License
3 stars 1 forks source link

Also store pickup subject #6

Closed bwarden closed 3 years ago

bwarden commented 3 years ago

https://github.com/bachya/aiorecollect/blob/f51c5d08d516c1166b7f213bf76f23dc7a6a129c/aiorecollect/client.py#L91

(see https://github.com/stealthhacker/python-recollect-waste/pull/3)

For my area, certain events have somewhat clunky names, but more useful subjects (city names redacted):

name subject
Garbage Garbage
MixedRecycle Mixed recycling
GlassRecycle Glass recycling
XXXXXXXXXXX_FoodYardDebris Food and yard debris
leafXXXXXXXXX Free Leaf Drop-off Event
rx National Rx Drug Take Back Day
shredXXXXX XXXXXXXXX free document shred event

It would be handy to capture/report the subject as well.

Sample response snippet from my area:

  "events": [
    {
      "id": XXXXXXX,
      "flags": [
        {
          "service_name": "waste",
          "event_type": "pickup",
          "subject": "Mixed recycling",
          "backgroundColor": "#007ac2",
          "voice_message": null,
          "id": XXXX,
          "short_text_message": null,
          "area_name": "XXXXXXXCounty",
          "plain_text_message": null,
          "name": "MixedRecycle",
          "html_message": "<p>Include clean paper, cardboard and metal, as well as plastic bottles, tubs and buckets in the mixed recycling roll cart.</p>\n\n<p>&nbsp;</p>\n\n<p>Extra recycling can be set on the side at no charge <a target=\"_blank\" href=\"http://rco.io/XXXXXX\">if properly prepared</a>. Contact your collection company to inquire about ordering an additional recycling cart.</p>\n\n<p>&nbsp;</p>\n\n<p>Appliances should be taken to a drop-off recycling center. Place glass in the red bin.</p>",
          "icon_uri_fragment": "0,122,194/XXXXXXXX_recycling",
          "is_week_long": 0,
          "borderColor": "#007AC2",
          "sort_order": 13,
          "color": "#007ac2",
          "opts": {
            "event_type": "pickup"
          },
          "icon": "XXXXXXX_recycling:rgb(0,122,194)"
        },
        {
          "icon_uri_fragment": "246,139,31/XXXXXXX_glass",
          "is_week_long": 0,
          "html_message": "<p>Separate glass bottles and jars from other recyclables and place in the red glass bin.</p>\n\n<p>&nbsp;</p>\n\n<p>Put vases, mirrors, dishware and broken glass in the garbage.</p>\n\n<p>&nbsp;</p>\n\n<p>Set motor oil contained in a 1-gal, see-through plastic container next to the glass bin.</p>",
          "zone_id": XXXXX,
          "event_id": XXXXXXX,
          "name": "GlassRecycle",
          "area_name": "XXXXXXXCounty",
          "short_text_message": null,
          "plain_text_message": null,
          "icon": "washington_glass:rgb(246,139,31)",
          "opts": {
            "event_type": "pickup"
          },
          "borderColor": "#F6871F",
          "color": "#f68b1f",
          "sort_order": 14,
          "subject": "Glass recycling",
          "event_type": "pickup",
          "service_name": "waste",
          "id": XXXX,
          "voice_message": null,
          "backgroundColor": "#f68b1f"
        },
bachya commented 3 years ago

Looks like this is optional, as my place ID/service ID combo doesn't use friendly names in many places. That said, we can absolutely add them (using None if they don't exist).

bachya commented 3 years ago

@bwarden FYI, I just released this as part of 1.0.0.