Custom Component for creating yearly, monthly, daily and one time reminders

I’ve created a new custom component for creating reminders, you can check it out here.

With this configuration:

# Example configuration.yaml

date_notifier:
# One Time Reminder will be send 1 day before the event date, on date 2017-11-19 at 21:25
  one_time_reminder:
    name: "one-time test"
    hour: 21
    minute: 25
    day: 20
    month: 11
    year: 2017
    message: "one-time test"
    days_notice: 1
    notifier: "ios_tomers_iphone6s"

# Yearly Reminder will be send 2 days before the event date every year, on November 19th at 21:26
  yearly_reminder:
    name: "yearly test"
    hour: 21
    minute: 26
    day: 21
    month: 11
    message: "yearly test"
    days_notice: 2
    notifier: "ios_tomers_iphone6s"

# Monthly Reminder will be send on the 19th of every month at 21:27
  monthly_reminder:
    name: "montly test"
    hour: 21
    minute: 27
    day: 19
    message: "montly test2"
    notifier: "ios_tomers_iphone6s"
  
# Daily Reminder will be send every day at 21:28
  daily_reminder:
    name: "daily test"
    hour: 21
    minute: 28
    message: "daily test"
    notifier: "ios_tomers_iphone6s"

I was able to test and get all four types of the reminders within four minutes ending on date 2017-11-19 at 21:28:

.

This is the code for the custom component.

I’ll be happy to read what you think about this new component.

4 Likes

Looks great. :smile:

Any chance of adding weekly with an option for (or separate) fortnightly? I’m thinking bin collections and things.

1 Like

Yeah I thought about adding a weekday variable for choosing a specific day of week for a reminder, just didn’t have enough time for doing it.
I’ll probably add it by the end of this week.

That should take care of the bin collections and other weekday stuff I think, no?

Well, for me here it’s recycling bin one week and waste bun the next, and as I work shifts I’m lucky if I remember bin day, let alone which actual bin.

So I’d need fortnightly, be it an option of weekly or a separate option to itself.

I can think of lots of uses as it is, but weekly and fortnightly would be a plus.

@TomerFi i use telegram to notify me.
your component Works with telegram?

isnt it a bit unpractical to add a 1 time reminder to the yaml?
if you want to add a timer you need to restart hass after you added the timer.

i also have reminders that i can set yearly,monthly, weekly, or daily, but i use a specific google calender for that.
but its also easy to use appdaemon to remind you on a time that you like and you could place the reminders in a spreadsheet, a DB or a textfile.

can u share your config?

@anon43302295
Sounds like a great feature, I’ll look into adding it. Thank you.

@Rodolfo_Vieira
Yes, this component should work well with telegram.

@ReneTode
If you would have taken a look in my instructions on my repository, you would have seen I added a special note at the bottom saying that I plan on adding a “Realod Configuration” service to my component which will allow the reloading of the configuration without restarting hass.
That being said, this components main goal was allowing me to receive notifications about recurring events, the “One Time” reminder was more like a “while I’m on it” thing…

As far as I can tell, my component achieved its goals, and it was pretty simple developing it and even simpler using it.
I don’t see any reason using google calendar, appdaeomn and db/textfile for this purpose, it seems a bit of an overkill for a purpose as simple as sending out notifications based on dates and times.

On another note, this forum is called “Share your Projects!” and I did.
If you have any suggestions on making it better, I would love to read them and even apply them if I can.
If you have a better way of accomplishing the same goal, It would be great if you share it with the rest of us.
If you just feel my project is “unpractical”, I’m going to let you in on a little secret: you don’t have to do the same, you don’t even have to comment on it. You can do what ever you want in your own installation of hass and it would be nice if you shared what ever it is you did with this community, but you don’t have to.
I for one, thinks this project is very practical and useful, but… that’s just me.
Have a great day!

5 Likes

i am sorry if i did offend you.
didnt want to do that.

the reason i wrote it was not to put you or your work down.
i wrote it because i had the idea it was a bit unpractical and to point out that there are more practical ways (in my opinion) to adchieve the same goal. that might be some ways that you hadnt thought of before or didnt know that were there, so it could have been that you would have found it helpfull. maybe others that search for a solution for this kind of things also dont know about those options.

so my intentions were just something helpfull and i am sorry if i did write it down in a way that that didnt come out of it.

adding a reload config for the component would make that it makes way more sense you are right.
and if you only for this goal need to create an google account i can see your point that its a bit of an overkill.
i use google calender anyway (or at least my wife does :wink: ) so it made sense.

@Rodolfo_Vieira i have my notification functions in appdaemon anyway, so it wouldnt be helpfull for you.
but i know that in the instructions for the google calender component there are instruction for how to set reminders for an event you have in the calender. and in a calender you can give a weekly, monthly or yearly appointment.
so if you have google calender component installed then the notifications are almost default.

Actually I do have a google account, but I don’t use it as much as I would like to, I don’t know why.
My wife, on the other end, doesn’t have any calendar in use (besides her memory I guess :wink:).

We recently had a couple of incidents where we ended up apologizing to a couple of “important” people about forgetting their special dates (people are real sensitive about their birthdays for some reason :face_with_raised_eyebrow:).

That’s when I came up with the idea of creating a custom component for yearly reminders, all the other types of reminders was more like a “nice to have” features for me and my wife.

Reminders and custom components aside, I’m kind of new to hass, only started about a month and a half ago, and I’m trying to take baby steps in regards to adding external features like appdaemon.
I did read a little about it in the context of hadashboard, If you can share an example for your use with appdaemon it would be much appreciated, I’m sure I will learn a lot from it.

if you already have a google account you could use that for your reminders.
you can create extra sensors with it that go to a certain state if an offset that you set in the appointment is reached and then with an simple automation you can do anything you like with it. (flash lights, start a sirene, etc. :wink: )

it makes a little more sense to use a calender that you have with you all time to create reminders for yourself then something that you only can do at home.
just check out the google calender component for ideas and i am sure that if you search the forum there are lots of things to be found about it.

about my use off appdaemon:
I never did like the yaml way of automating. it was only usefull for some simple tasks but as soon as i wanted more complicated things i jsut couldnt figure it out.
in that time @aimc developed appdaemon. its just python so a basic programming language, that has a lot of extra functions esspecially created for HA.
some examples of my use:

  • i have a google calender :wink: for the times and dates that the favourite soccerteam from my wife plays a game. with appdaemon i let it remind my wif 1 hour before, 1/2 hour before and at the start of the game that the game is there. when the game starts appdaemon goes to a website that has a kind of live report from the game. they write something every minute about what is happening. Appdaemon reads that and with TTS it is spoken out on my soundsystem.
  • in the appdaemon yaml (yes it has also yaml nowadays) i have a list of the lights i want to go on or off. i just write the time and day behind it and the app knows what to do.
  • i track motion on places around the house. with some apps i create and set the state from some sensors. that makes that i have sensors like sensor.rene_in_bed: yes/no so HA knows who is in bed and who is awake and with other apps i base my action on those sensors.
  • i created apps for my backups on all sort of ways
  • for my wife i have a recipe book. she can edit and add html files on the PC. an app keeps that in sink with a directory on my RPI. if the app sees that somthing has changed it rewrites the dashboard that i created for it. in the kitchen she has a dashboard where she can look at her recipes.
  • some days we need to set out the garbage. those days i put in a calender at the start of the year. but many times we still did forget it. and even if we did look in the calender in the morning, we did forget it sometimes during the day. now it is that an app looks if the garbage needs to be put out. if so it start speaking a message every hour, untill we push a button on the dashboard that the garbage has been taken care off.
  • if the phone rings, the radio is silenced when on, the TV is set to pause when on, also something that wouldnt be easy to adchieve in yaml.
  • on friday and saturday nights we like to look some things on the beamer. i tell alexa that she needs to switch the beamer on. then an app switches some lights on or off. thats just quite simple stuff. what is less simple is that the screen needs to come down. an remote controlled signal is send to the screen to start and 33 seconds later another signal is send to stop the screen. in the mean time the beamer is switched on and set to a certain channel.

just a small amount of possibilities that i use with appdaemon and HA.
i hope i can inspire you with those things, to adchieve stuff that i never would think about.

1 Like

WOW that’s awesome. Thank you very much!

A couple of this automatons are also doable with hass’s yaml files, but I would imagine it would be much easier with appdaemon.

Based on what you wrote here, the google stuff, the backups, the recipe book and all the other great examples of use you provided.

I think I need to check out appdaemon asap. :grin:

1 Like

as a bonus you get HAdashboard with appdaemon.

some of my dashboards:




some are a bit older :wink:

2 Likes

That’s amazing!

I think I’m getting a headache from all the ideas running around in my head right now.
:face_with_head_bandage:

write them down before you forget some :wink:
you need quite an amount of time to get to a point where you have adchieved all the ideas.
i have a big list of things i want to do in the (near) future :wink:

i am glad i could inspire you, allthough i might have started the wrong way, but the result is what counts :wink:

Since upgrad 0.62.0 i get those error messages:

Tue Jan 30 2018 14:58:04 GMT+0100 (Romance Standard Time)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/home/hass/.homeassistant/custom_components/date_notifier.py", line 99, in async_scan_dates_service
    entity = component.entities[entity_id]
TypeError: 'itertools.chain' object is not subscriptable

Yeah I read there is a breaking change with some of the functions used in this project.
I’m still on version 0.59.1, I’m upgrading to 0.63.2 as we speak.
I’ll fix what ever needs fixing and update my git repository and this post.

@thundergreen

I fixed it.
As it turns out ever since 0.62, as it says here:
“EntityComponent.entities is no longer a dictionary of all entities of that component. Instead it is an iterable of entities. (Most components use EntityComponent.extract_from_service which remains unchanged)”.

In date_notifier.py, line 98 uses EntityComponent.entities and line 99 threats the result as dictionary.

To make a long story short, just change the async_scan_dates_service function like so:

From:

@asyncio.coroutine
    def async_scan_dates_service(call):
        for entity_id in component.entities:
            entity = component.entities[entity_id]

            if entity:
                target_notifiers = [entity]
                tasks = [notifier.async_scan_dates() for notifier in target_notifiers]
                if tasks:
                    yield from asyncio.wait(tasks, loop=hass.loop)
                else:
                    _LOGGER.error('no tasks initialized for ' + entity_id)
            else:
                _LOGGER.error('no entity found with the name ' + entity_id)

To:

    @asyncio.coroutine
    def async_scan_dates_service(call):
        for entity in component.entities:
            target_notifiers = [entity]
            tasks = [notifier.async_scan_dates() for notifier in target_notifiers]
            if tasks:
                yield from asyncio.wait(tasks, loop=hass.loop)
            else:
                _LOGGER.error('no tasks initialized')

I’ve also updated my Github Repository accordingly.

Great and thanks a lot :wink:

1 Like

Can we have more than 1 of yearly_reminder, or monthly_reminder? if possible how to ?
example

  yearly_reminder:
    name: "yearly test"
    hour: 21
    minute: 26
    day: 21
    month: 11
    message: "yearly test"
    days_notice: 2
    notifier: "ios_tomers_iphone6s"

  yearly_reminder2:
    name: "yearly test2"
    hour: 21
    minute: 26
    day: 10
    month: 12
    message: "yearly test 2"
    days_notice: 2
    notifier: "ios_tomers_iphone6s"

or

  yearly_reminder:
    name: "yearly test"
    hour: 21
    minute: 26
    day: 21
    month: 11
    message: "yearly test"
    days_notice: 2
    notifier: "ios_tomers_iphone6s"

    name: "yearly test2"
    hour: 21
    minute: 26
    day: 10
    month: 12
    message: "yearly test 2"
    days_notice: 2
    notifier: "ios_tomers_iphone6s"