Your tutorials are always so easy to follow, even if they cover quite complex topics. Thanks to you I've made an amazing custom button card dashboard from previously having a very rudimentary knowledge of jinja and button card in general.
I got the map working, even with an image instead of text, but what I still want to get to work is that tap-action, can you tell me or show me how to get that done?
Thanks. That's crazy. I barelly got pop-ups working and my next task is flashing tasmota to sonoff panel.. Seeing what can be done lol.. There is long way ahead still
nice tutorial! tip: you dont have to restart HA to initiate a new template-sensor, there is a option to only reload template-entities (In norwegian its "Malentiteter")
Thank you for sharing your awesome ideas and great tutorials! Unfortunately the template doesn't work for me, the state of sensor.next_collection is always "unavailable". The reason are probably my waste collection sensors. Their state is the correct number of days until the next pickup, yet I think the state attribute isn't correctly assigned. Can you tell me how I can assign them the correct attribute (days_to_pickup)?
So I have just had the same issue. From the "Waste Collection Schedule", select CONFIGURE and tick "Add New sensor" If you don't have any to modify then click Submit. Create a new sensor for the bin collection you want to monitor, for example: "recycling" Then I chose Generic and ticked "Add Days To" and under "Types" you should enter "RECYCLING" this means it will group all the recycling jobs under this sensor with an Attribute called "daysTo". I know this isn't exactly "days_to_pickup" but this is how I got it to work. You'll need to watch out for the change in the template code, but there is only one reference to swap out.
Hi. If you could make it to pull data from google calendar that would be amazing. I'm sure i'm not the only one living in a black-hole for which garbage pickup dates aren't available on any of the providers mentioned in Waste Collection Services
How to do this is mentioned in the documentation for Waste Collection Services. Among the documention for different provides, look for the section on ICS.
I really enjoyed the video! However, it would be great if the next pickup dates for the different types of waste could be displayed on the far right. Do you have any idea how to do that? I already tried to add a third column but failed.
Great tutorial! I however ran into an issue; the sensor is working but I can't get the custom card going it says: "Custom element doesn't exist: button-card." found out that I had to install the HACS lovelace button card first.
In my case sensor has been created but... days are not available.. sure it's not defined... So here is the question how to setup the date? In my case it's every Tuesday 7 AM
So its a fixed time every week? Do you really need a reminder? This will count days until tuesday, edit first line if its not correct for you. {% set target_day = 1 %} {# Tuesday is 1 #} {% set current_day = now().weekday() %} {% if current_day == target_day %} 0 {% else %} {{ ((target_day - current_day) + 7) % 7 }} {% endif %} AI is great for this kind of stuff.
@@My_Smart_Home for me its the same. I think, it's due to the state format of the sensor. Mine are set up like this: - platform: waste_collection_schedule name: AbfallPapier details_format: "upcoming" count: 4 value_template: 'in {{value.daysTo}} Tag(en)' date_template: '{{value.date.strftime("%d.%m.%Y")}}' types: - papier the states look like this: 'in 17 Tag(en)'
@@deralte680 I had the same issue as you. There are 2 ways to get the same goal. A fast way without filtering the types and a more complex way like in the video: Without filtering the garbage types you can just adjust the value_template and remove the types attribute. Then you just get the garbage type which gets collected next time. - platform: waste_collection_schedule name: NextCollection value_template: {{value.daysTo}}{value.types|join(", ")}}' To be able to filter to only garbage types you wan to have I have created a sensor for each garbage type with the same value_template then for the nextCollection sensor. Later I have updated the code for the own next garbage collection sensor like: {% set garbage_types = { states.sensor.your_restmull_sensor.state.split(',')[0]: "Restmüll", states.sensor.your_papier_sensor.state.split(',')[0]: "Papiermüll", states.sensor..your_bio_sensor.state.split(',')[0]: "Biomüll", states.sensor..your_gelbe_sensor.state.split(',')[0]: "Gelbe Tonne" } %} {% set pickup_days = namespace(min=999, types=[])%} {% for garbage_type in garbage_types.items() %} {% set days = garbage_type[0] | int %} {% if days < pickup_days.min %} {% set pickup_days.min = days %} {% set pickup_days.types = [garbage_type[1]] %} {% elif days == pickup_days.min %} {% set pickup_days.types = pickup_days.types + [garbage_type] %} {% endif %} {% endfor%} {% set types_string = pickup_days.types | join('and') if pickup_days.types | length > 1 else pickup_days.types[0] %} {{ pickup_days.min }},{{ types_string }} That worked for me as a workaround. Not the smoothest way I know, but it fixes the issue I had with the original state format of the sensors.
Your tutorials are always so easy to follow, even if they cover quite complex topics. Thanks to you I've made an amazing custom button card dashboard from previously having a very rudimentary knowledge of jinja and button card in general.
Great to hear! Thanks for watching!
Super nice work as always dude tack så mycket
Takk mann! Hopefully not too many will fall off during that templating section 😅
I got the map working, even with an image instead of text, but what I still want to get to work is that tap-action, can you tell me or show me how to get that done?
Thanks. That's crazy. I barelly got pop-ups working and my next task is flashing tasmota to sonoff panel.. Seeing what can be done lol.. There is long way ahead still
Its a rabbit hole for sure!
nice tutorial! tip: you dont have to restart HA to initiate a new template-sensor, there is a option to only reload template-entities (In norwegian its "Malentiteter")
Thank you for sharing your awesome ideas and great tutorials! Unfortunately the template doesn't work for me, the state of sensor.next_collection is always "unavailable". The reason are probably my waste collection sensors. Their state is the correct number of days until the next pickup, yet I think the state attribute isn't correctly assigned. Can you tell me how I can assign them the correct attribute (days_to_pickup)?
So I have just had the same issue. From the "Waste Collection Schedule", select CONFIGURE and tick "Add New sensor" If you don't have any to modify then click Submit. Create a new sensor for the bin collection you want to monitor, for example: "recycling" Then I chose Generic and ticked "Add Days To" and under "Types" you should enter "RECYCLING" this means it will group all the recycling jobs under this sensor with an Attribute called "daysTo". I know this isn't exactly "days_to_pickup" but this is how I got it to work. You'll need to watch out for the change in the template code, but there is only one reference to swap out.
@@SimplifyingChaos where can i find Waste Collection Schedule
Hi.
If you could make it to pull data from google calendar that would be amazing. I'm sure i'm not the only one living in a black-hole for which garbage pickup dates aren't available on any of the providers mentioned in Waste Collection Services
How to do this is mentioned in the documentation for Waste Collection Services. Among the documention for different provides, look for the section on ICS.
I really enjoyed the video! However, it would be great if the next pickup dates for the different types of waste could be displayed on the far right. Do you have any idea how to do that? I already tried to add a third column but failed.
Thats a good idea, I'll look into it. Might have to do a similar template so it would be nice if we could somehow do it without so much code.
@@My_Smart_Home Something like this works for me. but I'm not a designer:
type: conditional
conditions:
- condition: numeric_state
entity: sensor.wastepickupdays
below: 10
card:
type: custom:button-card
entity: sensor.wastepickupdays
show_icon: false
name: |
[[[
if (entity.state == 0) {
return '';
} else {
return states['sensor.wastepickupdays'].state;
}
]]]
label: |
[[[
if (entity.state == 0) {
return 'Heute wirdabgeholt:';
} else if (entity.state == 1) {
return 'Tag bis zurAbholung';
} else {
return 'Tage bis zurAbholung';
}
]]]
show_label: true
custom_fields:
type: |
[[[
return states['sensor.wastepickuptype'].state;
]]]
next: |
[[[
let sensors = [
'sensor.wastepickup_bio',
'sensor.wastepickup_restabfall',
'sensor.wastepickup_plastik',
'sensor.wastepickup_gartenabfall',
'sensor.wastepickup_papier'
];
// Funktion, um die Zahl (Tage) aus dem State zu extrahieren
function extractDays(state) {
let match = state.match(/: (\d+) Tagen/); // Sucht nach "in X Tagen"
return match ? parseInt(match[1]) : 0; // Falls keine Zahl gefunden wird, 0 zurückgeben
}
// Array der Sensoren mit ihren States und extrahierten Tagen
let sensorStates = sensors.map(sensor => {
let state = states[sensor].state;
return { sensor, state, days: extractDays(state) };
});
// Sortierung nach den Tagen
sensorStates.sort((a, b) => a.days - b.days);
// Den ersten (obersten) Eintrag entfernen
sensorStates.shift();
// Die restlichen sortierten States in output speichern
let output = '';
sensorStates.forEach(sensorData => {
output += sensorData.state + '';
});
return output; // Alle restlichen sortierten States zusammen zurückgeben
]]]
tap_action:
action: navigate
navigation_path: '#trash'
styles:
grid:
- grid-template-areas: '"n l next" "n type next";'
- grid-template-columns: 30% 1fr 1fr;
- grid-template-rows: 30% 1fr;
name:
- font-size: 70px
- font-weight: 800
- justify-self: center
- align-self: center
- color: var(--contast20)
card:
- margin-top: 10px
- margin-bottom: 10px
label:
- justify-self: start
- font-size: 22px
- font-weight: 500
- color: var(--contast20)
- text-align: left
custom_fields:
type:
- justify-self: start
- font-size: 18px
- font-weight: 500
- padding-top: 30px
- color: var(--contast20)
next:
- justify-self: end
- font-size: 12px
- font-weight: 500
- text-align: right;
- color: var(--contast20)
- padding: 26px 26px 0px 0px
Great tutorial! I however ran into an issue; the sensor is working but I can't get the custom card going it says: "Custom element doesn't exist: button-card." found out that I had to install the HACS lovelace button card first.
You need to install the custom button card from HACS. I see now that I forgot to add the link in the description
github.com/custom-cards/button-card
In my case sensor has been created but... days are not available.. sure it's not defined...
So here is the question how to setup the date? In my case it's every Tuesday 7 AM
So its a fixed time every week? Do you really need a reminder?
This will count days until tuesday, edit first line if its not correct for you.
{% set target_day = 1 %} {# Tuesday is 1 #}
{% set current_day = now().weekday() %}
{% if current_day == target_day %}
0
{% else %}
{{ ((target_day - current_day) + 7) % 7 }}
{% endif %}
AI is great for this kind of stuff.
For me write unavaible sensor😢
Did you edit the sensors at the start of the template to match your own?
@@My_Smart_Home for me its the same. I think, it's due to the state format of the sensor. Mine are set up like this:
- platform: waste_collection_schedule
name: AbfallPapier
details_format: "upcoming"
count: 4
value_template: 'in {{value.daysTo}} Tag(en)'
date_template: '{{value.date.strftime("%d.%m.%Y")}}'
types:
- papier
the states look like this: 'in 17 Tag(en)'
@@deralte680 I had the same issue as you.
There are 2 ways to get the same goal. A fast way without filtering the types and a more complex way like in the video:
Without filtering the garbage types you can just adjust the value_template and remove the types attribute. Then you just get the garbage type which gets collected next time.
- platform: waste_collection_schedule
name: NextCollection
value_template: {{value.daysTo}}{value.types|join(", ")}}'
To be able to filter to only garbage types you wan to have I have created a sensor for each garbage type with the same value_template then for the nextCollection sensor.
Later I have updated the code for the own next garbage collection sensor like:
{% set garbage_types = {
states.sensor.your_restmull_sensor.state.split(',')[0]: "Restmüll",
states.sensor.your_papier_sensor.state.split(',')[0]: "Papiermüll",
states.sensor..your_bio_sensor.state.split(',')[0]: "Biomüll",
states.sensor..your_gelbe_sensor.state.split(',')[0]: "Gelbe Tonne"
} %}
{% set pickup_days = namespace(min=999, types=[])%}
{% for garbage_type in garbage_types.items() %}
{% set days = garbage_type[0] | int %}
{% if days < pickup_days.min %}
{% set pickup_days.min = days %}
{% set pickup_days.types = [garbage_type[1]] %}
{% elif days == pickup_days.min %}
{% set pickup_days.types = pickup_days.types + [garbage_type] %}
{% endif %}
{% endfor%}
{% set types_string = pickup_days.types | join('and') if pickup_days.types | length > 1 else pickup_days.types[0] %}
{{ pickup_days.min }},{{ types_string }}
That worked for me as a workaround. Not the smoothest way I know, but it fixes the issue I had with the original state format of the sensors.