avea-colorlight interface testing
This commit is contained in:
parent
69a1930dc8
commit
ee850d0b17
@ -205,7 +205,7 @@ bool AveaBulb::syncColor()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_device->setStateValue(aveaBlueStateTypeId, m_white);
|
m_device->setStateValue(aveaWhiteStateTypeId, m_white);
|
||||||
m_device->setStateValue(aveaRedStateTypeId, m_red);
|
m_device->setStateValue(aveaRedStateTypeId, m_red);
|
||||||
m_device->setStateValue(aveaGreenStateTypeId, m_green);
|
m_device->setStateValue(aveaGreenStateTypeId, m_green);
|
||||||
m_device->setStateValue(aveaBlueStateTypeId, m_blue);
|
m_device->setStateValue(aveaBlueStateTypeId, m_blue);
|
||||||
|
|||||||
@ -498,12 +498,26 @@ DeviceManager::DeviceError DevicePluginElgato::executeAction(Device *device, con
|
|||||||
|
|
||||||
device->setStateValue(aveaColorStateTypeId, color);
|
device->setStateValue(aveaColorStateTypeId, color);
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
|
} else if (action.actionTypeId() == aveaColorTemperatureActionTypeId) {
|
||||||
|
// (ct-153) : x = (500-153) : 255
|
||||||
|
int ctValue = action.param(aveaColorTemperatureActionParamTypeId).value().toInt();
|
||||||
|
int blue = (ctValue - 153) * 255 / (500-153);
|
||||||
|
int red = 255 - blue;
|
||||||
|
QColor color;
|
||||||
|
color.setRed(red);
|
||||||
|
color.setGreen(0);
|
||||||
|
color.setBlue(blue);
|
||||||
|
if (!bulb->setWhite(4095) || !bulb->setColor(color)) {
|
||||||
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
}
|
||||||
|
device->setStateValue(aveaColorStateTypeId, color);
|
||||||
|
device->setStateValue(aveaColorTemperatureStateTypeId, ctValue);
|
||||||
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaWhiteActionTypeId) {
|
} else if (action.actionTypeId() == aveaWhiteActionTypeId) {
|
||||||
int whiteValue = action.param(aveaWhiteActionParamTypeId).value().toInt();
|
int whiteValue = action.param(aveaWhiteActionParamTypeId).value().toInt();
|
||||||
if (!bulb->setWhite(whiteValue))
|
if (!bulb->setWhite(whiteValue))
|
||||||
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
return DeviceManager::DeviceErrorHardwareNotAvailable;
|
||||||
|
|
||||||
device->setStateValue(aveaWhiteStateTypeId, whiteValue);
|
|
||||||
return DeviceManager::DeviceErrorNoError;
|
return DeviceManager::DeviceErrorNoError;
|
||||||
} else if (action.actionTypeId() == aveaGreenActionTypeId) {
|
} else if (action.actionTypeId() == aveaGreenActionTypeId) {
|
||||||
int greenValue = action.param(aveaGreenActionParamTypeId).value().toInt();
|
int greenValue = action.param(aveaGreenActionParamTypeId).value().toInt();
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
"displayName": "Avea",
|
"displayName": "Avea",
|
||||||
"deviceIcon": "LightBulb",
|
"deviceIcon": "LightBulb",
|
||||||
"basicTags": ["Device", "Actuator", "Lighting"],
|
"basicTags": ["Device", "Actuator", "Lighting"],
|
||||||
"interfaces": ["connectable"],
|
"interfaces": ["connectable", "light", "colorlight"],
|
||||||
"createMethods": ["discovery"],
|
"createMethods": ["discovery"],
|
||||||
"paramTypes": [
|
"paramTypes": [
|
||||||
{
|
{
|
||||||
@ -78,6 +78,19 @@
|
|||||||
"defaultValue": "#000000",
|
"defaultValue": "#000000",
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "8932ddac-d718-4345-94aa-f4c9611f132f",
|
||||||
|
"name": "colorTemperature",
|
||||||
|
"displayName": "color temperature",
|
||||||
|
"displayNameEvent": "color temperature changed",
|
||||||
|
"displayNameAction": "Set color temperature",
|
||||||
|
"type": "int",
|
||||||
|
"unit": "Mired",
|
||||||
|
"defaultValue": 170,
|
||||||
|
"minValue": 153,
|
||||||
|
"maxValue": 500,
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "50f6a224-fb8d-487d-8774-1a0536e5b1aa",
|
"id": "50f6a224-fb8d-487d-8774-1a0536e5b1aa",
|
||||||
"name": "white",
|
"name": "white",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user