-
-
Notifications
You must be signed in to change notification settings - Fork 17
Capacities
The aim of a capacity is to describe an equipment feature.
Plugin objective: the plugin (like WindowsSystemInformation) declare a device nammed "cpu" which capacity is to provide the cpu temperature and the cpu load
The plugin describe the device cpu having the capacity of providing a temperature. Each data is identified by the keyword tempcpu0 (or Processor temperature) and will be a decimal value with °C as units.
In the textual description, we have all important words in bold
- the device name cpu
- the capacity temperature (the standard capacity shared::CStandardCapacities::Temperature can be used)
- the access mode : providing (EKeywordAccessMode::kReadOnly the cpu temperature only be read)
- the keyword : tempcpu0
- the friendlyName : Processor temperature (from the plugin this field is never defined, because it is only a GUI user customization)
- the data type decimal (EKeywordType::kDecimal)
- the data unit °C (shared::CStandardUnits::DegreesCelcius)
From the plugin, using yPluginApi
yPluginApi->declareKeyword("cpu", "tempcpu0", shared::CStandardCapacities::Temperature, EKeywordAccessMode::kReadOnly, EKeywordType::kDecimal, shared::CStandardUnits::DegreesCelcius);
The plugin describe the device cpu having the capacity of providing a cpuload. Each data is identified by the keyword loadcpu0 (or Processor load) and will be a integer value with % as units.
In the textual description, we have all important words in bold
- the device name cpu
- the capacity cpuload (this is a custom capacity, any string could match)
- the access mode : providing (EKeywordAccessMode::kReadOnly the cpu temperature only be read)
- the keyword : loadcpu0
- the friendlyName : Processor load (from the plugin this field is never defined, because it is only a GUI user customization)
- the data type integer (EKeywordType::kInteger)
- the data unit % (shared::CStandardUnits::Percent)
From the plugin, using yPluginApi
yPluginApi->declareKeyword("cpu", "loadcpu0", "cpuload", EKeywordAccessMode::kReadOnly, EKeywordType::kInteger, shared::CStandardUnits::Percent);
When a new data should be saved in database, the plugin should just use such a code
yPluginApi->historizeData("cpu", "tempcpu0", 45.2);
yPluginApi->historizeData("cpu", "loadcpu0", 85);
The plugin describe the device switch-0x12346 having the capacity of controlling a switch. Each data is identified by the keyword switch01 (or Kitchen switch) and will be a string value (on, off).
In the textual description, we have all important words in bold
- the device name switch-0x12346
- the capacity switch
- the access mode : controlling (EKeywordAccessMode::kWriteOnly the switch do not provide its state)
- the keyword : switch01
- the friendlyName : Kitchen switch (from the plugin this field is never defined, because it is only a GUI user customization)
- the data type string (EKeywordType::kString)
From the plugin, using yPluginApi
yPluginApi->declareKeyword("cpu", "switch01", "switch", EKeywordAccessMode::kWriteOnly, EKeywordType::kString);
Finally we write what we want for reporting capacity. The concept of standard capacity allows to unify the data point of the widget view. Indeed a widget that displays a temperature will use the data of "temperature" capacity.
For a widget that displays the cpu load; it should just select only the "cpuload" capacity
Yadoms -- The ultimate house automation solution