Home-Assistant-Sensor-Afvalbeheer icon indicating copy to clipboard operation
Home-Assistant-Sensor-Afvalbeheer copied to clipboard

"volgende" sensor

Open hilsonp opened this issue 3 years ago • 5 comments

The "morgen" and "vandaag" sensors are great to set alerts/notifications. Nevertheless, I would love having a "volgende" sensor that would have as state:

  • "none": if no schedule can be found
  • "date: ressource, ressource, ..." with the date being the next date where a collect is found, then the list of ressources collected on that day (like the morgen and vandaag sensors display)

Here is a card I did that would be even better if the "head" entity was showing the next scheduled collect: `type: entities entities:

  • type: custom:auto-entities filter: include: - entity_id: sensor.recycleapp_* exclude: - entity_id: sensor.recycleapp_morgen - entity_id: sensor.recycleapp_vandaag - entity_id: sensor.recycleapp_textiel sort: method: attribute attribute: Sort_date card: type: custom:fold-entity-row head: entity: sensor.recycleapp_vandaag tap_action: action: fire-dom-event fold_row: true`

hilsonp avatar Mar 16 '22 23:03 hilsonp

You could do that with a template sensor. But I'll think about including the next-up sensor in this integration. But I'm struggling to see how useful this sensor would be..

pippyn avatar Mar 17 '22 07:03 pippyn

As you see, I keep on my dashboard a fold-entity-row that allows me, in a tap, to see the next collect day/date. I would like to see, when folded, the next collect(s).

Maybe you are right, the "morgen" entity should suffice... I'll see.

I'll go the template route and will post here if anyone else is interested.

hilsonp avatar Mar 22 '22 18:03 hilsonp

So. Here what I did:

A template sensor:

    - name: "Prochaine collecte"
      state: >
        {%- if now() > today_at("10:15") -%}
          {%- set next_collect = {
              "moment": "Demain: ",
              "garbage_items": states("sensor.recycleapp_morgen")
            }
          -%}
        {% else %}
          {%- set next_collect = {
              "moment": "Aujourd'hui: ",
              "garbage_items": states("sensor.recycleapp_vandaag")
            }
          -%}
        {%- endif -%}
        {%- if next_collect.garbage_items == 'None' -%}
          {%- set next_collect = {
              "moment": "",
              "garbage_items": "Aucune"
            }
          -%}
        {%- endif -%}
        {{ next_collect.moment }}{{ 
          next_collect.garbage_items 
            | regex_replace(find='gft', replace='Compost', ignorecase=False)
            | regex_replace(find='papier', replace='Cartons', ignorecase=False)
            | regex_replace(find='pmd', replace='PMC', ignorecase=False)
            | regex_replace(find='restafval', replace='Grise', ignorecase=False)
        }}
      icon: >
        {% if states("sensor.prochaine_collecte") is match("Demain", ignorecase=False) %}
          mdi:delete
        {% elif states("sensor.prochaine_collecte") is match("Aujourd'hui", ignorecase=False) %}
          mdi:delete-circle
        {% else %}
            mdi:delete-empty
        {% endif %}

An entity card:

entities:
  - type: custom:auto-entities
    filter:
      include:
        - entity_id: sensor.recycleapp_*
      exclude:
        - entity_id: sensor.recycleapp_morgen
        - entity_id: sensor.recycleapp_vandaag
        - entity_id: sensor.recycleapp_textiel
    sort:
      method: attribute
      attribute: Sort_date
    card:
      type: custom:fold-entity-row
      head:
        entity: sensor.prochaine_collecte
        name: Poubelles
        tap_action:
          action: fire-dom-event
          fold_row: true

Here are 2 examples:

  1. Closed (default) with collection of 2 items today (displayed like this until 10am): image

  2. Opened (when we tap on it) with no collection (as displayed after 10am): image

hilsonp avatar Mar 22 '22 21:03 hilsonp

Hi there! I would like the next up sensor also. With the possibility to have multiple and to have the terms today and tomorrow in it.

Examples: (today is the 6th of june)

Next up: Papier on june 10th

Next up: Tomorrow, june 7th is Papier

Next up: Today is Papier or if today and tomorrow there is pickups: Next up: Today is Papier, Tomorrow, june 7th is GFT and Restafval

I think having the possibility for a next up in HA is great for (week) planning. Besides, I have 3 bins, I don't want to display all 3 of them on the same time on my dashboard.

Venderwel avatar Jun 06 '22 21:06 Venderwel

The "morgen" and "vandaag" sensors are great to set alerts/notifications. Nevertheless, I would love having a "volgende" sensor that would have as state:

  • "none": if no schedule can be found
  • "date: ressource, ressource, ..." with the date being the next date where a collect is found, then the list of ressources collected on that day (like the morgen and vandaag sensors display)

Here is a card I did that would be even better if the "head" entity was showing the next scheduled collect: `type: entities entities:

  • type: custom:auto-entities filter: include:
    • entity_id: sensor.recycleapp_* exclude:
    • entity_id: sensor.recycleapp_morgen
    • entity_id: sensor.recycleapp_vandaag
    • entity_id: sensor.recycleapp_textiel sort: method: attribute attribute: Sort_date card: type: custom:fold-entity-row head: entity: sensor.recycleapp_vandaag tap_action: action: fire-dom-event fold_row: true`

Could you please provide how you set up an alert/notification. I have tried this but I don't get any

  • id: '1652266410200' alias: Afvalbeheer GLAS description: '' trigger:
    • platform: state entity_id:
      • sensor.limburg_net_afval_glas attribute: Days_until from: '2' to: '1' condition: [] action:
    • service: notify.mobile_app_iphone_11_van_wesley data: title: Geheugensteuntje message: GLAS buiten zetten !!! mode: single

WesleyLiekens avatar Jun 08 '22 07:06 WesleyLiekens