I was in the middle of a Magic Mirror build when I came across HA. The one thing I missed from MM was the compliments module. It injected a bit of personality into the project. I saw a post on reddit that reminded me of it so I threw this together. It creates a list of messages based on the day, date, weather, time, whatever, and spits out a random one. I use it in a picture elements card along with the time and date.
sensor:
- platform: template
sensors:
mixed_message:
friendly_name: Messages
value_template: >
{% set randolist = [] %}
{% set day = now().strftime('%A') %}
{% set date = now().strftime('%m-%d') %}
{% set daynotes = {
'Monday': ["Looks like somebody has a case of the Mondays", "It's just another manic Monday."],
'Wednesday': ["Humpday"],
'Friday': ["More like Fri-yey!", "Weekend, here we come!"],
'Sunday': ["It's my funday."] } %}
{% set datenotes = {
'01-01': ["Happy New Year","New Yeay, New You!"],
'02-14': ["Love is in the air", "Won't you be my Valentine?"],
'03-17': ["Get yer hands off me Lucky Charms!"],
'07-04': ["Don't loose a finger."],
'10-31': ["BOO!", "Happy Halloween!!","Trick-or-Treat!","Gimme some candy!"],
'12-24': ["Here comes Santa!", "Ho HO HO!"],
'12-25': ["Merry Christmas!", "Home you got something good." ],
'12-31': ["Can we make it up to Midnight?"]} %}
{% set weatherdetailnotes = {
'heavy thunderstorm': ["It's Cats and Dogs out there!"],
'heavy snow': ["Grab the snow shovel."],
'light snow': ["Scrape up enough for a snowball?"],
'rain and snow': ["YUCK!"],
'freezing rain': ["Alright, fire up the hot chocolate."],
'extreme rain': ["The rain is, literally, extreme."],
'broken clouds': ["Where's the sun?"],
'overcast clouds': ["What a dreary day"]} %}
{% set weathernotes = {
'Rain': ["Rain, rain, go away.","Don't forget your umbrella."],
'Snow': ["IT'S HAPPENING!","Would you like to build a snowman?","I smell a snowball fight..."],
'Drizzle': ["I'm not down with the drizz."],
'Fog': ["It's as thick as pea soup out there."],
'Mist': ["I'm not down with the drizz."],
'Haze': ["It's hazy but not purple."],
'Smoke': ["Cough, Cough", "Damn wildfires."],
'Tornado': ["SEEK SHELTER!","Tornados!","SEEK SHELTER!","Tornados!"],
'Clear': ["It's nice outside."],
'Thunderstorm': ["Anyone have a key and a kite?","THUNDERSTRUCK!","KABOOM!"]} %}
{% if datenotes.get(date) != None -%}
{% set randolist = randolist + datenotes.get(date) %}
{% endif %}
{% if daynotes.get(day) != None -%}
{% set randolist = randolist + daynotes.get(day) %}
{% endif %}
{% if as_timestamp(now()) | timestamp_custom('%H') | int < 11 %}
{% set randolist = randolist + ["Morning", "Mornin\'", "Good morning", "Bonjour", "It's a new day", "Good to see you", "Welcome back", "Looking good today", "Happy " ~day] %}
{% elif as_timestamp(now()) | timestamp_custom('%H') | int < 12 %}
{% set randolist = randolist + ["What's for lunch?", "Happy " ~day] %}
{% elif as_timestamp(now()) | timestamp_custom('%H') | int < 18 %}
{% set randolist = randolist + ["Afternoon", "Aft\'noon", "Good afternoon", "Howdy", "Hi there", "Have you been working out?", "Happy " ~day] %}
{% elif as_timestamp(now()) | timestamp_custom('%H') | int < 20 %}
{% set randolist = randolist + ["How was dinner?","Get those kids to bed!","Evening", "Evenin\'"] %}
{% if day == 'Tuesday' %}
{% set randolist = randolist + ["Don't forget the bins."] %}
{% endif %}
{% else %}
{% set randolist = randolist + ["Time to binge watch!", "Nighty night.", "See you tomorrow.","Don't let the bedbugs bite."] %}
{% if states('sensor.openweathermap_weather') == 'Clear' %}
{% set randolist = randolist + ["My God, it's full of stars!", "Go outside and look up tonight!"] %}
{% endif %}
{% endif %}
{% if weathernotes.get(states('sensor.openweathermap_condition')) != None %}
{% set randolist = randolist + weathernotes.get(states('sensor.openweathermap_condition')) %}
{% endif %}
{% if weatherdetailnotes.get(states('sensor.openweathermap_weather')) != None %}
{% set randolist = randolist + weatherdetailnotes.get(states('sensor.openweathermap_weather')) %}
{% endif %}
{{ randolist|random }}
I’m sure it could be improved but it’s a start.