improove plugin loading and add deviceIcon to plugins
This commit is contained in:
parent
134879793f
commit
74150aa7a6
2
guh.pri
2
guh.pri
@ -2,7 +2,7 @@
|
||||
GUH_VERSION_STRING=$$system('dpkg-parsechangelog | sed -n -e "s/^Version: //p"')
|
||||
|
||||
# define protocol versions
|
||||
JSON_PROTOCOL_VERSION=36
|
||||
JSON_PROTOCOL_VERSION=37
|
||||
REST_API_VERSION=1
|
||||
|
||||
DEFINES += GUH_VERSION_STRING=\\\"$${GUH_VERSION_STRING}\\\" \
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
\ingroup devices
|
||||
\inmodule libguh
|
||||
|
||||
The DeviceManager holds all information about supported and configured Devices in the system.
|
||||
The DeviceManager hold s all information about supported and configured Devices in the system.
|
||||
|
||||
It is also responsible for loading Plugins and managing common hardware resources between
|
||||
\l{DevicePlugin}{device plugins}.
|
||||
|
||||
@ -120,6 +120,7 @@
|
||||
\value DeviceIconDesk
|
||||
\value DeviceIconHifi
|
||||
\value DeviceIconPower
|
||||
\value DeviceIconEnergy
|
||||
\value DeviceIconRadio
|
||||
\value DeviceIconSmartPhone
|
||||
\value DeviceIconSocket
|
||||
@ -138,6 +139,11 @@
|
||||
\value DeviceIconSwitch
|
||||
\value DeviceIconMotionDetectors
|
||||
\value DeviceIconWeather
|
||||
\value DeviceIconTime
|
||||
\value DeviceIconLightBulb
|
||||
\value DeviceIconGateway
|
||||
\value DeviceIconMail
|
||||
\value DeviceIconNetwork
|
||||
\value DeviceIconCloud
|
||||
*/
|
||||
|
||||
@ -152,6 +158,7 @@ DeviceClass::DeviceClass(const PluginId &pluginId, const VendorId &vendorId, con
|
||||
m_id(id),
|
||||
m_vendorId(vendorId),
|
||||
m_pluginId(pluginId),
|
||||
m_deviceIcon(DeviceIconPower),
|
||||
m_createMethods(CreateMethodUser),
|
||||
m_setupMethod(SetupMethodJustAdd)
|
||||
{
|
||||
|
||||
@ -78,6 +78,7 @@ public:
|
||||
};
|
||||
|
||||
enum DeviceIcon {
|
||||
DeviceIconNone,
|
||||
DeviceIconBed,
|
||||
DeviceIconBlinds,
|
||||
DeviceIconCeilingLamp,
|
||||
@ -86,6 +87,7 @@ public:
|
||||
DeviceIconDesk,
|
||||
DeviceIconHifi,
|
||||
DeviceIconPower,
|
||||
DeviceIconEnergy,
|
||||
DeviceIconRadio,
|
||||
DeviceIconSmartPhone,
|
||||
DeviceIconSocket,
|
||||
@ -104,6 +106,11 @@ public:
|
||||
DeviceIconSwitch,
|
||||
DeviceIconMotionDetectors,
|
||||
DeviceIconWeather,
|
||||
DeviceIconTime,
|
||||
DeviceIconLightBulb,
|
||||
DeviceIconGateway,
|
||||
DeviceIconMail,
|
||||
DeviceIconNetwork,
|
||||
DeviceIconCloud
|
||||
};
|
||||
|
||||
|
||||
@ -183,7 +183,9 @@ QList<Vendor> DevicePlugin::supportedVendors() const
|
||||
return vendors;
|
||||
}
|
||||
|
||||
/*! Return a list of \l{DeviceClass}{DeviceClasses} describing all the devices supported by this plugin. */
|
||||
/*! Return a list of \l{DeviceClass}{DeviceClasses} describing all the devices supported by this plugin.
|
||||
If a DeviceClass has an invalid parameter it will be ignored.
|
||||
*/
|
||||
QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
{
|
||||
QList<DeviceClass> deviceClasses;
|
||||
@ -200,12 +202,16 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
createMethods |= DeviceClass::CreateMethodDiscovery;
|
||||
} else if (createMethodValue.toString() == "auto") {
|
||||
createMethods |= DeviceClass::CreateMethodAuto;
|
||||
} else if (createMethodValue.toString() == "user") {
|
||||
createMethods |= DeviceClass::CreateMethodUser;
|
||||
} else {
|
||||
qCWarning(dcDeviceManager) << "Unknown createMehtod" << createMethodValue.toString() <<
|
||||
"in deviceClass " << deviceClass.name() << ". Falling back to CreateMethodUser.";
|
||||
createMethods |= DeviceClass::CreateMethodUser;
|
||||
}
|
||||
}
|
||||
deviceClass.setCreateMethods(createMethods);
|
||||
|
||||
deviceClass.setDeviceIcon(loadAndVerifyDeviceIcon(jo.value("deviceIcon").toString()));
|
||||
deviceClass.setDiscoveryParamTypes(parseParamTypes(jo.value("discoveryParamTypes").toArray()));
|
||||
|
||||
QString setupMethod = jo.value("setupMethod").toString();
|
||||
@ -215,7 +221,9 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
deviceClass.setSetupMethod(DeviceClass::SetupMethodDisplayPin);
|
||||
} else if (setupMethod == "enterPin") {
|
||||
deviceClass.setSetupMethod(DeviceClass::SetupMethodEnterPin);
|
||||
} else {
|
||||
} else if (setupMethod == "justAdd") {
|
||||
qCWarning(dcDeviceManager) << "Unknown setupMehtod" << setupMethod <<
|
||||
"in deviceClass " << deviceClass.name() << ". Falling back to SetupMethodJustAdd.";
|
||||
deviceClass.setSetupMethod(DeviceClass::SetupMethodJustAdd);
|
||||
}
|
||||
deviceClass.setPairingInfo(jo.value("pairingInfo").toString());
|
||||
@ -223,7 +231,7 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
|
||||
QList<DeviceClass::BasicTag> basicTags;
|
||||
foreach (const QJsonValue &basicTagJson, jo.value("basicTags").toArray()) {
|
||||
basicTags.append(basicTagStringToBasicTag(basicTagJson.toString()));
|
||||
basicTags.append(loadAndVerifyBasicTag(basicTagJson.toString()));
|
||||
}
|
||||
deviceClass.setBasicTags(basicTags);
|
||||
|
||||
@ -242,7 +250,7 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
StateType stateType(st.value("id").toString());
|
||||
stateType.setName(st.value("name").toString());
|
||||
stateType.setType(t);
|
||||
stateType.setUnit(unitStringToUnit(st.value("unit").toString()));
|
||||
stateType.setUnit(loadAndVerifyUnit(st.value("unit").toString()));
|
||||
stateType.setDefaultValue(st.value("defaultValue").toVariant());
|
||||
if (st.contains("minValue"))
|
||||
stateType.setMinValue(st.value("minValue").toVariant());
|
||||
@ -256,6 +264,13 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
possibleValues.append(possibleValueJson.toVariant());
|
||||
}
|
||||
stateType.setPossibleValues(possibleValues);
|
||||
|
||||
// inform the plugin developer about the error in the plugin json file
|
||||
Q_ASSERT_X(stateType.possibleValues().contains(stateType.defaultValue()),
|
||||
QString("\"%1\" plugin").arg(pluginName()).toLatin1().data(),
|
||||
QString("The given default value \"%1\" is not in the possible values of the stateType \"%2\".")
|
||||
.arg(stateType.defaultValue().toString()).arg(stateType.name()).toLatin1().data());
|
||||
|
||||
}
|
||||
stateTypes.append(stateType);
|
||||
|
||||
@ -307,9 +322,9 @@ QList<DeviceClass> DevicePlugin::supportedDevices() const
|
||||
}
|
||||
deviceClass.setEventTypes(eventTypes);
|
||||
|
||||
if (!broken) {
|
||||
if (!broken)
|
||||
deviceClasses.append(deviceClass);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return deviceClasses;
|
||||
@ -451,12 +466,12 @@ QList<ParamType> DevicePlugin::parseParamTypes(const QJsonArray &array) const
|
||||
|
||||
// set the input type if there is any
|
||||
if (pt.contains("inputType")) {
|
||||
paramType.setInputType(inputTypeStringToInputType(pt.value("inputType").toString()));
|
||||
paramType.setInputType(loadAndVerifyInputType(pt.value("inputType").toString()));
|
||||
}
|
||||
|
||||
// set the unit if there is any
|
||||
if (pt.contains("unit")) {
|
||||
paramType.setUnit(unitStringToUnit(pt.value("unit").toString()));
|
||||
paramType.setUnit(loadAndVerifyUnit(pt.value("unit").toString()));
|
||||
}
|
||||
|
||||
// set readOnly if given (default false)
|
||||
@ -693,161 +708,96 @@ QStringList DevicePlugin::verifyFields(const QStringList &fields, const QJsonObj
|
||||
return ret;
|
||||
}
|
||||
|
||||
Types::Unit DevicePlugin::unitStringToUnit(const QString &unitString) const
|
||||
Types::Unit DevicePlugin::loadAndVerifyUnit(const QString &unitString) const
|
||||
{
|
||||
if (unitString == QString()) {
|
||||
if (unitString.isEmpty())
|
||||
return Types::UnitNone;
|
||||
} else if (unitString == "Seconds") {
|
||||
return Types::UnitSeconds;
|
||||
} else if (unitString == "Minutes") {
|
||||
return Types::UnitMinutes;
|
||||
} else if (unitString == "Hours") {
|
||||
return Types::UnitHours;
|
||||
} else if (unitString == "UnixTime") {
|
||||
return Types::UnitUnixTime;
|
||||
} else if (unitString == "MeterPerSecond") {
|
||||
return Types::UnitMeterPerSecond;
|
||||
} else if (unitString == "KiloMeterPerHour") {
|
||||
return Types::UnitKiloMeterPerHour;
|
||||
} else if (unitString == "Degree") {
|
||||
return Types::UnitDegree;
|
||||
} else if (unitString == "Radiant") {
|
||||
return Types::UnitRadiant;
|
||||
} else if (unitString == "DegreeCelsius") {
|
||||
return Types::UnitDegreeCelsius;
|
||||
} else if (unitString == "DegreeKelvin") {
|
||||
return Types::UnitDegreeKelvin;
|
||||
} else if (unitString == "Mired") {
|
||||
return Types::UnitMired;
|
||||
} else if (unitString == "MilliBar") {
|
||||
return Types::UnitMilliBar;
|
||||
} else if (unitString == "Bar") {
|
||||
return Types::UnitBar;
|
||||
} else if (unitString == "Pascal") {
|
||||
return Types::UnitPascal;
|
||||
} else if (unitString == "HectoPascal") {
|
||||
return Types::UnitHectoPascal;
|
||||
} else if (unitString == "Atmosphere") {
|
||||
return Types::UnitAtmosphere;
|
||||
} else if (unitString == "Lumen") {
|
||||
return Types::UnitLumen;
|
||||
} else if (unitString == "Lux") {
|
||||
return Types::UnitLux;
|
||||
} else if (unitString == "Candela") {
|
||||
return Types::UnitCandela;
|
||||
} else if (unitString == "MilliMeter") {
|
||||
return Types::UnitMilliMeter;
|
||||
} else if (unitString == "CentiMeter") {
|
||||
return Types::UnitCentiMeter;
|
||||
} else if (unitString == "Meter") {
|
||||
return Types::UnitMeter;
|
||||
} else if (unitString == "KiloMeter") {
|
||||
return Types::UnitKiloMeter;
|
||||
} else if (unitString == "Gram") {
|
||||
return Types::UnitGram;
|
||||
} else if (unitString == "KiloGram") {
|
||||
return Types::UnitKiloGram;
|
||||
} else if (unitString == "Dezibel") {
|
||||
return Types::UnitDezibel;
|
||||
} else if (unitString == "KiloByte") {
|
||||
return Types::UnitKiloByte;
|
||||
} else if (unitString == "MegaByte") {
|
||||
return Types::UnitMegaByte;
|
||||
} else if (unitString == "GigaByte") {
|
||||
return Types::UnitGigaByte;
|
||||
} else if (unitString == "TeraByte") {
|
||||
return Types::UnitTeraByte;
|
||||
} else if (unitString == "MilliWatt") {
|
||||
return Types::UnitMilliWatt;
|
||||
} else if (unitString == "Watt") {
|
||||
return Types::UnitWatt;
|
||||
} else if (unitString == "KiloWatt") {
|
||||
return Types::UnitKiloWatt;
|
||||
} else if (unitString == "KiloWattHour") {
|
||||
return Types::UnitKiloWattHour;
|
||||
} else if (unitString == "EuroPerMegaWattHour") {
|
||||
return Types::UnitEuroPerMegaWattHour;
|
||||
} else if (unitString == "EuroCentPerKiloWattHour") {
|
||||
return Types::UnitEuroCentPerKiloWattHour;
|
||||
} else if (unitString == "Percentage") {
|
||||
return Types::UnitPercentage;
|
||||
} else if (unitString == "PartsPerMillion") {
|
||||
return Types::UnitPartsPerMillion;
|
||||
} else if (unitString == "Euro") {
|
||||
return Types::UnitEuro;
|
||||
} else if (unitString == "Dollar") {
|
||||
return Types::UnitDollar;
|
||||
} else {
|
||||
qCWarning(dcDeviceManager) << "Could not parse unit:" << unitString << "in plugin" << this->pluginName();
|
||||
|
||||
QMetaObject metaObject = Types::staticMetaObject;
|
||||
int enumIndex = metaObject.indexOfEnumerator(QString("Unit").toLatin1().data());
|
||||
QMetaEnum metaEnum = metaObject.enumerator(enumIndex);
|
||||
|
||||
int enumValue = -1;
|
||||
for (int i = 0; i < metaEnum.keyCount(); i++) {
|
||||
if (QString(metaEnum.valueToKey(metaEnum.value(i))) == QString("Unit" + unitString)) {
|
||||
enumValue = metaEnum.value(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Types::UnitNone;
|
||||
|
||||
// inform the plugin developer about the error in the plugin json file
|
||||
Q_ASSERT_X(enumValue != -1,
|
||||
QString("\"%1\" plugin").arg(pluginName()).toLatin1().data(),
|
||||
QString("Invalid unit type \"%1\" in json file.").arg(unitString).toLatin1().data());
|
||||
|
||||
return (Types::Unit)enumValue;
|
||||
}
|
||||
|
||||
Types::InputType DevicePlugin::inputTypeStringToInputType(const QString &inputType) const
|
||||
Types::InputType DevicePlugin::loadAndVerifyInputType(const QString &inputType) const
|
||||
{
|
||||
if (inputType == "TextLine") {
|
||||
return Types::InputTypeTextLine;
|
||||
} else if (inputType == "TextArea") {
|
||||
return Types::InputTypeTextArea;
|
||||
} else if (inputType == "Password") {
|
||||
return Types::InputTypePassword;
|
||||
} else if (inputType == "Search") {
|
||||
return Types::InputTypeSearch;
|
||||
} else if (inputType == "Mail") {
|
||||
return Types::InputTypeMail;
|
||||
} else if (inputType == "IPv4Address") {
|
||||
return Types::InputTypeIPv4Address;
|
||||
} else if (inputType == "IPv6Address") {
|
||||
return Types::InputTypeIPv6Address;
|
||||
} else if (inputType == "Url") {
|
||||
return Types::InputTypeUrl;
|
||||
} else if (inputType == "MacAddress") {
|
||||
return Types::InputTypeMacAddress;
|
||||
QMetaObject metaObject = Types::staticMetaObject;
|
||||
int enumIndex = metaObject.indexOfEnumerator(QString("InputType").toLatin1().data());
|
||||
QMetaEnum metaEnum = metaObject.enumerator(enumIndex);
|
||||
|
||||
int enumValue = -1;
|
||||
for (int i = 0; i < metaEnum.keyCount(); i++) {
|
||||
if (QString(metaEnum.valueToKey(metaEnum.value(i))) == QString("InputType" + inputType)) {
|
||||
enumValue = metaEnum.value(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Types::InputTypeNone;
|
||||
|
||||
// inform the plugin developer about the error in the plugin json file
|
||||
Q_ASSERT_X(enumValue != -1,
|
||||
QString("\"%1\" plugin").arg(pluginName()).toLatin1().data(),
|
||||
QString("Invalid inputType \"%1\" in json file.").arg(inputType).toLatin1().data());
|
||||
|
||||
return (Types::InputType)enumValue;
|
||||
}
|
||||
|
||||
DeviceClass::BasicTag DevicePlugin::basicTagStringToBasicTag(const QString &basicTag) const
|
||||
DeviceClass::BasicTag DevicePlugin::loadAndVerifyBasicTag(const QString &basicTag) const
|
||||
{
|
||||
if (basicTag == "Device") {
|
||||
return DeviceClass::BasicTagDevice;
|
||||
} else if (basicTag == "Service") {
|
||||
return DeviceClass::BasicTagService;
|
||||
} else if (basicTag == "Actuator") {
|
||||
return DeviceClass::BasicTagActuator;
|
||||
} else if (basicTag == "Sensor") {
|
||||
return DeviceClass::BasicTagSensor;
|
||||
} else if (basicTag == "Lighting") {
|
||||
return DeviceClass::BasicTagLighting;
|
||||
} else if (basicTag == "Energy") {
|
||||
return DeviceClass::BasicTagEnergy;
|
||||
} else if (basicTag == "Multimedia") {
|
||||
return DeviceClass::BasicTagMultimedia;
|
||||
} else if (basicTag == "Weather") {
|
||||
return DeviceClass::BasicTagWeather;
|
||||
} else if (basicTag == "Gateway") {
|
||||
return DeviceClass::BasicTagGateway;
|
||||
} else if (basicTag == "Heating") {
|
||||
return DeviceClass::BasicTagHeating;
|
||||
} else if (basicTag == "Cooling") {
|
||||
return DeviceClass::BasicTagCooling;
|
||||
} else if (basicTag == "Notification") {
|
||||
return DeviceClass::BasicTagNotification;
|
||||
} else if (basicTag == "Security") {
|
||||
return DeviceClass::BasicTagSecurity;
|
||||
} else if (basicTag == "Time") {
|
||||
return DeviceClass::BasicTagTime;
|
||||
} else if (basicTag == "Shading") {
|
||||
return DeviceClass::BasicTagShading;
|
||||
} else if (basicTag == "Appliance") {
|
||||
return DeviceClass::BasicTagAppliance;
|
||||
} else if (basicTag == "Camera") {
|
||||
return DeviceClass::BasicTagCamera;
|
||||
} else if (basicTag == "Lock") {
|
||||
return DeviceClass::BasicTagLock;
|
||||
} else {
|
||||
qCWarning(dcDeviceManager) << "Could not parse basicTag:" << basicTag << "in plugin" << this->pluginName();
|
||||
QMetaObject metaObject = DeviceClass::staticMetaObject;
|
||||
int enumIndex = metaObject.indexOfEnumerator(QString("BasicTag").toLatin1().data());
|
||||
QMetaEnum metaEnum = metaObject.enumerator(enumIndex);
|
||||
|
||||
int enumValue = -1;
|
||||
for (int i = 0; i < metaEnum.keyCount(); i++) {
|
||||
if (QString(metaEnum.valueToKey(metaEnum.value(i))) == QString("BasicTag" + basicTag)) {
|
||||
enumValue = metaEnum.value(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DeviceClass::BasicTagDevice;
|
||||
// inform the plugin developer about the error in the plugin json file
|
||||
Q_ASSERT_X(enumValue != -1,
|
||||
QString("\"%1\" plugin").arg(pluginName()).toLatin1().data(),
|
||||
QString("Invalid basicTag type \"%1\" in json file.").arg(basicTag).toLatin1().data());
|
||||
|
||||
return (DeviceClass::BasicTag)enumValue;
|
||||
}
|
||||
|
||||
DeviceClass::DeviceIcon DevicePlugin::loadAndVerifyDeviceIcon(const QString &deviceIcon) const
|
||||
{
|
||||
if (deviceIcon.isEmpty())
|
||||
return DeviceClass::DeviceIconNone;
|
||||
|
||||
QMetaObject metaObject = DeviceClass::staticMetaObject;
|
||||
int enumIndex = metaObject.indexOfEnumerator(QString("DeviceIcon").toLatin1().data());
|
||||
QMetaEnum metaEnum = metaObject.enumerator(enumIndex);
|
||||
|
||||
int enumValue = -1;
|
||||
for (int i = 0; i < metaEnum.keyCount(); i++) {
|
||||
if (QString(metaEnum.valueToKey(metaEnum.value(i))) == QString("DeviceIcon" + deviceIcon)) {
|
||||
enumValue = metaEnum.value(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// inform the plugin developer about the error in the plugin json file
|
||||
Q_ASSERT_X(enumValue != -1,
|
||||
QString("\"%1\" plugin").arg(pluginName()).toLatin1().data(),
|
||||
QString("Invalid icon type \"%1\" in json file.").arg(deviceIcon).toLatin1().data());
|
||||
|
||||
return (DeviceClass::DeviceIcon)enumValue;
|
||||
}
|
||||
|
||||
@ -38,7 +38,9 @@
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaEnum>
|
||||
#include <QJsonObject>
|
||||
#include <QMetaObject>
|
||||
|
||||
class DeviceManager;
|
||||
class Device;
|
||||
@ -90,7 +92,6 @@ public:
|
||||
QVariant configValue(const QString ¶mName) const;
|
||||
DeviceManager::DeviceError setConfigValue(const QString ¶mName, const QVariant &value);
|
||||
|
||||
|
||||
signals:
|
||||
void emitEvent(const Event &event);
|
||||
void devicesDiscovered(const DeviceClassId &deviceClassId, const QList<DeviceDescriptor> &deviceDescriptors);
|
||||
@ -125,9 +126,11 @@ private:
|
||||
|
||||
QStringList verifyFields(const QStringList &fields, const QJsonObject &value) const;
|
||||
|
||||
Types::Unit unitStringToUnit(const QString &unitString) const;
|
||||
Types::InputType inputTypeStringToInputType(const QString &inputType) const;
|
||||
DeviceClass::BasicTag basicTagStringToBasicTag(const QString &basicTag) const;
|
||||
// load and verify enum values
|
||||
Types::Unit loadAndVerifyUnit(const QString &unitString) const;
|
||||
Types::InputType loadAndVerifyInputType(const QString &inputType) const;
|
||||
DeviceClass::BasicTag loadAndVerifyBasicTag(const QString &basicTag) const;
|
||||
DeviceClass::DeviceIcon loadAndVerifyDeviceIcon(const QString &deviceIcon) const;
|
||||
|
||||
DeviceManager *m_deviceManager;
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
"deviceClassId": "29cd8265-d8bb-4cf9-9080-bfc2cf9787bc",
|
||||
"name": "aWATTar",
|
||||
"createMethods": ["user"],
|
||||
"deviceIcon": "Energy",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Actuator",
|
||||
|
||||
@ -11,12 +11,13 @@
|
||||
{
|
||||
"deviceClassId": "2bb14180-aa5d-4999-992d-e6d464cff486",
|
||||
"name": "Shutter (RSM900R)",
|
||||
"idName": "conradShutter",
|
||||
"deviceIcon": "Blinds",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
"Shading"
|
||||
],
|
||||
"idName": "conradShutter",
|
||||
"createMethods": ["user"],
|
||||
"paramTypes": [
|
||||
{
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "fbf665fb-9aca-423f-a5f2-924e50ebe6ca",
|
||||
"idName": "today",
|
||||
"name": "Today",
|
||||
"deviceIcon": "Time",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Time"
|
||||
@ -174,6 +175,7 @@
|
||||
"deviceClassId": "3f3c7ecc-9915-4e4e-95a1-e11f4f9d174d",
|
||||
"idName": "alarm",
|
||||
"name": "Alarm",
|
||||
"deviceIcon": "Time",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Actuator",
|
||||
@ -271,6 +273,7 @@
|
||||
"deviceClassId": "805c8948-e663-4ba6-aa67-df7446ed7098",
|
||||
"idName": "countdown",
|
||||
"name": "Countdown",
|
||||
"deviceIcon": "Time",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Actuator",
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
"deviceClassId": "164f9602-90ee-4693-bda3-9cafae37603e",
|
||||
"idName": "avea",
|
||||
"name": "Avea",
|
||||
"deviceIcon": "LightBulb",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
{
|
||||
"deviceClassId": "308ae6e6-38b3-4b3a-a513-3199da2764f8",
|
||||
"name": "Elro Socket",
|
||||
"deviceIcon": "Socket",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "1e892268-8bd7-442c-a001-bd4e2e6b2949",
|
||||
"idName": "cube",
|
||||
"name": "Max! Cube LAN Gateway",
|
||||
"deviceIcon": "Gateway",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Gateway",
|
||||
@ -60,6 +61,7 @@
|
||||
"deviceClassId": "ffbfec5d-06e8-4082-b62b-92cc5c3e8c4e",
|
||||
"idName": "wallThermostate",
|
||||
"name": "Max! Wall Thermostat",
|
||||
"deviceIcon": "Thermometer",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Heating",
|
||||
@ -241,6 +243,7 @@
|
||||
"deviceClassId": "f80d9481-4827-45ee-a013-b97b22412d92",
|
||||
"idName": "radiatorThermostate",
|
||||
"name": "Max! Radiator Thermostat",
|
||||
"deviceIcon": "Thermometer",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Heating",
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "c0f511f9-70f5-499b-bd70-2c0e9ddd68c4",
|
||||
"idName": "toggleButton",
|
||||
"name": "Toggle Button",
|
||||
"deviceIcon": "Switch",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
@ -39,6 +40,7 @@
|
||||
"deviceClassId": "820b2f2d-0d92-48c8-8fd4-f94ce8fc4103",
|
||||
"idName": "button",
|
||||
"name": "Button",
|
||||
"deviceIcon": "Switch",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
@ -70,6 +72,7 @@
|
||||
"deviceClassId": "430d188c-476d-4825-a9bd-86dfa3094b56",
|
||||
"idName": "onOffButton",
|
||||
"name": "ON/OFF Button",
|
||||
"deviceIcon": "Switch",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "324219e8-7c53-41b5-b314-c2900cd15252",
|
||||
"name": "Intertechno switch",
|
||||
"createMethods": ["user"],
|
||||
"deviceIcon": "Switch",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "d09953e3-c5bd-415b-973b-0d0bf2be3f69",
|
||||
"idName": "kodi",
|
||||
"name": "Kodi",
|
||||
"deviceIcon": "Tv",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Multimedia",
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "6b1f8f37-7eb4-46c4-9f15-a6eb4904999c",
|
||||
"idName": "rfController",
|
||||
"name": "RF Controller (LN-CON-RF20B)",
|
||||
"deviceIcon": "LightBulb",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "1d41b5a8-74ff-4a12-b365-c7bbe610848f",
|
||||
"idName": "lgSmartTv",
|
||||
"name": "LG Smart Tv",
|
||||
"deviceIcon": "Tv",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Multimedia",
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "f4844c97-7ca6-4349-904e-ff9749a9fe74",
|
||||
"idName": "customMail",
|
||||
"name": "Custom mail",
|
||||
"deviceIcon": "Mail",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Notification"
|
||||
@ -90,6 +91,7 @@
|
||||
"deviceClassId": "3869884a-1592-4b8f-84a7-994be18ff555",
|
||||
"idName": "googleMail",
|
||||
"name": "Google mail",
|
||||
"deviceIcon": "Mail",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Notification"
|
||||
@ -143,6 +145,7 @@
|
||||
"deviceClassId": "59409e8f-0c83-414f-abd5-bbbf2758acba",
|
||||
"idName": "yahooMail",
|
||||
"name": "Yahoo mail",
|
||||
"deviceIcon": "Mail",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Notification"
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
"deviceClassId": "753f0d32-0468-4d08-82ed-1964aab03298",
|
||||
"idName": "mock",
|
||||
"name": "Mock Device",
|
||||
"deviceIcon": "Tune",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
@ -140,6 +141,7 @@
|
||||
"Gateway"
|
||||
],
|
||||
"createMethods": ["auto"],
|
||||
"deviceIcon": "Tune",
|
||||
"paramTypes": [
|
||||
{
|
||||
"name": "name",
|
||||
@ -238,6 +240,7 @@
|
||||
],
|
||||
"createMethods": ["discovery"],
|
||||
"setupMethod": "pushButton",
|
||||
"deviceIcon": "Tune",
|
||||
"pairingInfo": "Wait 3 second before you continue, the push button will be pressed automatically.",
|
||||
"discoveryParamTypes": [
|
||||
{
|
||||
@ -281,7 +284,7 @@
|
||||
"idName": "allowedValues",
|
||||
"name": "allowed values",
|
||||
"type": "QString",
|
||||
"defaultValue": "String value 1",
|
||||
"defaultValue": "String value 2",
|
||||
"possibleValues": [
|
||||
"String value 1",
|
||||
"String value 2",
|
||||
@ -321,6 +324,7 @@
|
||||
"deviceClassId": "296f1fd4-e893-46b2-8a42-50d1bceb8730",
|
||||
"idName": "mockDisplayPin",
|
||||
"name": "Mock Device (Display Pin)",
|
||||
"deviceIcon": "Tune",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
@ -418,6 +422,7 @@
|
||||
"deviceClassId": "a71fbde9-9a38-4bf8-beab-c8aade2608ba",
|
||||
"idName": "mockParent",
|
||||
"name": "Mock Device (Parent)",
|
||||
"deviceIcon": "Tune",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
@ -480,6 +485,7 @@
|
||||
"deviceClassId": "515ffdf1-55e5-498d-9abc-4e2fe768f3a9",
|
||||
"idName": "mockInputType",
|
||||
"name": "Mock Device (InputTypes)",
|
||||
"deviceIcon": "Tune",
|
||||
"basicTags": [
|
||||
"Device"
|
||||
],
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "728d5a67-27a3-400e-b83c-2765f5196f69",
|
||||
"idName": "connection",
|
||||
"name": "Netatmo Connection",
|
||||
"deviceIcon": "Network",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Gateway",
|
||||
@ -49,6 +50,7 @@
|
||||
"deviceClassId": "1c809049-04f2-4710-99f5-6ed379a2934f",
|
||||
"idName": "indoor",
|
||||
"name": "Indoor Station",
|
||||
"deviceIcon": "Thermometer",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Weather",
|
||||
@ -154,6 +156,7 @@
|
||||
"deviceClassId": "6cc01d62-7317-4ec4-8ac4-a4cab762c179",
|
||||
"idName": "outdoor",
|
||||
"name": "Outdoor Station",
|
||||
"deviceIcon": "Thermometer",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Weather",
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "985195aa-17ad-4530-88a4-cdd753d747d7",
|
||||
"idName": "openweathermap",
|
||||
"name": "Weather",
|
||||
"deviceIcon": "Weather",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Weather",
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "642aa4c7-19aa-45ed-ba06-aa1ae6c9edf7",
|
||||
"idName": "hueBridge",
|
||||
"name": "Hue gateway",
|
||||
"deviceIcon": "Gateway",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Gateway",
|
||||
@ -118,6 +119,7 @@
|
||||
"deviceClassId": "0edba26c-96ab-44fb-a6a2-c0574d19630e",
|
||||
"idName": "hueLight",
|
||||
"name": "Hue Light",
|
||||
"deviceIcon": "LightBulb",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Lighting",
|
||||
@ -251,6 +253,7 @@
|
||||
"deviceClassId": "4fa568ef-7a3a-422b-b0c0-206d37cb4eed",
|
||||
"idName": "hueWhiteLight",
|
||||
"name": "Hue White Light",
|
||||
"deviceIcon": "LightBulb",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator",
|
||||
@ -352,6 +355,7 @@
|
||||
"deviceClassId": "bb482d39-67ef-46dc-88e9-7b181d642b28",
|
||||
"idName": "hueRemote",
|
||||
"name": "Hue Remote",
|
||||
"deviceIcon": "Switch",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Sensor"
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
{
|
||||
"deviceClassId": "6ecd5a8d-595a-4520-85e3-dcc9679edf66",
|
||||
"name": "UDP Commander",
|
||||
"deviceIcon": "Network",
|
||||
"basicTags": [
|
||||
"Service",
|
||||
"Sensor"
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
{
|
||||
"deviceClassId": "8468a15d-ecc0-43b6-98ca-e1e4ac9e2df3",
|
||||
"name": "Unitec switch (48111)",
|
||||
"deviceIcon": "Switch",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
{
|
||||
"deviceClassId": "3c8f2447-dcd0-4882-8c09-99e579e4d24c",
|
||||
"name": "Wake On Lan",
|
||||
"deviceIcon": "Network",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "69d97d3b-a8e6-42f3-afc0-ca8a53eb7cce",
|
||||
"idName": "wemoSwitch",
|
||||
"name": "WeMo Switch",
|
||||
"deviceIcon": "Socket",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Actuator"
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"deviceClassId": "bd216356-f1ec-4324-9785-6982d2174e17",
|
||||
"name": "WiFi Device",
|
||||
"idName": "wifi",
|
||||
"deviceIcon": "Network",
|
||||
"basicTags": [
|
||||
"Device",
|
||||
"Sensor"
|
||||
|
||||
@ -81,13 +81,13 @@ void JsonTypes::init()
|
||||
{
|
||||
// BasicTypes
|
||||
s_basicType = enumToStrings(JsonTypes::staticMetaObject, "BasicType");
|
||||
s_basicTag = enumToStrings(DeviceClass::staticMetaObject, "BasicTag");
|
||||
s_stateOperator = enumToStrings(Types::staticMetaObject, "StateOperator");
|
||||
s_valueOperator = enumToStrings(Types::staticMetaObject, "ValueOperator");
|
||||
s_inputType = enumToStrings(Types::staticMetaObject, "InputType");
|
||||
s_unit = enumToStrings(Types::staticMetaObject, "Unit");
|
||||
s_createMethod = enumToStrings(DeviceClass::staticMetaObject, "CreateMethod");
|
||||
s_setupMethod = enumToStrings(DeviceClass::staticMetaObject, "SetupMethod");
|
||||
s_basicTag = enumToStrings(DeviceClass::staticMetaObject, "BasicTag");
|
||||
s_deviceIcon = enumToStrings(DeviceClass::staticMetaObject, "DeviceIcon");
|
||||
s_removePolicy = enumToStrings(RuleEngine::staticMetaObject, "RemovePolicy");
|
||||
s_deviceError = enumToStrings(DeviceManager::staticMetaObject, "DeviceError");
|
||||
@ -193,6 +193,7 @@ void JsonTypes::init()
|
||||
s_deviceClass.insert("vendorId", basicTypeToString(Uuid));
|
||||
s_deviceClass.insert("pluginId", basicTypeToString(Uuid));
|
||||
s_deviceClass.insert("name", basicTypeToString(String));
|
||||
s_deviceClass.insert("deviceIcon", deviceIconRef());
|
||||
s_deviceClass.insert("basicTags", QVariantList() << basicTagRef());
|
||||
s_deviceClass.insert("stateTypes", QVariantList() << stateTypeRef());
|
||||
s_deviceClass.insert("eventTypes", QVariantList() << eventTypeRef());
|
||||
@ -529,6 +530,7 @@ QVariantMap JsonTypes::packDeviceClass(const DeviceClass &deviceClass)
|
||||
variant.insert("id", deviceClass.id());
|
||||
variant.insert("vendorId", deviceClass.vendorId());
|
||||
variant.insert("pluginId", deviceClass.pluginId());
|
||||
variant.insert("deviceIcon", s_deviceIcon.at(deviceClass.deviceIcon()));
|
||||
|
||||
QVariantList basicTags;
|
||||
foreach (const DeviceClass::BasicTag &basicTag, deviceClass.basicTags()) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
36
|
||||
37
|
||||
{
|
||||
"methods": {
|
||||
"Actions.ExecuteAction": {
|
||||
@ -595,6 +595,7 @@
|
||||
"createMethods": [
|
||||
"$ref:CreateMethod"
|
||||
],
|
||||
"deviceIcon": "$ref:DeviceIcon",
|
||||
"discoveryParamTypes": [
|
||||
"$ref:ParamType"
|
||||
],
|
||||
@ -644,6 +645,42 @@
|
||||
"DeviceErrorPairingTransactionIdNotFound",
|
||||
"DeviceErrorParameterNotWritable"
|
||||
],
|
||||
"DeviceIcon": [
|
||||
"DeviceIconNone",
|
||||
"DeviceIconBed",
|
||||
"DeviceIconBlinds",
|
||||
"DeviceIconCeilingLamp",
|
||||
"DeviceIconCouch",
|
||||
"DeviceIconDeskLamp",
|
||||
"DeviceIconDesk",
|
||||
"DeviceIconHifi",
|
||||
"DeviceIconPower",
|
||||
"DeviceIconEnergy",
|
||||
"DeviceIconRadio",
|
||||
"DeviceIconSmartPhone",
|
||||
"DeviceIconSocket",
|
||||
"DeviceIconStandardLamp",
|
||||
"DeviceIconSun",
|
||||
"DeviceIconTablet",
|
||||
"DeviceIconThermometer",
|
||||
"DeviceIconTune",
|
||||
"DeviceIconTv",
|
||||
"DeviceIconBattery",
|
||||
"DeviceIconDishwasher",
|
||||
"DeviceIconWashingMachine",
|
||||
"DeviceIconLaundryDryer",
|
||||
"DeviceIconIrHeater",
|
||||
"DeviceIconRadiator",
|
||||
"DeviceIconSwitch",
|
||||
"DeviceIconMotionDetectors",
|
||||
"DeviceIconWeather",
|
||||
"DeviceIconTime",
|
||||
"DeviceIconLightBulb",
|
||||
"DeviceIconGateway",
|
||||
"DeviceIconMail",
|
||||
"DeviceIconNetwork",
|
||||
"DeviceIconCloud"
|
||||
],
|
||||
"Event": {
|
||||
"deviceId": "Uuid",
|
||||
"eventTypeId": "Uuid",
|
||||
@ -879,7 +916,15 @@
|
||||
"UnitPercentage",
|
||||
"UnitPartsPerMillion",
|
||||
"UnitEuro",
|
||||
"UnitDollar"
|
||||
"UnitDollar",
|
||||
"UnitHerz",
|
||||
"UnitAmpere",
|
||||
"UnitMilliAmpere",
|
||||
"UnitVolt",
|
||||
"UnitMilliVolt",
|
||||
"UnitVoltAmpere",
|
||||
"UnitVoltAmpereReactive",
|
||||
"UnitAmpereHour"
|
||||
],
|
||||
"ValueOperator": [
|
||||
"ValueOperatorEquals",
|
||||
|
||||
Reference in New Issue
Block a user