MagicMirror icon indicating copy to clipboard operation
MagicMirror copied to clipboard

Add possibility to fetch calendars through socket notifications

Open krukle opened this issue 2 years ago • 8 comments

Hello and thank you for wanting to contribute to the MagicMirror² project

Please make sure that you have followed these 4 rules before submitting your Pull Request:

  1. Base your pull requests against the develop branch.

  2. Include these infos in the description:

  • Does the pull request solve a related issue?
  • If so, can you reference the issue like this Fixes #<issue_number>?
  • What does the pull request accomplish? Use a list if needed.
  • If it includes major visual changes please add screenshots.
  1. Please run npm run lint:prettier before submitting so that style issues are fixed.

  2. Don't forget to add an entry about your changes to the CHANGELOG.md file.

Note: Sometimes the development moves very fast. It is highly recommended that you update your branch of develop before creating a pull request to send us your changes. This makes everyone's lives easier (including yours) and helps us out on the development team.

Thanks again and have a nice day!

This pull request adds the possibility to fetch calendars through socket notifications. This enables development on projects like for example mycroft.

An example being where one would create a calendar event through the voice assistant, for the voice assistant to then call on the calendars to fetch through socket notifications:

self.calendar.add_component(event)
with self.file_system.open(self.CAL_PATH, "wb") as f:
    f.write(self.calendar.to_ical())
      
self.speak_dialog('event.created', dialog_data)
      
# Alert MM calendar that there's been an update.
self.bus.emit(Message("RELAY:calendar:FETCH_CALENDAR", {"url": "http://localhost:8080/" + str(self.CAL_MM_REL_PATH)}))

This can all be easily implemented with the MM module MMM-mycroft-bridge created by @oenstrom.

The changes made in this pull request do not affect users that are not interested in using socket notifications to communicate with MagicMirror.

krukle avatar Jul 14 '22 07:07 krukle

I don't understand the value. I create cal events thru voice all the time, and they show when the cal refreshes, same as when I do it thru my phone, or PC.

it's unlikely you created a cal event that will occur in the next 10 minutes(default refresh time), except to test.

sdetweil avatar Jul 14 '22 11:07 sdetweil

Its true that the events will show up when the calendar refreshes. However, it feels more responsive when the event visually gets added upon creation.

It gives you that confirmation that the event did get added correctly, and you can go on with your day, not having to wait potentially 10 minutes for the refresh to see that everything went well.

On Thu, 14 Jul 2022, 13:38 sam detweiler, @.***> wrote:

I don't understand the value. I create cal events thru voice all the time, and they show when the cal refreshes, same as when I do it thru my phone, or PC.

it's unlikely you created a cal event that will occur in the next 10 minutes(default refresh time), except to test.

— Reply to this email directly, view it on GitHub https://github.com/MichMich/MagicMirror/pull/2881#issuecomment-1184341684, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARHSGQIRQXPLRZ4WYMYBKB3VT732JANCNFSM53RFZQAQ . You are receiving this because you authored the thread.Message ID: @.***>

krukle avatar Jul 14 '22 11:07 krukle

Codecov Report

Merging #2881 (9ae62d6) into develop (d539f45) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop    #2881   +/-   ##
========================================
  Coverage    63.82%   63.82%           
========================================
  Files            9        9           
  Lines          293      293           
========================================
  Hits           187      187           
  Misses         106      106           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Jul 28 '22 13:07 codecov-commenter

Thanks! Sorry response. Was enjoying a sunny holiday. :)

Would you mind fixing the merge conflicts?

MichMich avatar Jul 28 '22 13:07 MichMich

In addition to this PR, would you mind creating a PR on https://github.com/MichMich/MagicMirror-Documentation as well? Thanks!

MichMich avatar Jul 28 '22 13:07 MichMich

In addition to this PR, would you mind creating a PR on https://github.com/MichMich/MagicMirror-Documentation as well? Thanks!

Sure!

Does this do?

krukle avatar Jul 28 '22 15:07 krukle

Unfortunately the automated tests are failing. Any idea if this is caused by your changes?

MichMich avatar Aug 05 '22 15:08 MichMich

Sorry that's my bad. Python habits came into play. Fixed what it complained about!

krukle avatar Aug 06 '22 08:08 krukle