amaximus / garbage-collection-card Goto Github PK
View Code? Open in Web Editor NEWCustom Lovelace card for Garbage Collection custom component
License: MIT License
Custom Lovelace card for Garbage Collection custom component
License: MIT License
Hi,
it would be able to have some additional options as per:
I hope someone else will find those useful :)
Thanks for your work
Andrea
Hello,
hope i'm correct to paste this here:
i am getting errors regarding incorrect configs if i setup a garbage on specific dates only.
Did not find anything on the docs to have this explained.
Config is:
- name: Paper # specific dates
collection_days: "sat"
include_dates:
- '2020-03-05'
- '2020-04-02'
- '2020-05-07'
- '2020-06-05'
- '2020-07-02'
Thanks for your help in advance!
P.s. I already use your tool for some garbages - great, thanks a lot!
/ Ralf
The garbage collection integration recently came out with a service garbage_collection.collect_garbage. I'd like to be able click on the card to hide it until my next hide_before day.
according to HACS (and based on the hacs.json), the following should be added to lovelace..
/hacsfiles/garbage-collection-card/garbage-collection-card.zip
But according to the install info here it should be
/hacsfiles/garbage-collection-card/garbage-collection-card.js
Causing the following error in HACS:
Not loaded
This plugin is not added to your Lovelace resources.
Upgraded to 0.107 and now the card shows this error:
Almost all my other Lovelace cards needed to be reloaded with the upgrade, but this one didn't come back.
I tried
- type: module url: /www/community/garbage-collection-card/garbage-collection-card.js
- type: module url: /community-plugin/garbage-collection-card/garbage-collection-card.js
And neither worked.
After updating to 0.110 the icons have disappeared on my lovelace cards.
garbage_collection: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this
I think a release should be created for the card, when the repository shows up in hacs it shows the commit id which makes it hard to tell how outdated you are, it would be better if it would show up as a version numer
this is my config:
cards:
But i get de error: Cannot read property 'setConfig' of undefined
What can i do to solve this error
Apparently the card doesn't load the sensor.XX.json file and only use the English version. Everything in the XX.son is translated but not the sensor one.
As above, getting this error on homepage
I'm getting a strange error, in come cases when using this card. I have it working fine on one panel but not on another. I'm trying to use vertically stacked inside vertical-stack-in-card, like so:
- type: 'custom:vertical-stack-in-card'
cards:
show_icon: false
show_state: true
type: glance
- type: 'custom:garbage-collection-card'
entity: sensor.recycling_collection
icon_size: 35px
icon_color: green
hide_date: true
- type: 'custom:garbage-collection-card'
entity: sensor.rubbish_collection
icon_color: '#0561ba'
hide_date: true
The strange thing is, it works in the Preview modal, but then when I accept changes it's not displayed in the real LoveLace view, and there is the following console error reported:
Uncaught (in promise) TypeError: Cannot read property 'states' of undefined
at garbage-collection-card.js:59
at Array.forEach (<anonymous>)
at HTMLElement._getAttributes (garbage-collection-card.js:54)
at HTMLElement.set hass [as hass] (garbage-collection-card.js:263)
at HTMLElement.createCardElement (vertical-stack-in-card.js:95)
at vertical-stack-in-card.js:25
at Array.map (<anonymous>)
at HTMLElement.renderCard (vertical-stack-in-card.js:25)
at HTMLElement.setConfig (vertical-stack-in-card.js:20)
Is there a way to format the date from 2020-07-22 to 22/07/2020 ?
This happens in HA .110 and later, Firefox (Windows 10, Linux and Android).
No flicker in Chrome or Official Android app
It is looking for language translation that is non existent. Home assistant version 0.116
Logger: custom_components.hacs.web.category
Source: custom_components/hacs/webresponses/category.py:31
Integration: HACS (documentation, issues)
First occurred: 6:02:45 PM (3 occurrences)
Last logged: 6:02:45 PM
Tried to serve up '/config/www/community/garbage-collection-card/hr.json' but it does not exist
** To reproduce just restart HASS.
Environment (please complete the following information):
Temporary workaround:
Manually make copy of en.json and rename it to hr.json every time after update.
After updating from 1.4.0 to 1.5.0 the state is shown correctly, until collection day is tomorrow/today, then it just shows 'undefined'
This is the code in my ui-lovelace.yaml
- type: custom:garbage-collection-card
entity: sensor.date_pmd
icon_size: 35px
icon_color: green
hide_date: false
hide_before: 4
and this is my sensor template
sensors:
date_pmd:
friendly_name: 'PMD'
value_template: >-
wordt {% if (( as_timestamp(strptime(state_attr("sensor.afval_pmd","date"), "%Y-%m-%d"))
- as_timestamp(now()) ) / 86400 ) | round(0,"ceil") < 1 %}
vandaag
{%- elif (( as_timestamp(strptime(state_attr("sensor.afval_pmd","date"), "%Y-%m-%d"))
- as_timestamp(now()) ) / 86400 ) | round(0,"ceil") < 2 -%}
morgen
{%- else -%} over {{ (( as_timestamp(strptime(state_attr("sensor.afval_pmd","date"), "%Y-%m-%d"))
- as_timestamp(now()) ) / 86400 ) | round(0,"ceil") }}
dagen
{%- endif %} geleegd.
attribute_templates:
next_date: >-
{{ state_attr("sensor.afval_pmd","date") }}
verbose_state: >-
'true'
days: >-
{{ (( as_timestamp(strptime(state_attr("sensor.afval_pmd","date"), "%Y-%m-%d")) - as_timestamp(now()) ) / 86400 ) | round(0,"ceil") }}
This is the state of the sensor
And there is an error in the logfile,
2020-03-17 19:45:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.date_pmd fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/usr/src/homeassistant/homeassistant/components/template/sensor.py", line 224, in async_update
self._state = self._template.async_render()
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 222, in async_render
return compiled.render(kwargs).strip()
File "/usr/local/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/usr/local/lib/python3.7/site-packages/jinja2/sandbox.py", line 440, in call
return __context.call(__obj, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 814, in strptime
return datetime.strptime(string, fmt)
TypeError: strptime() argument 1 must be str, not None
In Danish translation I still get "Tomorrow" and "Today" instead of the Danish words
Hi,
Pickup was today and I clicked on the red icon, now the garbage dissapeared.
- entity: sensor.green_trash
type: 'custom:garbage-collection-card'
icon_size: 25px
icon_color: green
title_size: 13px
details_size: 14px
This is the config.
Can you tell me how to get it back ? I wanna see it always.
I'm trying to set up this card and I seem to be hitting a brick wall... I installed the card via HACS and it seems to be all present and correct, but when I start putting in the YAML code for the card, I get a message saying "No card type found" and a further one in orange saying, "Cannot read property 'setConfig' of undefined"
This is the code (after saving) that I have added to Lovelace to configure the card:
cards:
- entity: sensor.blue_bin
hide_date: false
icon_color: blue
icon_size: 35px
type: 'custom:garbage-collection-card'
resources:
- type: js
url: /community_plugin/garbage-collection-card/garbage-collection-card.js
I have a sensor called Blue Bin, which I configured using the Garbage Collection integration.
Hello,
It seems you does not support the last version of garbage collection (which has been updated).
I have this in my configuration :
garbage_collection:
sensors:
- name: Menager
frequency: "weekly"
verbose_state: True
verbose_format: "Dans {days} jours"
collection_days:
- tue
- fri
- name: Recyclable
frequency: "weekly"
verbose_state: True
verbose_format: "Dans {days} jours"
collection_days:
- wed
But in the UI, I still have the words in english, as shown here (using lovelace) :
The card configuration in use is :
- type: custom:garbage-collection-card
entity: sensor.menager
icon_color: blue
hide_date: true
- type: custom:garbage-collection-card
entity: sensor.recyclable
icon_color: green
hide_date: true
Am I missing something ?
Thx,
Grm
When I use the card verbose state doesn't show up. If I use a regular glance card, I have no problem.
Regular Glance Card:
Config:
type: glance
entities:
- entity: sensor.trash
- entity: sensor.recycling
Garbage Collection Card:
Config:
type: horizontal-stack
cards:
- entity: sensor.trash
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.recycling
icon_size: 35px
type: 'custom:garbage-collection-card'
Latest update in HACS - Lost garbage sensors
Setup through Integrations
2019-11-03 08:30:22 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Waste for garbage_collection
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
hass, self
File "/home/homeassistant/.homeassistant/custom_components/garbage_collection/__init__.py", line 75, in async_setup_entry
CC_STARTUP_VERSION.format(name=DOMAIN, version=VERSION, issue_link=ISSUE_URL)
NameError: name 'CC_STARTUP_VERSION' is not defined
2019-11-03 08:30:22 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Recycle for garbage_collection
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
hass, self
File "/home/homeassistant/.homeassistant/custom_components/garbage_collection/__init__.py", line 75, in async_setup_entry
CC_STARTUP_VERSION.format(name=DOMAIN, version=VERSION, issue_link=ISSUE_URL)
NameError: name 'CC_STARTUP_VERSION' is not defined
2019-11-03 08:30:22 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Green Waste for garbage_collection
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 190, in async_setup
hass, self
File "/home/homeassistant/.homeassistant/custom_components/garbage_collection/__init__.py", line 75, in async_setup_entry
CC_STARTUP_VERSION.format(name=DOMAIN, version=VERSION, issue_link=ISSUE_URL)
NameError: name 'CC_STARTUP_VERSION' is not defined
Hi the card is no longer showing any values for date or days. I've confirmed that the sensors are working as expected by using the sensor card instead, and can see:
Black Refuse on 03-Dec-2019, in 4 days
But when I use the garbage collection card I'm getting nothing now. I've tried with numerous combinations of hide_date and hide_day to no avail.
I'm seeing this error in the console when I add the garbage collection card:
create-card-element.ts:76 hui-sensor-card Error: Specify an entity from within the sensor domain.
at HTMLElement.value (hui-sensor-card.ts:162)
at ma (create-card-element.ts:73)
at va (create-card-element.ts:124)
at HTMLElement._createCard (hui-card-preview.ts:71)
at HTMLElement.set config [as config] (hui-card-preview.ts:65)
at m.commit (parts.js:368)
at b.commit (parts.js:111)
at o.update (template-instance.js:40)
at f.__commitTemplateResult (parts.js:236)
at f.commit (parts.js:186)
After installing 0.115 the garbage-collection integration is no longer working. The error from the log is below.
Setup failed for garbage_collection: Requirements for garbage_collection not found: ['typing'].
Thanks for this great app I find it extremely useful.
I am seeing the entry below in the my Home Assistant logs continuously. The translation file is clearly not at the location referenced, but there is a file en.json there.
My question is; is this a bug or have I missed a configuration step?
I am on the latest version installed via HACS.
[29/Jul/2020:20:51:18 +0000] "GET /local/community/garbage-collection-card/en-GB.json HTTP/2.0" 404 14
https://prnt.sc/ryxcam This is what im trying to do, read in the description here on github that each date should be encased with quotes like in my printscreen above, but it didnt change the outcome.
Is this broken, or am i using it wrong?
Describe the bug
The lovelace card is not visible (no error on the frontend) since the last update 0.118.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
I'm able to hide the card per the documentation, but when I go to hide the date, nothing happens.
I'm not sure what could be wrong. Everything else works just fine.
entity: sensor.trash
hide_date: true
hide_before: 2
icon_size: 40px
type: 'custom:garbage-collection-card`
I've configured 4 of these cards to show my different garbage-sensors. However it slows down my UI to almost a full stop. When I remove the card it is back to full speed.
I have three garbage collection sensors, and adding them to a view in my dashboard using this custom card slows my entire Lovelace interface down to a point where it is practically non-responsive.
The cards do load, but take a significant amount of time, and then any interaction with the Lovelace interface takes approximately 10 seconds to respond.
Opening the developer tools in chrome and looking at the console I am presented with a warning:
[Deprecation] Synchronous XMLHttpRequest on garbage-collection-card.js:281 the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help, check https://xhr.spec.whatwg.org/.
I don’t use verbose_state: true
as I use the numeric state for some automations.
This card was working perfectly for me in 0.114, I don’t know if some of the optimising that has been going on recently within HomeAssistant has caused this to happen?
Today I've noticed that the lovelace card, whilst showing the names and icons of the sensors it represents, shows 'undefined' instead of the due date for garbage collection.
Looking in 'states' the sensors are working correctly and as anticipated. I have verbose switched on.
Tried reverting to 1.2.1 but this has not fixed it. I think the problem has started since HA 104.2 was released.
My previously working config is otherwise unchanged. (HassOS 3.8, HA 104.2)
Version: 1.2.3
Installed from HACS, allowed interface to add resource entry to lovelace config.
Restarted hass for good measure.
Can not find custom element.
Resource added was: url: /community_plugin/garbage-collection-card/garbage-collection-card.js
There may be a few things wrong...
Changing url manually and restarting does not solve the issue.
Hi,
Can you add pl.json below you can find what need to be inside this file:
{
"state": {
"today": "dziś",
"tomorrow": "jutro",
"Today": "Dziś",
"Tomorrow": "Jutro"
},
"other": {
"due": "termin",
"Due": "termin",
"due_today_order": "true"
}
}
Hi, your card is great, but it can be better if is possible to define two different color for day before and on due date.
I'm trying to make use of this card on my lovelace dashboard, and it seems to work great for the most part, but I can't get it to observe the 'Hide_before' setting.
I've got two cards, both with 'hide_before' set to 7 each card looks at a different sensor - one has an expected date of 3 days, and another 10, yet both cards are visible.
I use this https://github.com/mampfes/hacs_waste_collection_schedule for the sources, which could be the issue - here is how the data shows in HA
Hello everyone!
Maybe it's just me or also some of you guys have the actual collection in the morning and the moment you actually bring your bin(s) in front of the house is the night before (or, if you forgot, the early morning of the collection day just before leaving for work) and by midday of the collection day you don't care about the card anymore and rather bothers you seeing it. Even though it was so useful a few hours before now you literally hate it to be there remembering you about something you've already done.
So, ideally, I'd love to have an interaction with the card in a "Google Reminder" style (giving you the chance to mark it as "Done" anytime) but I know it would be too complicated to ask therefore I will tune down my requests to only the followings:
This is something I thought a lot about in the past months because when it's evening on collection day and I still see that card it bothers me because it's really there for nothing, I mean I just care because I know it could be improved and I just have to dedicate the time to it and "fix" it.
I wanted to know how many of you were interested in order to see if it was worth to then be shared or not....
I don't know if my idea makes sense for you, I would gladly help you guys in doing it but I wanted to see check with you fist because you're smart people and you can show me why I'm wrong or maybe you can even improve my idea.
Just damping my though here... I'm looking forward to hearing yours!
Would it be possible to get an option to change the text size as we can do for the icon (with icon_size)?
Describe the bug
I had my Browser (Chrome) language changed to german on accident which lead the card to choose the german wording altough my hass user has en-GB set as a language.
I don't know if this is intentional or more of a question of which to prioritize.
To Reproduce
Change Browser to different language then your Homeassistant User.
Expected behavior
The Card Using the Homeassistant language.
Environment (please complete the following information):
Maybe if i have time i can create a PR if i have enough time this week...
It can possible, to implement the use of custom icon (for eg. a .jpg file )?
I have the following code for the card.
- cards:
- entity: sensor.garbage
icon_color: brown
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.garbage_2
icon_color: brown
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.recycle_2
icon_color: brown
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.branches_2
icon_color: green
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.yard_waste_2
icon_color: green
icon_size: 35px
type: 'custom:garbage-collection-card'
type: vertical-stack
'''
I can only see the card if I refresh the screen in chrome. If I try edit the ui is blank. I believe there is a conflict between this card and the vertical stack card. This code did work several updates ago. The custom garbage collection card does work by itself.
Hi,
with my code
type: 'custom:garbage-collection-card'
entity: sensor.stadtreinigung_hamburg_xxxx_gelbe_wertstofftonne_sack
icon_size: 35px
icon_color: yellow
hide_date: true
The Card works fine in Manual Card of Lovelace.
But all icons are red.
I installed via HACS.
Resources are set in Lovelace Dashboard (with Resources Tab shown).
I hope I have not missed a setting...
Regards
Jörg
Amendment:
These are the attributes shown in Developer Tools:
Last update: '2020-04-28T15:04:44.914633'
unit_of_measurement: ''
friendly_name: Biotonne
icon: 'mdi:trash-can-outline'
device_class: timestamp
If I put hide_days = true
it works as expected.
If I put nothing, it show the days as expected by default.
However if I explicitly put hide_days = false
, it still hide the days as if it was set to true
. It is not a big deal as it can be fixed by removing the hide_days
parameter altogether but it is a bit counterintuitive.
Hi,
Thank's for the card :)
I'm a french user, and i have set the verbose output of the garbage in french.
Your card seam to build it's own text, and it look like this isn't editable.
in order to have my text in french, i can enable verbose output on the entity, but that force the date on, something i don't want to see (bi-weekely, so no need there)
Could you add a way to ether:
By default, icon_color is black and due_color is red. This does not work very well with alternating HA themes (e.g. HA's default bright theme during the day, HA's default dark theme at night)
May I suggest changing the default colors to the theme's colors?
Users of custom themes would also benefit from that.
I have four different garbage sensors and set the color via
icon_color: blue
for example on my recycle. Sometimes it shows as blue sometimes brown.
Am I missing something?
-
cards:
- entity: sensor.trash
icon_color: brown
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.recycle
icon_color: red
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.branches
icon_color: green
icon_size: 35px
type: 'custom:garbage-collection-card'
- entity: sensor.yard_waste
icon_color: green
icon_size: 35px
type: 'custom:garbage-collection-card'
type: vertical-stack
It does work correctly when 1 individually. I tried loading the same three and they failed.
-
entity: sensor.trash
icon_color: brown
icon_size: 35px
type: 'custom:garbage-collection-card'
-
entity: sensor.recycle
icon_color: red
icon_size: 35px
type: 'custom:garbage-collection-card'
-
entity: sensor.branches
icon_color: green
icon_size: 35px
type: 'custom:garbage-collection-card'
-
entity: sensor.yard_waste
icon_color: green
icon_size: 35px
type: 'custom:garbage-collection-card'
I installed your card. Works great. Icon changed to red like it is supposed to a day before which is just what I want.
I have a Feature request of being able to increase the Icon size, The entity-button card allows you to add icon_height: 40px #or what ever height you want. In my layout I would like to have a bigger icon for a little more emphasis on the upcoming garbage day.
Thanks for creating this card.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.