Blackymas / NSPanel_HA_Blueprint

This allows you to configure your complete NSPanel via Blueprint with UI and without changing anything in the code
1.44k stars 258 forks source link

Waste collection Notofication - new feature #800

Open pawellygan opened 1 year ago

pawellygan commented 1 year ago

Many of us are using Waste collection integrations - and many of those have attribute DAYS_TO

Like here:

Screenshot 2023-05-09 at 17 09 01

It would be great to add an option to see Which Bin is gonna be collected in...(1 day or so) and here set how many days from the attribute. Let's say the day before collection you can set the lid color or icon or description of the due bin

This could be implemented as a notification as well - with the manual/automatic after-due day option 'remove'

deejaybeam commented 1 year ago

this can be easy done with an own automation:

- id: 'waste_collection'
  alias: Müll Rausstellen
  trigger:
    - platform: time
      at: '17:00:00'
  condition:
    - condition: numeric_state
      entity_id: sensor.abfallnaechster
      below: 2
  action:
    - service: esphome.nspanel02_play_rtttl
      data:
        song_str: "MahnaMahna:d=16,o=6,b=125:c#,c.,b5,8a#.5,8f.,4g#,a#,g.,4d#,8p,c#,c.,b5,8a#.5,8f.,g#.,8a#.,4g,8p,c#,c.,b5,8a#.5,8f.,4g#,f,g.,8d#.,f,g.,8d#.,f,8g,8d#.,f,8g,d#,8c,a#5,8d#.,8d#.,4d#,8d#."
    - service: esphome.nspanel02_notification_show
      data:
        label: 'Abfuhrkalender'
        text: "Müll rausstellen: {{ states.sensor.abfallnaechster.attributes.values() | first | replace('GelberSack', 'Gelber Sack') | replace('Restmuell', 'Restmüll') }}"

In this example every day at 17:00 waste-collection is checked. If something is picked up tomorrow it plays a sound and shows the notification. The example is from the description of the waste-collection project, but uses the services "notification_show" and "play_rtttl" that were made for this usecase.

To implement this into the blueprint would maybe be possible, but is out of scope of this project. In addition to too many possible parameters this would require translation to all supported languages.

maffi123 commented 1 year ago

Hi,

I'm interested in this feature, too. Actually, I have running some automation that switches helpers on / off if there is a bin collected next 15 hours.

I use a chip (in the color of the bin) for each bin. < Waste of 3 Chips, I have 4 different bins.

I would be glad if there is a possibility to show a -depending on which bin is going to be collected- colored icon on the lower right corner of the main page.

Or maybe there will be a possibility to have a colored frame around the main page... Depending on the bin.

edwardtfn commented 1 year ago

I would be glad if there is a possibility to show a -depending on which bin is going to be collected- colored icon on the lower right corner of the main page.

There is the service esphome.xxxxx_set_component_color (coming on v4.0, but there is another one for v3.4, which is not that easy, but still can be used). You can call that in an automation like suggested by @deejaybeam.

service: esphome.xxxxx_set_component_color
data:
  component: home.icon_top_04
  foreground: [255, 0, 0]
  background: []

The colors are passed in a array like [red, green, blue], from 0 to 255, so the example above will change the color to red without changing the background.

The chips 1 to 7 are using components icon_top_04 to icon_top_10, respectively.

How you see that solution?

kroessig commented 11 months ago

I would be glad if there is a possibility to show a -depending on which bin is going to be collected- colored icon on the lower right corner of the main page.

There is the service esphome.xxxxx_set_component_color (coming on v4.0, but there is another one for v3.4, which is not that easy, but still can be used). You can call that in an automation like suggested by @deejaybeam.

service: esphome.xxxxx_set_component_color
data:
  component: home.icon_top_04
  foreground: [255, 0, 0]
  background: []

The colors are passed in a array like [red, green, blue], from 0 to 255, so the example above will change the color to red without changing the background.

The chips 1 to 7 are using components icon_top_04 to icon_top_10, respectively.

How you see that solution?

is it also possible to change the sensor-icon-color? If yes, what is the name of the component?

edwardtfn commented 11 months ago

Yes, it should work.

Component names for icons are home.value01_icon, home.value02_icon and home.value03_icon. If you wanna change the sensor text also, those are home.value01_state, home.value02_state and home.value03_state.

thefirstavi commented 10 months ago

1473 Found this thread, have raised a seperate idea so that acknowledgment of the notification can update HA also

NdS-Research-Facilities commented 6 months ago

created a custom template in configuration.yaml for the afvalwijzer integration:

template:
  - sensor:
      - name: "afvalwijzer_tomorrow_color"
        state: >
          {% if is_state('sensor.afvalwijzer_tomorrow','False') %}
            False
          {% else %}
            True
          {% endif -%}
        attributes:
         kleur: >
            {% if is_state('sensor.afvalwijzer_tomorrow', 'gft') %}[3,97,6]
            {% elif is_state('sensor.afvalwijzer_tomorrow', 'papier') %}[5,13,242]
            {% elif is_state('sensor.afvalwijzer_tomorrow', 'pmd') %}[242,128,5]
            {% elif is_state('sensor.afvalwijzer_tomorrow', 'restafval') %}[120,120,120]
            {% else %}[255,1,1]
            {% endif -%}

      - name: "afvalwijzer_today_color"
        state: >
          {% if is_state('sensor.afvalwijzer_today','False') %}
            False
          {% else %}
            True
          {% endif -%}
        attributes:
         kleur: >
            {% if is_state('sensor.afvalwijzer_today', 'gft') %}[3,97,6]
            {% elif is_state('sensor.afvalwijzer_today', 'papier') %}[5,13,242]
            {% elif is_state('sensor.afvalwijzer_today', 'pmd') %}[242,128,5]
            {% elif is_state('sensor.afvalwijzer_today', 'restafval') %}[120,120,120]
            {% else %}[255,1,1]
            {% endif -%}

Then changed the nspanel yaml (automation) to show chips on today and tomorrows waste collection state:

    chip05: sensor.afvalwijzer_tomorrow_color
    chip05_icon: mdi:arrow-down-right
    chip05_icon_color: "{{ state_attr('sensor.afvalwijzer_tomorrow_color', 'kleur')}}"
    chip06: sensor.afvalwijzer_today_color
    chip06_icon: mdi:delete-circle
    chip06_icon_color: "{{ state_attr('sensor.afvalwijzer_today_color', 'kleur')}}"