An action needs a trigger. Let's use the Schedule trigger block to activate daily at 20:15.
Drag the Schedule block from the Triggers category of the toolbox, snapping it into place inside the Triggers:
section of the root block.
Β
Use the Settings cog (grey cog in blue background) for each of the Schedule block's time and date segments to build the schedule.
Β
Change the month and day segments toΒ Every Day and Every Month, and the hour and minute segments to suitable time values like 8:15 PM.
That's the trigger section done! Now you'll setup the rest of the action, but with no explanation of the template. This is to save overcomplicating things in one mega page, instead you'll learn about templates afterwards.
Before adding the email block to the Actions:
section of the workspace you'll create some variables, doing some seemingly pointless maths to make it easier to be referred to later in the email body. This is for two reasons, firstly because all data in Adafruit IO is effectively stored as text strings, explained later on the next page.
Secondly, itΒ is possible to use feed values directly in templates as you'll see later, but crucially the feed has to be used in a block, somewhere in the action, to then be available for templates.
There are a few things in the template that could also be calculated as variables first, like total events.
The example template calculates everything in the template, unwisely, just to show how it can be done.
Start by creating a new variable using the button at the top of theΒ VariablesΒ category in the toolbox.
Β
Call it poo_progress
, then create the remaining 3 variables,Β wee_progress
,Β nothing_progress
Β andΒ informed_progress
.
Β
Drag a Set Variable block into the main Actions:
section of the workspace diagram, and select the variable.
Grab one of the Addition blocks from the Maths category in the toolbox, and drop it into the value section of the Set Variable block. Leave the operator as plus / addition (+
), and the values untouched at zero.
Β
Use the Get Feed block from the Feeds category, and drop into one of the the value sections of the Maths block.Β
Β
Select the feed for the first counter (e.g. poo_counter
) from the feeds dropdown in the Get Feed block.
Now grab a second Set Variable block and drop it beneath the first, selecting the wee_progress
variable, and add the maths and feed blocks for the associated counter feed wee-counter
.
Repeat this process for the remaining counter feeds, at which point your action should look like this:
Next it's time to reset the counter feeds. You'll use the Set Feed block to set the counter values to zero.
Start by adding a Set Feed block beneath the previous blocks, then select theΒ poo-counter
feed from the dropdown, setting the value to 0
.
Repeat for the remaining counter feeds. Your action should look like this before continuing:
Add an Email block from the Notifications category in the toolbox. Enter a subject for the email.
From the Text toolbox category select the Template block (with the {{
label) and drop it into the value section of the second Set Variable block.
Update the Template's child Paragraph text block, by clicking inside it and updating the value to use the following template body text. Then click outside the text area to finish setting the block content.
<b>π Daily Potty Training Report π</b> Hi there! Here's how our little superstar did: --- <b>π½ Successful Wees: {{ vars.wee_progress }}</b> {% for i in (1..vars.wee_progress) %}π§{% endfor %} {% if vars.wee_progress <= 5 -%} Great start! Every success counts, and they're building good habits one wee at a time! π± {% elsif vars.wee_progress <= 15 -%} Fantastic progress! They're really getting the hang of this - keep up the amazing work! π― {% else -%} SUPERSTAR ALERT! π Absolutely crushing it with those wee successes! They're a potty champion! π {% endif %}--- <b>π© Successful Poos: {{ vars.poo_progress }}</b> {% for i in (1..vars.poo_progress) %}π€{% endfor %} {% if vars.poo_progress == 0 -%} Poos can be tricky, but they're being so brave! Every try is a step forward! πͺ {% elsif vars.poo_progress < 2 -%} Look at them go! They're becoming a real poo pro - that's awesome progress! π {% else -%} POO CHAMPION! π They've mastered one of the trickiest parts - so proud! π {% endif %}--- <b>π€ Told an Adult: {{ vars.informed_progress }}</b> {% for i in (1..vars.informed_progress) %}π£οΈ{% endfor %} {% if vars.informed_progress <= 5 -%} Communication is key! Keep practicing saying when they need to go - They're doing great! π’ {% elsif vars.informed_progress <= 15 -%} Wonderful communication skills! They're really good at letting us know - that's so helpful! π {% else -%} COMMUNICATION SUPERSTAR! π They're amazing at telling adults - that's such a big kid skill! π― {% endif %}--- <b>π» Nothing Happened: {{ vars.nothing_progress }}</b> {% for i in (1..vars.nothing_progress) %}β{% endfor %} {% if vars.nothing_progress <= 3 -%} That's okay! Trying is what matters, and their body will let them know when it's ready! π {% else -%} So patient and persistent! Even when nothing happens, they keep trying - that's real determination! π« {% endif %}--- <b>π Daily Summary:</b> {% capture total_tries -%}{{ vars.wee_progress | plus: vars.poo_progress | plus: vars.nothing_progress }}{% endcapture -%} {% capture successes -%}{{ vars.wee_progress | plus: vars.poo_progress }}{% endcapture -%} {% capture success_rate -%}{% if total_tries != "0" -%}{{ successes | times: 100 | divided_by: total_tries }}{% else -%}100{% endif -%}{% endcapture -%} {% capture bar_filled -%}{{ success_rate | divided_by: 10 }}{% endcapture -%} {% capture bar_empty -%}{{ 10 | minus: bar_filled }}{% endcapture -%} Total potty visits: {{ total_tries }} Success rate: {{ success_rate }}% [{%- for i in (1..bar_filled) -%}β{%- endfor -%}{%- for i in (1..bar_empty) -%}β{%- endfor -%}] {%- assign total_events = vars.wee_progress | plus: vars.poo_progress | plus: vars.nothing_progress | plus: vars.informed_progress -%} ({{ total_events }} events today ) {% if total_events <= 3 %} π <b>Today:</b> They're doing such a great job learning! Every day gets a little easier... {% elsif total_events <= 5 %} π <b>Today:</b> Ayee! They're really getting the hang of this potty training thing! Keep it up! {% elsif total_events <= 8 %} π <b>Today:</b> WOW! Look at all that practice! They're becoming such a potty expert. {% else %} π <b>Today:</b> INCREDIBLE DAY! They're absolutely rocking this potty training journey! ππ {%- endif %} Keep being awesome! With love and high-fives! π --- {%- assign event_mod = total_events | modulo: 3 %} {% if event_mod == 0 -%} <i>P.S. Remember: Every expert was once a beginner - they're doing brilliantly! π</i> {% elsif event_mod == 1 -%} <i>P.S. Fun fact: Even superheroes had to learn to use the potty! π¦Έ</i> {% else -%} <i>P.S. Remember: accidents are just practice in disguise! They're doing amazingly! π</i> {% endif %}
Before continuing, your action should now look nearly identical to this:
Templates are so new that we're still getting the error messaging and validation sorted, so for now if your template has a serious error then it just won't product any output (no new entry in Previous Runs).
Save and RunΒ the action, then check your email for the sample report, it should look something like this:
Now head on over to the final page to learn more about the template, and how you can craft your own!
Page last edited June 18, 2025
Text editor powered by tinymce.