Lares Events

It may seem stupid, but the progress of these days has been (by far) the biggest since the early stages of the project. First of all, I have been refactoring the code to place certain parts that already existed in better structured blocks. These logical modifications have led to two independent compilers: Vesta’s, which also generates the replicated classes in Lares, and Lares’s, which generates what I call a basic home automation plan. The basic home automation plan is a structure that maintains consistency between the information residing in all the vesta modules and their unified logical representations. When you run the second compiler you have an object with its own functionality in which all the devices in the house are represented in a long list of objects as members or properties.

This means that if, for example, you want to turn on a light, you will assign a “true” value to the “value” property of the object that represents that light and when doing so, Lares will take care of establishing contact with that specific controller, sending the data and make sure that light comes on. But for this great object to be interactive as well, it is necessary to ensure the opposite flow of information, and it is low level achieved through event management. Any device must be able to generate an event when there is a significant change in its state. Until now, this event flow worked internally in controller local mode. The novelty is that now these same events are propagated in the form of UDP packets and the home automation plan can receive them, process them and associate them with the corresponding virtual device.

Three physical controls generate events by each status change and is shown on screen

In this video I have activated the emission of external events (UDP) in two buttons and a switch. The home automation plan is capable of detecting each operation and reflecting it on the console. At the moment I can notify the occurrence of these changes, although it is only the first part of the work. The event is associated with the device that triggered it and (still to be developed), it will invoke a delegate function that the user can override to add its functionality. Remember that a normal home automation plan corresponding to a typical home will consist of more than sixty or seventy devices of all kinds, contained in eight or nine Vesta controllers and any of them will be able to trigger a fully programmable action on one or more devices under control. To do this, the advanced user or the installer will create a class that will inherit from the basic home automation plan and will contain methods that will relate events to changes in the outputs. The complexity of these relationships between devices is totally open, being able to incorporate machine learning algorithms or artificial intelligence. Good! In this long chain of interactions, today’s step allows the home automation part to be sensitive to stimuli coming from the real world. Home automation begins to unfold its senses!

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Cookie Plugin by Real Cookie Banner