Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional aggregated sensor to show next bin[s] #574

Closed
skelt0 opened this issue Jan 13, 2024 · 4 comments · Fixed by #907
Closed

Add additional aggregated sensor to show next bin[s] #574

skelt0 opened this issue Jan 13, 2024 · 4 comments · Fixed by #907
Labels
enhancement New feature or request

Comments

@skelt0
Copy link
Contributor

skelt0 commented Jan 13, 2024

At the moment the integration provides one sensor per bin type - with each sensor having additional attributes.

It would be useful if additional sensor was added called 'Next Bin' which displayed the type of the next bin due based on the dates. If multiple bins on the next date due, then provide multiple.

This would allow much easier automations to be driven from this rather than having to work things out.

For an example automation, it would be useful to trigger a light to show Blue, if the Blue bin was due to go out tomorrow. This light would go off on the trigger of an additional automation once the bin has been taken out.

I think this is possible in the current setup but adding this sensor would make it far simpler to implement for users. This may also be a more useful dashboard view for some users / reduce clutter.

Example entity:
Name: Next Bin
Data: Blue

Additional attributes:
Date: ('tomorrow')
Days: 3

@dp247 dp247 added the enhancement New feature or request label Jan 16, 2024
@mrw298
Copy link
Contributor

mrw298 commented Jan 22, 2024

If it helps anyone, this is the template I use:

sensor:
    - name: "Next Bin"
      state: >-
        {% if (state_attr("sensor.black_bin", "days") | int(99)) < (state_attr("sensor.blue_bin", "days") | int(99)) %}
        Black Bin
        {% else %}
        Blue Bin
        {% endif %}
      attributes:
        days: >-
          {% if (state_attr("sensor.black_bin", "days") | int(99)) < (state_attr("sensor.blue_bin", "days") | int(99)) %}
          {{ state_attr("sensor.black_bin", "days") }}
          {% else %}
          {{ state_attr("sensor.blue_bin", "days") }}
          {% endif %}
        next_collection: >-
          {% if (state_attr("sensor.black_bin", "days") | int(99)) < (state_attr("sensor.blue_bin", "days") | int(99)) %}
          {{ state_attr("sensor.black_bin", "next_collection") }}
          {% else %}
          {{ state_attr("sensor.blue_bin", "next_collection") }}
          {% endif %}
        friendly_date: >-
          {% if (state_attr("sensor.black_bin", "days") | int(99)) < (state_attr("sensor.blue_bin", "days") | int(99)) %}
          {{ states("sensor.black_bin") }}
          {% else %}
          {{ states("sensor.blue_bin") }}
          {% endif %}
        color: >-
          {% if (state_attr("sensor.black_bin", "days") | int(99)) < (state_attr("sensor.blue_bin", "days") | int(99)) %}
          black
          {% else %}
          blue
          {% endif %}
        icon: >-
          {% if (state_attr("sensor.black_bin", "days") | int(99)) < (state_attr("sensor.blue_bin", "days") | int(99)) %}
          mdi:trash-can
          {% else %}
          mdi:recycle
          {% endif %}

@robbrad
Copy link
Owner

robbrad commented Oct 13, 2024

So in summary @skelt0 your asking for the attributes to be broken out into sensors?

@robbrad
Copy link
Owner

robbrad commented Oct 13, 2024

Maybe the bin should be a “Device” ?

@skelt0
Copy link
Contributor Author

skelt0 commented Nov 1, 2024

Sorry for the lack of feedback - Yes, these changes make a huge difference and make automations significantly simpler! I updated the plugin last night and it works brilliantly - Thanks for all your continued work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants