| || |
| || |
Blocks definitions == |+|
Revision as of 23:01, 15 February 2015
Create events using blocks
First of all you need to know how agocontrol is working:
- When a device change its status, an event is triggered into agocontrol.
- This event is propagated among all agocontrol modules and catched by event handler.
- An event is containing some related informations. All this informations are called "event content"
With an example:
I have a temperature sensor and when this device detects a temperature changing, the event "temperature has changed" is triggered.
Agocontrol system catch this event and execute all actions associated to this event.
The event "temperature has changed" is containing the sensor unique id (uuid) and the new temperature value.
Now you know how agocontrol is working so you should be able to create an action.
Agocontrol proposes an easy way to create these actions without any computer skills (or a little bit) using blocks construction.
Dashboard is composed of:
- an area on top with buttons
- a menu on the left
- a construction area
Top area is composed of buttons:
- Save button: save your action. First saving request you an action name.
- Load button: open a popup that list all existing actions. This popup allows you to delete useless actions.
- Check button: click on it if you want to check if there are some mistakes on your action
- Show button: open a popup to show you generated script from your blocks.
- Clear button: reset construction area.
The menu of the left is divided on sections:
- "Logic" section contains logic block like if and comparison
- "Loops" section allows you to iterate on something
- "Math" section adds some mathematical operations
- "Colour" adds color picker
- "Text" section contains all you need to manipulate strings
- "List" section allows you to manipulate array
- "Datetime" gives you access to date and time functions
- "Common" appends common functions (like print something on screen)
- "Variables" allows you to declare local variables to save informations of your action
- "Procedures" contains blocks to add functions in your action
- "Agocontrol" is a specific section that contains agocontrol inventory, devices, values... This section is explained above
Agocontrol section contains specific blocks that will allow you to interact with the home automation system:
- "Content" section
- "triggered event" block catches current event content (remember, content contains the event triggered, its values...)
- "content prop" block gives you access to current content properties (ie current temperature...)
- "Inventory" section
- "device value" block returns value of specified agocontrol device
- "Device" section gives access to device uuids or names
- "Event" section gives acces to event names
- "Actions" section
- "Send command" allows you to control agocontrol sending commands like send mail or sms, open or close your shutters...
- "Sleep" pauses your script during amount of specified command
- "Variables" section gives access to agocontrol internal variables. Very useful to keep in mind some information.
By default, on construction you should see default blocks:
- a logic "if" block that creates a condition
- a content "triggered event" block that catches an event
- an "event" block that specifies the event you want to catch
Building an action is really simple: drag and drop blocks from left menu to construction area and plug them together.
Blocks inputs and outputs have type checking to drive you.
Some blocks have little blue stars on top left corner, clicking on this star open a popup to add some features to the block.
Examples of what can be done with Blockly can be found below, if you have questions relating to the examples please post on the 
Every Monday 01.37 send an email, with temperature + distance measurement to an email address
If today is an odd number day of the month, at 7pm turn on a switch for an hour then switches it off and turns another one on for another hour.