All Projects → bruxy70 → Garbage Collection

bruxy70 / Garbage Collection

Licence: mit
🗑 Custom Home Assistant sensor for scheduling garbage collection (or other regularly re-occurring events - weekly on given days, semi-weekly or monthly)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Garbage Collection

Ioabstraction
Library for Arduino and mbed that abstracts pins and i2c expanders (8574, 23017), supports AVR and I2c AT24 EEPROMs, Rotary encoders, fully debounced switches and simple task management.
Stars: ✭ 84 (-39.57%)
Mutual labels:  schedule
Notes
let me know if my notes help you :D (it's a mess, I know)
Stars: ✭ 119 (-14.39%)
Mutual labels:  garbage-collection
Cron
A cron expression parser in Rust
Stars: ✭ 132 (-5.04%)
Mutual labels:  schedule
Forsun Laravel
高性能的定时调度服务。
Stars: ✭ 91 (-34.53%)
Mutual labels:  schedule
Vue Schedule Calendar
日程调度日历。
Stars: ✭ 110 (-20.86%)
Mutual labels:  schedule
Reading
A list of computer-science readings I recommend
Stars: ✭ 1,919 (+1280.58%)
Mutual labels:  garbage-collection
Docker Gc Cron
A Docker image that allows scheduled cleanup of unused Docker images, containers, and volumes.
Stars: ✭ 81 (-41.73%)
Mutual labels:  garbage-collection
Timetable
📆 timetables.js plugin, timetable schedule school-timetable 课程表 大学课表 日程表 插件
Stars: ✭ 140 (+0.72%)
Mutual labels:  schedule
Droidconke2020app
Android app fully written in Kotlin for droidconKE2020
Stars: ✭ 115 (-17.27%)
Mutual labels:  schedule
Laravel Database Schedule
Manage your Laravel Task Scheduling in a friendly interface and save schedules to the database.
Stars: ✭ 94 (-32.37%)
Mutual labels:  schedule
Quick Plan
Defines and schedules Garmin workouts
Stars: ✭ 93 (-33.09%)
Mutual labels:  schedule
Sleepto
An alternative to traditional task schedulers
Stars: ✭ 98 (-29.5%)
Mutual labels:  schedule
Hickory
🕰 The command line tool for scheduling Python scripts
Stars: ✭ 126 (-9.35%)
Mutual labels:  schedule
Davos
Web-based FTP automation for Linux servers.
Stars: ✭ 90 (-35.25%)
Mutual labels:  schedule
Bdwgc
The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (libgc, bdwgc, boehm-gc)
Stars: ✭ 1,855 (+1234.53%)
Mutual labels:  garbage-collection
Tui.calendar
🍞📅A JavaScript calendar that has everything you need.
Stars: ✭ 9,537 (+6761.15%)
Mutual labels:  schedule
Workq
Job server in Go
Stars: ✭ 1,546 (+1012.23%)
Mutual labels:  schedule
Go spider
[爬虫框架 (golang)] An awesome Go concurrent Crawler(spider) framework. The crawler is flexible and modular. It can be expanded to an Individualized crawler easily or you can use the default crawl components only.
Stars: ✭ 1,745 (+1155.4%)
Mutual labels:  schedule
Schedule
Schedule module for Nest framework (node.js) ⏰
Stars: ✭ 137 (-1.44%)
Mutual labels:  schedule
Napchart
Drag-and-drop time-planning library using HTML5 and the canvas element
Stars: ✭ 129 (-7.19%)
Mutual labels:  schedule

hacs_badge Garbage-Collection Maintenance

Buy me a coffee

Garbage Collection

The garbage_collection component is a Home Assistant custom sensor for monitoring regular garbage collection schedule. The sensor can be configured for number of different schedules:

  • weekly schedule (including multiple collection days, e.g. on Tuesday and Thursday)
  • every-n-weeks repeats every period of weeks, starting from the week number first_week. It uses the week number - it therefore restarts each year, as the week numbers start again from 1.
  • bi-weekly in even-weeks or odd-weeks (technically, it is the same as every 2 weeks with 1st or 2nd first_week)
  • every-n-days (repeats regularly from the given first date). If n is multiply of 7, it works similar to every-n-weeks, with the difference that it does not use the week numbers (that restart each year) but continues infinitely from the initial date.
  • monthly schedule (nth day each month), or a specific day of each nth week. Using the period it could also be every 2nd, 3rd etc month.
  • annually (e.g. birthdays). This is once per year. Using include dates you can add additional dates manually. You can also configure seasonal calendars (e.g. for bio-waste collection), by configuring the first and last month. And you can group entities, which will merge multiple schedules into one sensor.

These are some examples using this sensor. The Lovelace config examples are included below.

Table of Contents

Installation

MANUAL INSTALLATION

  1. Download the latest release.
  2. Unpack the release and copy the custom_components/garbage_collection directory into the custom_components directory of your Home Assistant installation.
  3. Configure the garbage_collection sensor.
  4. Restart Home Assistant.

INSTALLATION VIA Home Assistant Community Store (HACS)

  1. Ensure that HACS is installed.
  2. Search for and install the "Garbage Collection" integration.
  3. Configure the garbage_collection sensor.
  4. Restart Home Assistant.

Configuration

Based on the Home Assistant design guideline, the YAML configuratio option will be removed in the future.

There are 2 ways to configure the integration:

  1. Using Config Flow: in Configuration/Integrations click on the + button, select Garbage Collection and configure the sensor (prefered). If you configure Garbage Collection using Config Flow, you can change the entity_name, name and change the sensor parameters from the Integrations configuration. The changes are instant and do not require HA restart.
  2. Using YAML (deprecated): add garbage_collection integration in your configuration.yaml and add individual sensors. YAML configuration example:
# Example configuration.yaml entry
garbage_collection:
  sensors:
  - name: "Regular waste" # Each week on Monday and Wednesday. No collection on Christmas, added extra collection on the 27th
    frequency: "weekly"
    collection_days:
    - mon
    - wed
    expire_after: '12:00'
    exclude_dates:
    - '2019-12-25'
    include_dates:
    - '2019-12-27'
  - name: "Bio-waste" # Bi-weekly (odd weeks) on Thursday. Between March and November
    frequency: "odd-weeks"
    first_month: "mar"
    last_month: "nov"
    collection_days: "thu"
  - name: "Large waste summer" # First and third Saturday each month
    frequency: "monthly"
    collection_days: "sat"
    weekday_order_number: 
    - 1
    - 3
    first_month: "may"
    last_month: "oct"
  - name: "Large waste winter" # First Saturday each month only
    frequency: "monthly"
    collection_days: "sat"
    weekday_order_number: 
    - 1
    first_month: "nov"
    last_month: "apr"
  - name: "Large waste" # Combination of winter and summer sensors
    frequency: "group"
    entities:
    - sensor.large_waste_summer
    - sensor.large_waste_winter
  - name: Paper # Every 4 weeks on Tuesday, starting on 4th week each year
    frequency: "every-n-weeks"
    collection_days: "tue"
    period: 4
    first_week: 4
  - name: "Someone's Birthday" 
    frequency: "annual"
    date: '11/24'

Entity_id change is not possible using the YAML configuration. Changing other paratemers require restarting Home Assistant.

CONFIGURATION PARAMETERS

SENSOR PARAMETERS

Attribute Required Description
name Yes Sensor friendly name
frequency Yes "weekly", "even-weeks", "odd-weeks", "every-n-weeks", "every-n-days", "monthly", "annual" or "group"
offset No Offset calculated date by offset days (makes most sense for monthly frequency). Examples of use:for last Saurday each month, configure first Saturday each month with offset: -7for 1st Wednesday in of full week, configure first Monday each month with offset: 2(integer between -31 and 31) Default: 0
hidden No Hide in calendar (useful for sensors that are used in groups)
Default: False
icon_normal No Default icon Default: mdi:trash-can
icon_today No Icon if the collection is today Default: mdi:delete-restore
icon_tomorrow No Icon if the collection is tomorrow Default: mdi:delete-circle
expire_after No Time in format format HH:MM. If the collection is due today, start looking for the next occurence after this time (i.e. if the weekly collection is in the morning, change the state from 'today' to next week in the afternoon)
verbose_state No The sensor state will show collection date and remaining days, instead of number Default: False
verbose_format No (relevant when verbose_state is True). Verbose status formatting string. Can use placeholders {date} and {days} to show the date of next collection and remaining days. Default: 'on {date}, in {days} days'When the collection is today or tomorrow, it will show Today or Tomorrow(currently in English, French, Czech and Italian).
date_format No In the verbose_format, you can configure the format of date (using strftime format) Default: '%d-%b-%Y'

PARAMETERS FOR ALL FREQUENCIES EXCEPT ANNUAL AND GROUP

Attribute Required Description
first_month No Month three letter abbreviation, e.g. "jan", "feb"...
Default: "jan"
last_month No Month three letter abbreviation.
Default: "dec"
exclude_dates No List of dates with no collection (using international date format 'yyyy-mm-dd'.
include_dates No List of extra collection (using international date format 'yyyy-mm-dd'.
move_country_holidays No Country holidays - the country code (see holidays for the list of valid country codes).
Automatically move garbage collection on public holidays to the following day.
Example: US
holiday_in_week_move No Move garbage collection to the following day if a holiday is in week.
Default: false
holiday_move_offset No Move the collection by the number of days (integer -7..7) Default: 1
holiday_pop_named No Ignore holidays (list of holiday names) Example: "Columbus Day", "Veterans Day"
prov No Country holidays - province (see holidays ).
state No Country holidays - state (see holidays ).
observed No Country holidays - observed (see holidays ).

PARAMETERS FOR ALL FREQUENCIES EXCEPT ANNUAL, EVERY-N-DAYS and GROUP

Attribute Required Description
collection_days Yes Day three letter abbreviation, list of "mon", "tue", "wed", "thu", "fri", "sat", "sun".

PARAMETERS FOR COLLECTION EVERY-N-WEEKS

Attribute Required Description
period No Collection every "period" weeks (integer 1-53)
Default: 1
first_week No First collection on the "first_week" week (integer 1-53)
Default: 1
(The week number is using ISO-8601 numeric representatio of the week)

Note: This parameter cannot be used to set the beginning of the collection period (use the first_month parameter for that). The purpose of first_week is to simply 'offset' the week number, so that the collection every n weeks does not always trigger on week numbers that are multiply of n. Technically, the value of this parameter shall be less than period, otherwise it will give weird results. Also note that the week numbers restart each year. Use every-n-days frequency if you need consistent period across the year ends.

PARAMETERS FOR COLLECTION EVERY-N-DAYS

Attribute Required Description
first_date Yes Repeats every n days from this first date
(date in the international ISO format 'yyyy-mm-dd').
period No Collection every "period" days (warning - in this configuration it is days, not weeks!)
Default: 1 (daily, which makes no sense I suppose)

PARAMETERS FOR MONTHLY COLLECTION

The monthly schedule has two flavors: it can trigger either on the nth occurrence of the weekday in a month, or on the weekday in the nth week of each month.

Attribute Required Description
weekday_order_number Yes/No List of week numbers of collection_day each month. E.g., if collection_day is "sat", 1 will mean 1st Saturday each month (integer 1-5)
week_order_number Yes/No Similar to weekday_order_number, but instead of nth weekday of each month, take the weekday of the nth week of each month.So if the month starts on Friday, the Wednesday of the 1st week would actually be last Wednesday of the previous month and the Wednesday of 2nd week will be the 1st Wednesday of the month.
period No If period is not defined (or 1), the schedule will repeat monthly. If period is 2, it will be every 2nd month. If period is 3, it will be once per quarter, and so on.
The first_month parameter will then define the starting month. So if the first_month is jan (or not defined), and period is 2, the collection will be in odd months (jan, mar, may, jul, sep and nov). If first_month is feb, it will be in even months. (integer 1-12)
Default: 1

One of the parameters weekday_order_number or week_order_number has to be defined. But you cannot combine both options in one sensor.

PARAMETERS FOR ANNUAL COLLECTION

Attribute Required Description
date Yes Date of the collection using format 'mm/dd' (e.g. '11/24' for November 24 each year)

PARAMETERS FOR GROUP

Attribute Required Description
entities Yes List of entity_ids to merge

IMPORTANT - put include/exclude dates within quotes. Dates without quotes might cause Home Assistant not loading configuration when starting - in case the date is invalid. Validation for dates within quotes works fine. I think this is general bug, I am addressing that. (See the example above)

STATE AND ATTRIBUTES

State

The state can be one of

Value Meaning
0 Collection is today
1 Collection is tomorrow
2 Collection is later

If the verbose_state parameter is set, it will show date and remaining days, for example "Today" or "Tomorrow" or "on 10-Sep-2019, in 2 days" (configurable)

Attributes

Attribute Description
next_date The date of next collection
days Days till the next collection
holidays List of used country (showing this year)
last_collection Date and time of the last collection

Services

garbage_collection.collect_garbage

If the collection is scheduled for today, mark it completed and look for the next collection. It will set the last_collection attribute to the current date and time.

Attribute Description
entity_id The gatbage collection entity id (e.g. sensor.general_waste)

Lovelace config examples

Garbage Collection custom card

You can use the custom garbage collection card developped by @amaximus.

With images (picture-entity)

This is what I use (I like images). I use a horizontal stack of picture-entities, with card-templater plugin (Lovelace Card Templater) to show number of days:

(The state is designed to be used like traffic lights, this is why it has 3 values. You obviously cannot use this with verbose_state)

This is the configuration

      - type: 'custom:card-templater'
        card:
          type: picture-entity
          name_template: >-
            {{ states.sensor.bio.attributes.days }} days
          show_name: True
          show_state: False
          entity: sensor.bio
          state_image:
            "0": "/local/containers/bio_today.png"
            "1": "/local/containers/bio_tomorrow.png"
            "2": "/local/containers/bio_off.png"
        entities:
          - sensor.bio

List view (entities)

The simplest visualisation is to use entities. In this case, I use verbose_state to show state as text.

Integration configuration (you can customise state text by verbose_format and date_format parameters)

garbage_collection:
  sensors:
  - name: General Waste
    frequency: 'weekly'
    collection_days: wed
    verbose_state: True
  etc...

Lovelace configuration

      - type: entities
        entities:
          - sensor.general_waste
          - sensor.bio
          - sensor.paper
          - sensor.plastic

Icon view (glance)

Integration configuration

garbage_collection:
  sensors:
  - name: General Waste
    frequency: 'weekly'
    collection_days: wed
    verbose_state: True
    verbose_format: "on {date}, in {days} days"
  etc...

Configuration

      - type: glance
        entities:
          - sensor.general_waste
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].