-
Notifications
You must be signed in to change notification settings - Fork 116
Virtual devices
Home Automation system adjusted in the way to create abstracted layer ontop of hardware realization. Because of this we introduced Virtual Devices concept.
Virtual device is a class which inherits from VirtualDevice
base class consists of any number of public metrics and actions, defines by the developer of the particular vDev.
Any automation module can expose any number of Virtual Devices.
To set bDev Metric value developer must call setMetricValue()
method of the vDev instance. This method has two arguments – String “name” (which is name of the metric to change) and Mixed “value” (which is a new value of this metric).
When metric value changes, vDev emits “device.metricUpdated” message to the global event bus with 3 arguments (vDevId, name & newValue). “vDevId” in that case is a unique Virtual Device identifier.
Every vDev expose performCommand()
method with one argument – command name (String).
This method can be overrided by the particular Virtual Device descendant class and shoud return true if command was handled or false otherwise.