The passage of time

In the post Scheduling events, we were responding to this desire: "it would be more convenient if the pico could just wake up every morning, check for ...".

The problem is that a pico isn't aware of the passing of time. It is not until some event comes for it — from the world outside of it — that the pico will do a computation in reaction to that event. After that reaction, it becomes quiescent again, until the next event or query.

In the earlier post, we showed how a ruleset can schedule future events, like we might set an alarm clock. The schedule is maintained by the pico engine, and when a future time arrives the pico engine will send the event to the pico to wake it up. This allowed the pico to do something every day at the set time.

This post will explore the idea of a simple ruleset that acts like an old-time town crier. It will send an event at the top of each hour of the day (and night). Like the crier shouting out "Ten o'clock and all's well!" Rules can then select on this event so that the pico can do things as often as every hour.

Detecting an unwanted condition

An earlier post, Managing channels, ends with the observation that "perhaps there should be monitoring in place, so that if no readings have come in during some period of time the pico's owner could be notified by text or email." This recently became an issue because of a different failure mode with a similar symptom.

In the earlier case, an error in managing channels made it so that no temperatures were recorded for hours on end. A few days ago, just one of the sensors stopped sending temperatures for several hours before this was noticed and days before someone could go on-site to reset it.

This post will show how to watch for the situation where readings are not received from one or more sensors for over an hour. It is easy to react to an event, but harder to react to something not happening.

We are going to layer on a ruleset that will send an email message to the pico's owner when it notices that expected readings have not arrived.

Building a web application

In this post, we'll build a simple web application using the pico stack.

This example is built by layering a new ruleset onto a pico hosted by the Pico Labs Affiliate Network (PLAN), where applications are only for private viewing (whilst logged in to an account therein).

Here we show how to program a public web page within that same pico.

APIs revisited and wonders of the web

There have been several posts about Application Programming Interfaces (APIs), but little explanation or motivation.

Everyone knows that the world wide web is bursting with useful and interesting information. Generally we get this information in our browser. 

Besides the countless websites that we enjoy with the browser, there are many more sources of information that are out there, on the web, but do not have a human-facing presentation. To consume these, you must have a program that uses their API.

Tutorial for a new application

When learning a new programming language, it is customary to start with a "Hello, World!" program.

This tutorial will guide you through this process for the KRL programming language* used with picos.

How to make money hosting picos

In the third note of an earlier post on Managing channels, we promised this post.

Basic economics

Buy low; sell high.

Running a pico engine in an AWS EC2 instance will cost a few dollars a month. Such a site could host thousands or probably even tens of thousands of picos. So, sell control of a pico for ten dollars a year and you should be able to make a profit.

Managing your KRL code for rulesets

When using PicoStack, code and data are combined within a pico. Together they represent some entity, which is responsive and reactive.

The code is written in KRL, the language you will need to learn (after having learned enough HTML, CSS, and JavaScript to get started). Since KRL itself consists of ASCII text (except in character strings and comments (where you can insert other UNICODE characters)), you can use your favorite text editor or  integrated development environment (IDE) to write your code.

Besides maintaining this code on your own machine, you will probably want to use a code repository in the cloud. This post explores possibilities.