
This post describes how I made a garbage reminder that changes every week. In my area, rubbish collection is on a two week cycle as per the following table
| Week 1 | Week2 | |
|---|---|---|
| Monday | Recycling / Council Rubbish | |
| Tuesday | Glass | Green waste / Rubbish Bin |
There has been some changes to what Home Assistant (HA) can provide, so this is all being done using the native options, without relying on third party plugins. This solution allows for an image to change depending upon the week. There are three components to make this solution
Lets get the brains of this solution configured first
Now we have our toggle switch, lets now get the picture card working, and then we can toggle the switch as required and confirm all works as expected. For this blog, I have used two random pictures to represent each week. Later I will update these to represent actual pictures of what I want.
I did this with XML code. Not sure if you can do this with built in editor.
type: picture-entity
entity: input_boolean.recycle_week
show_name: false
show_state: false
state_image:
'on': >-
https://images.unsplash.com/photo-1682686581551-867e0b208bd1?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwxfHx8ZW58MHx8fHx8
'off': >-
https://images.unsplash.com/photo-1703555508141-4397207fc6d2?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxlZGl0b3JpYWwtZmVlZHw1fHx8ZW58MHx8fHx8
tap_action: none
On the same dashboard
Note: We are only temporarily putting this on the dash board for us to test with. Once working, then we can remove this card.
If you do not have the local calendar integration installed, then you need to go into settings and install it. This will allow us to create a recurring schedule entry.
Create a new calendar (I have called mine Automations) where we are going to put into the repeating event.
Add a repeating calendar event, weekly. Since I have a Monday/Tuesday collection, I have made the event occur at 4:30pm on a Tuesday. I have chosen then, as by 4:30 on a Tuesday it is too late to put out the Rubbish, and then from Wednesday onward, it is correct. However, chose a time that suits yourself. Make a note of the name of the event you created, as we need this later - my event is called Change Recycling Week
Set the duration of the calendar event to 1 minute. We are only going to be reacting to the start of the event.
Now we have an event that is recurring, we now need to set up and automation that fires when the calendar event starts.
{{ trigger.calendar\_event.summary == 'Test Event' }}Change the calender event time to be > 15 minutes from now (HA only reads the calendar every 15 minutes). Make a note of the setting of the switch, and then see if it changes when the time elapses.
Banner photo by Clay Banks on Unsplash