Adquio, thousands of Casambi devices supervised
One of the missions that Adquio fulfills in Casambi installations is to monitor the entire installation and warn of possible device failures quickly and efficiently. For this, Adquio uses the variables online
of all the devices in the Casambi network. But how does it do it, does it have to check these variables one by one?
As you already know, Adquio works with an event-driven system, this means that Adquio receives all variable changes from each device automatically and only acts if the user has connected that event to manage that change.
But… So I have to connect an event to each of my drivers? Normally you would have to do it this way, but Adquio has ways of connecting events by adding that the devices and variables that trigger such an event may have to meet criteria in their name. That is, if we have called all our drivers in the same way but adding a number, then the event can indicate if the device name starts with… and the variable name is “online”.
Let’s see how to do it, this is a normal event:
events.addListener({ eventName: 'VariableChange',
deviceCode: 'adquio-unit_001',
variableCode: 'online' }, (ev) => {
// Put here your code
});
Let us explain how it works:
- We are telling Adquio that we want to manage a variable change event
VariableChange
. - That we want to do it from the device named
adquio-unit_001
(within Adquio all Casambi devices have this kind of names). - And then we indicate the name of the variable we want to monitor, in this case
online
. - Finally, this system will leave us in
ev
an object that will have associated all the values of this event, such as the name of the device, the name of the variable, and above all its current content and even more important its content prior to the change that has triggered this event.
With this we can manage all the changes of the variable online
of the device driveradquio-unit_001
. As we know that this variable manages the state of the device, if its value changes to 0 then… we have a problem. This problem can be reported immediately through Adquio Alarms and sent to the appropriate recipients.
As you can see, once you know it is very easy to manage, but…, with this we are managing the status of a single driver, if we have hundreds or thousands, should we do this once for each one, or maybe not?
We will now see how to manage an unlimited number of devices with only one event, being able to extract from the event the name of the failed device and therefore the information that it is failing, we first see the code. In this case we are going to capture all the events and then filter the ones we are interested in.
events.addListener((ev) =>
ev.eventName === 'VariableChange'
&& ev.deviceCode.startsWith('adquio-unit_')
&& ev.variableCode === 'online', (ev) => {
//Put here your code
});
Capture all events and leave the value at ev
(Event Value).
- The next step is to verify that the event is of the type we are interested in,
VariableChange
(Adquio manages more types of events, such as device status change events). - Then add the condition that the device name must start with
adquio-unit_
(In this installation the devices go from 001 to 061). - And finally, we indicate that we only want the events of the variable
online.
As you can see, all the conditions must be met for the event to finally trigger and execute our code. With these simple lines (which you can copy and paste into your Adquio), you are managing the status of all your devices connected to Casambi. Of course, inside this event and accessing the variable ev
you will have access to all the values already mentioned above.
Some of the interesting properties provided by ev
are:
ev.deviceCode, ev.variableCode, ev.newValue, ev.oldValue
As you can see, with Adquio you have a simple and fast way to manage all the events of your Casambi network and not only this, but you also have a way to notify incidents, so you have a complete tool, also to manage the incidents of your networks.