百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

Garbage-Collection

> 编程语言
开源

自定义 Home Assistant 传感器,用于计划垃圾收集 (或其他定期重复发生的事件 - 指定日期每周一次,每隔半周或每月一次)

394 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

自定义 Home Assistant 传感器,用于计划垃圾收集 (或其他定期重复发生的事件 - 指定日期每周一次,每隔半周或每月一次)

End of Support

Home Assistant has introduced local calendars in 2022, in the 2023.1 release they added an option for different recurent events. With this, most of the functionality of this custom helper is supported natively. So I will end developing and supporting this helper in 2023.

Table of Contents

  • Description

  • Installation

    • Manual Installation
    • Installation via Home Assistant Community Store (HACS)
  • Configuration

  • Blueprints for Manual Update

    • Public Holidays
    • Include and Exclude
    • Offset
    • Import TXT
    • Monthly on a fixed date
  • State and Attributes

  • Lovelace configuration examples

Garbage Collection

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

  • 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 - therefore, it restarts each year, as the weeks start from number 1 each year.
  • 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 a 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 weekday each month), or a specific weekday 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.
  • blank does not automatically schedule any collections - to be used in cases where you want to make completely own schedule with manual_update.

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.

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. Restart Home Assistant.
  4. Configure the garbage_collection helper.

INSTALLATION VIA Home Assistant Community Store (HACS)

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

Configuration

Go to Settings/Devices & Services/Helpers, click on the + CREATE HELPER button, select Garbage Collection and configure the helper. If you would like to add more than one collection schedule, click on the + CREATE HELPER button again and add another Garbage Collection helper instance.

The configuration hapend in 2 steps. In the first step, you select the frequency and common parameters. In the second step you configure additional parameters depending on the selected frequency.

The configuration via configuration.yaml has been deprecated. If you have previously configured the integration there, it will be imported to ConfigFlow, and you should remove it.

STEP 1 - Common Parameters

Parameter Required Description
Friendly name Yes Sensor friendly name
Frequency Yes "weekly", "even-weeks", "odd-weeks", "every-n-weeks", "every-n-days", "monthly", "annual", "group" or "blank"
Icon 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.
Obsolete - do the formatting on the dashboard instead.
Default: False
Hidde in calendar No Hide in calendar (useful for sensors that are used in groups)
Default: False
Manual update No (Advanced). Do not automatically update the status. Status is updated manualy by calling the service garbage_collection.update_state from an automation triggered by event garbage_collection_loaded, that could manually add or remove collection dates, and manually trigger the state update at the end. See the example.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.
Obsolete - do the formatting on the dashboard instead.
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)
Obsolete - do the formatting on the dashboard instead.
Default: '%d-%b-%Y'

STEP 2 - parameters depending on the selected frequency

...FOR ALL FREQUENCIES EXCEPT ANNUAL, GROUP and BLANK

Parameter Required Description
First month No Month three letter abbreviation, e.g. "jan", "feb"...
Default: "jan"
Last month No Month three letter abbreviation.
Default: "dec"

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

Parameter Required Description
Collection days Yes Day three letter abbreviation, list of "mon", "tue", "wed", "thu", "fri", "sat", "sun".

...FOR COLLECTION EVERY-N-WEEKS

Parameter Required Description

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythongarbage-collectionhacshomeassistantschedule

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言