Rules UI - Almond+ 2014
As of firmware R069cb BETA, Rules for home automation was included. The following section will help explain how to use the Rules UI and it includes examples of a couple of simple rules.
Note that the last two sections haven't been updated to reflect the UI changes made in R069cb compared to the older beta firmware that these instructions were originally written for.
Once you've updated to the new firmware, you might have to do a page refresh to get the rules tab to load properly. What you should see is in the below screenshot.
To create your first rule, simply click on the magic wand (Click to add a new rule). You should now see a screen similar to the one below.
The IF part of the rule starts automatically or is caused by an action and it's known as a trigger. The trigger is the condition that has to be met before a an action can happen.
The first thing you want to do is to pick one or more triggers. In this first example, we picked a door/window sensors. When the door is opened, something should happen. Note that boxes highlighted in blue are the ones you've selected.
To save the trigger, simply click on Confirm Selection as highlighted in the picture below.
You should now see something like the following screen, which means that you've successfully set up the trigger part of the rule.
The second part to a rule is THEN, i.e. what will happen once the IF condition(s) is/are meet. This will cause something to happen at the end.
Now it's time to pick an "action" i.e. what's going to happen once the trigger is triggered. In this cease, we're turning on a binary switch. Simply click on "ON" icon for the binary switch and the action will be added. Finally click on Done to save the action. Once the action has been saved, you should see it appear under THEN. You can add multiple actions to the same "THEN" statement.
The Rules UI has an option to put in a delay before something should be triggered. The Wait time can be set to seconds or minutes and the maximum delay is 5 minutes.
In this case we've put in a Wait of 5 seconds.
Note that you can add delays before or after you've clicked on Done to save the THEN statement.
Saving a rule
Now it's time to save the rule. Simply type in the name you want for the rule in the "Enter Rule Name" field provided at the top and bottom of the rules UI. We'd suggest using a descriptive rule name, so you know what the rule actually does. Finally click on Save Rule (highlighted below) to save the rule.
Verifying a rule
If the rule was successfully created, you should now see it as a rule in the Rules tab in the main NutsOS UI. Note that as long as you see the Please wait... box at the top of the page, the rule is still being saved.
Deleting a rule
Clicking on the cross at the far right end of a rule will delete it.
A simple time based rule
This is where things becomes a little bit more complex. First if all you have to go into OpenWRT and set the time of your Almond+ correctly. If this isn't done, then your time based triggers won't be triggered when you expect them to. We're working on getting the time related issues fixed in a future firmware, but we're also preparing the Almond+ for the weather and time apps, so they'll tie in to the time fixes we're working on and as such this will take a little bit of time until it's done. For now, simply go into OpenWRT via the Advanced settings in NutsOS, select System, System from the menu, select the correct time zone and then click on "Sync with browser" to sync the time. The NTP time sync will now also work with the Time app in the LCD UI.
The first step in creating a time based rule is to select the time when you want something to happen. Simply enter the time into the UI using either the up/down arrows, or by clicking on the numbers and typing it in. You can also select the days of the week you want a time based trigger to happen, in this case, we've picked Monday through to Friday.
You can also put in a condition into time based triggers, in this case, only if the binary switch is on at the specified time, then something will happen. Don't forget to click on Confirm Selection to save the trigger.
Next create an action as per above. Once you're finished, you should see something like the screenshot below, before you name and save your rule.
Complex timer rule
This example will show you how to set up a more complex rule based on multiple conditions, including a time window. In the previous example we only used the AT option in the time based part of the trigger, this time we'll use the BETWEEN part. This allows us to set a time window in which something should take place.
In this example, we've selected that if two conditions/triggers are meet between two points in time, then something should happen. The conditions/triggers we set are if the binary switch is on and if the door is closed and the time is between 3pm and 4pm as per the below screenshot, then something should happen.
In this case the THEN action is to wait five seconds and then turn off the binary switch. This can for example be useful to turn off a light in a room when the door is closed during a certain time of the day.
You can of course use longer periods of time in this case and you can of course combine this with the day of the week as well. Note that you can not do Between rules that go after midnight in R069cb, but this is something we're working on fixing.