PatriotPartOfDay (community library)


Name Value
Name PatriotPartOfDay
Version 5.1.0
Installs 839
License BSD
Author Ron Lisle
Download .tar.gz
All Versions 5.1.0, 5.0.0

Extend Patriot IoT to generate partofday MQTT events for dusk, morning, etc. Patriot provides support for controlling IoT devices using Alexa and iOS devices. This plugin adds a source of date and time MQTT events that can help control those devices.

Library Read Me

This content is provided by the library maintainer and has not been validated or approved.


A Patriot plugin to provide MQTT partofday messages for dawn, sunrise, morning, noon, afternoon, sunset, dusk, and night


Include this library in one Photon sketch to provide partofday states for use by all controllers on the same MQTT network. Refer to the more complex examples in the main Patriot IoT examples directory.

This example creates a single PartOfDay device to broadcast messages to the MQTT network.

You can use the console to monitor these states via the published 'States' variable, or observe them in realtime on MQTT (eg. using mosquitto_sub)

#include <IoT.h>
#include <PatriotPartOfDay.h>

IoT *iot;

void setup() {
iot = IoT::getInstance();

// Create DateTime device
iot->addDevice(new PartOfDay());

void loop() {


Refer to the Patriot Github repository and documentation for more information.


Here's how you can make changes to this library and eventually contribute those changes back.

To get started, clone the library from GitHub to your local machine.

Change the name of the library in to something different. You can add your name at then end.

Modify the sources in and with the new behavior.

To compile an example, use particle compile examples/usage command in Particle CLI or use our Desktop IDE.

After your changes are done you can upload them with particle library upload or Upload command in the IDE. This will create a private (only visible by you) library that you can use in other projects. Do particle library add IoT_myname to add the library to a project on your machine or add the IoT_myname library to a project on the Web IDE or Desktop IDE.

At this point, you can create a GitHub pull request with your changes to the original library.

If you wish to make your library public, use particle library publish or Publish command.


Copyright 2017-2020 Ron Lisle

Refer to the included LICENSE file.

Browse Library Files