Skip to content

IoT Calendar: Creating a Calendar Service for IoT Devices

  • by

This is the first in a series of articles about using microcontroller devices with e-paper displays for displaying dynamic calendars.

Standards can be a wonderful thing. At their best, they let computer hardware and software inter-operate between multiple vendors. Take calendar standards, for example. With the iCalendar standard, you can send a meeting invite from your GMail account to an Office365 user, who may be at the gym at the moment but sees the invite from his smart phone. From his smart phone, he accepts the invitation and sends back the confirmation to the GMail user. You can also subscribe to calendars, which will update automatically when a change occurs. For example, if you subscribe to a baseball team’s calendar, and your team makes it to the playoffs, new playoff games (and hopefully World Series games) will magically appear in your calendar.

So, when I set out to create an IoT application that displays events from a subscribed calendar for the current day, I discovered a problem. Parsing an iCalendar feed to find the current day’s events is very resource intensive for an IoT device.  The device would need to do the following:

  • Read the iCalendar feed, which can be several or hundreds of KBytes in size
  • Parse the iCalendar feed, looking for just those events that are occurring today
  • For repeating events, expand the repeating event rule to all possible dates to see if any of them are occurring today
  • If there are exceptions to a repeating event (meeting cancelled or rescheduled to another day, for example), do not include those meetings
  • Include the timezone in the date check to prevent events from displaying on the wrong day

That is quite a bit of work involved, even for larger devices. I did not find any options out there for an IoT device to read calendar events, so I decided to create my own service. I call it the IoT Calendar service. The service is available at http://iotcalendar.org . An account is required to receive an API key but a free tier is available for checking calendars once per day. The service is straightforward: at it’s simplest form, An IoT device submits a URL containing the iCalendar feed URL to the service, the service parses the data and returns with a list of events for the current day in JSON format. The service takes care of all of the above, including expanding repeating events and checking the timezones. Several libraries exist for parsing JSON data on Arduino and similar devices (my target platform), so this looked like the logical choice. This service could also be used by other languages that support JSON, including Python. The service was written in PHP utilizing the ZapCal Library, a library I wrote for PHP developers that is available at icalendar.org .

Here is an example of a URL sent from the microcontroller device to the IoT calendar service:

https://iotcalendar.org/iotevents?tzid=America/New_York&apikey={apikey}&url=http://americanhistorycalendar.com/peoplecalendar?format=ical

At a minimum, the timezone field, API key and url field are sent to the service. The timezone field is a valid timezone as defined by the PHP language, a list of which can be found at this page.

The service will send back a list of events in JSON format scheduled for that day. Here is an example:

{
    "name": "People in History",
    "events": [
        {
            "summary": "John Hancock",
            "ldstart": "20190123",
            "duration": 1440,
            "rday": 0,
            "allday": 1
        },
        {
            "summary": "Joseph Hewes",
            "ldstart": "20190123",
            "duration": 1440,
            "rday": 0,
            "allday": 1
        }
    ]
}

The rday field is the day of the event relative to today. Other days to check can be added to the URL for other days, like tomorrow, for example, which would have an rday of 1. Add the field “&rdays=0,1” to display events for today and tomorrow. For days where there are no events then no events will be returned. For testing purposes, adding “&pretty” to the URL will format the JSON data in a nice readable output like the example above.

Another service was also created to help IoT devices calculate the local time by returning the time offset of the given timezone. This is helpful for devices retrieving the current time from an NTP server and need to convert the UTC time given from an NTP server to local time.

The syntax for using  the iottzoffset service is:

https://iotcalendar.org/iottzoffset?apikey={apikey}&tzid={tzid}

where {tzid} is a timezone as defined as a valid timezone in PHP. For example,

https://iotcalendar.org/iottzoffset?apikey={apikey}&tzid=America/New_York

returns the current timezone offset for the New York timezone, as in the following:

{
    "offset": -300
}

“offset” is in minutes from the UTC timezone.  This value will vary during the year depending when Daylight Savings TIme (DST) is in effect.

More details of the service can be found at iCalendar.org . You can sign up for a free account at IoTCalendar.org . A free account allows checking for events an average of once per day.

Awas Melewatkan Cuan! Rahasia Pola Black Scatter untuk Pecahkan Rekor Kemenangan Hari IniCara Gila! Tingkatkan Akurasi Taruhan Roulette Lewat Teknik Fibonacci Anti-RugiCuan Meledak! Ini Dia Pola Scatter Mahjong Ways 2 yang Paling Nge-Hits Saat IniCuci Mata dan Kantong! Aksi Pemain Sukses Raup Cuan di Black ScatterDari Patah Hati Jadi Heart Attack! Kisah Pemain Sukses di Baccarat dengan Trik SederhanaGak Nyangka! Rumus Sederhana Ini Bikin Peluang Menang Parlay Naik 80%Hati-Hati! Kesalahan Kecil di Baccarat Bisa Bikin Anda Kehilangan Jackpot Besar!Jangan Lewatkan! 3 Sinyal Kemenangan di Mahjong Wins yang Jarang Diketahui Pemain LamaMahjong Wins 2 Dari Pemula Jadi Sultan! Ini 4 Jurus Jitu yang Wajib DikuasaiMenang Terus! Strategi Taruhan Roulette yang Bikin Dealer Sampai Geleng-GelengMode Gila! Simak Trik Menguasai Freespin di Black Scatter Tanpa Modal BesarNgaku Pecinta Gates of Olympus? Wajib Baca 5 Kesalahan Fatal Ini Sebelum Spin!Parlay Panas! Kombinasi Tim Ini Dijamin Bikin Dompet Mbledos Terbukti!Perhatikan Jam Main! Ini Waktu Terbaik untuk Menang di Gates of OlympusPeringatan Keras! Jangan Mainkan Mahjong Ways 2 Sebelum Baca 7 Petunjuk Ini!Roulette Bukan Sekadar Tebak Angka! Strategi Jitu Ini Bikin Meja BergetarScroll Berhenti! Spill Pola Scatter Mahjong Wins dari Grup Telegram Paling DipercayaSensasi Maxwin! Bocoran Pola Scatter Mahjong Ways 2 yang Bikin Saldo Nambah Nol!Turun Gunung! Eks Member Kasino Bagikan Pola Andalan di Mahjong Ways 2Viral! Pemain Ini Raup Cuan Besar di Gates of Olympus Hanya Modal 20 Ribu, Caranya?Catat Tanggalnya! Peringatan Kemenangan Besar di Black Scatter Akan Segera TerjadiCurhat Pro Player Cara Saya Konsisten Cuan dari Parlay Tanpa RibetHati-Hati Scatter Palsu! Kenali Perbedaan Scatter Asli di Mahjong WaysIni Dia! Tanda-Tanda Mesin Mahjong Wins 2 Siap Memberikan JackpotModal Uang Kembalian? Coba Trik Ini di Baccarat, Bisa Jadi Cuan Besar!Sering Kena Scatter? Itu Tanda Anda Salah Main, Coba Simak Strategi Gates of Olympus Ini!Stop! Jangan Spin Sebelum Tau Pola Scatter Gates of Olympus yang TerupdateTakut Kalah? Pakai Saja Trik Anti-Panas di Mahjong Wins 2, Dijaman Aman!Tingkatkan Level! Cara Jago Main Roulette Ala Pro Player Dalam Waktu SingkatTips Sakti! Menaklukkan Meja Roulette Hanya dengan 3 Putaran AwalBaccarat Panduan Membaca Tren Meja Jalan KemenanganBlack Scatter Analisis Tingkat RTP Return to Player dan PengaruhnyaBlack Scatter Teknik Mengelola Emosi Saat Lagi Hoki dan HancurMahjong Wins 5 Kesalahan Fatal yang Sering Dilakukan PemulaPanduan Lengkap Menemukan Pola Scatter Mahjong Ways 2 dari Hasil SpinParlay Memilih Liga dan Tim yang Tepat untuk Taruhan AndaRoulette Eropa vs Amerika Mana yang Lebih Menguntungkan?Roulette Strategi Martingale dan Dampaknya pada Modal AndaStrategi Taruhan Progresif di Baccarat Apakah Efektif?Tips Bermain Gates of Olympus dengan Modal Kecil dan Risiko MinimBaccarat Mengenal Sistem Taruhan Paroli untuk PemulaBlack Scatter Pentingnya Mengatur Batas Waktu dan Target BermainGates of Olympus Membedakan Antara Pola Gacor dan Pola BiasaGates of Olympus Peran Penting Multiplier dalam Kemenangan BesarMahjong Ways 2 Cara Membaca Simbol-Simbol Penting di Dalam GameMahjong Wins Mengoptimalkan Fitur Beli Freespin untuk KeuntunganMemahami Volatilitas Mahjong Ways 2 agar Tidak Cepat Kehabisan SaldoParlay Tips Mengkombinasikan Taruhan Over/Under dan 1X2Roulette Trik Sederhana Memanfaatkan Hot Numbers di Meja LiveTips Memilih Bettingan yang Tepat di Mahjong Wins untuk PemulaBaccarat Memahami Peran Banker dan Player dalam PeluangBaccarat Trik Flat Betting untuk Konsistensi KemenanganBlack Scatter Analisis Pola Kemunculan Simbol Wild dan ScatterBlack Scatter Cara Membaca Pola Putaran Sebelum Memulai Taruhan BesarGates of Olympus Panduan Bermain di Versi Mobile vs DesktopMahjong Ways 2 Rekomendasi Jumlah Spin yang Ideal untuk 1 SesiMahjong Wins Tips Ampuh Memanfaatkan Bonus New MemberParlay Mengerti Risiko dan Manfaat Taruhan Kombinasi Multi-TimParlay Panduan Bermain Saat Musim Turnamen untuk Hasil MaksimalRoulette Perbedaan Taruhan Dalam dan Luar serta ManfaatnyaBaccarat Tips Memilih Meja Berdasarkan Jumlah PemainBlack Scatter Panduan Awal Bagi yang Ingin Beralih dari MahjongGates of Olympus Mengatur Kecepatan Spin untuk Pengalaman Bermain TerbaikMahjong Ways 2 Panduan Daftar dan Mulai Main untuk Pemula AbsolutMahjong Ways 2 Panduan Menerapkan Stop Loss dan Take ProfitMahjong Wins Cara Mudah Memahami Fitur Wild dan FungsinyaMahjong Wins Strategi Jitu Menggabungkan Pola dengan Manajemen ModalParlay Memahami Pengaruh Cedera Pemain Terhadap Peluang KemenanganRoulette Memanfaatkan Fitur Statistik untuk Membantu Menentukan AngkaRoulette Pola Dasar yang Perlu Diketahui Sebelum BertaruhNge-Hits Abis! Pola Scatter Mahjong Ways 2 Ini Bikin Auto Banjir Cuan!Gates of Olympus Sedang Panas! Langsung Gas Pola Ini, Dijamin Scatter Berondong!Cuma 5 Menit! Pemula Ini Raup Puluhan Juta di Mahjong Wins, Kok Bisa?Viral Di Mana-Mana! Ini Pola Black Scatter Paling Brutal yang Lagi Dicari!Siap-Siap Kaget! Baccarat Bisa Bikin Kaya Mendadak Pakai Trik Satu Ini!Roulette Bergetar! Strategi Gila Ini Bikin Meja Loss Berkali-Kali!Parlay Gacor! Kombinasi 3 Tim Ini Wajib Dipasang Pekan Ini Terbukti!Jangan Spin Dulu! Baca 3 Sinyal Kematian di Mahjong Ways 2 Sebelum Main!Cuan Mengalir Deras! Spill Pola Scatter Mahjong Wins dari Admin Grup Sultan!Gates of Olympus Auto Maxwin! Pemain Ini Cuma Modal Receh, Hasilnya Meledak!Bongkar Rahasia! Black Scatter Ternyata Punya Jam Emas Kemenangan!Peringatan Keras! 5 Kesalahan Fatal di Baccarat yang Bikin Bangkrut!Roulette Bukan Tebak-Tebakan! Simak Formula Jitu Ini Biar Cuan Terus!Auto Penasaran! Pola Scatter Mahjong Ways 2 yang Bikin Streaming Ramai!Mahjong Wins 2 Dari Pemula Pro! Ini Lho 4 Jurus Andalan Anak Muda!Parlay Maksimal! Trik Menentukan Tim Kuda Hitam untuk Taruhan Anda!Gila! Black Scatter Kasih Freespin Terus, Pemain Sampai Speechless!Gates of Olympus Hati-Hati! Simbol Zeus Ini Pertanda Akan Jackpot!Baccarat Meja Panas! Terapkan Teknik Cut Ini, Musuh Langsung Ciut!Roulette Berbisik! Pelajari Angka Favorit Dealer Biar Menang Terus!
toto togel
bandar togel