diff --git a/elgato/aveabulb.cpp b/elgato/aveabulb.cpp index cfd72330..1ab4bd16 100644 --- a/elgato/aveabulb.cpp +++ b/elgato/aveabulb.cpp @@ -205,7 +205,7 @@ bool AveaBulb::syncColor() return false; } - m_device->setStateValue(aveaBlueStateTypeId, m_white); + m_device->setStateValue(aveaWhiteStateTypeId, m_white); m_device->setStateValue(aveaRedStateTypeId, m_red); m_device->setStateValue(aveaGreenStateTypeId, m_green); m_device->setStateValue(aveaBlueStateTypeId, m_blue); diff --git a/elgato/devicepluginelgato.cpp b/elgato/devicepluginelgato.cpp index c9ba8226..f83ce11a 100644 --- a/elgato/devicepluginelgato.cpp +++ b/elgato/devicepluginelgato.cpp @@ -498,12 +498,26 @@ DeviceManager::DeviceError DevicePluginElgato::executeAction(Device *device, con device->setStateValue(aveaColorStateTypeId, color); 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) { int whiteValue = action.param(aveaWhiteActionParamTypeId).value().toInt(); if (!bulb->setWhite(whiteValue)) return DeviceManager::DeviceErrorHardwareNotAvailable; - device->setStateValue(aveaWhiteStateTypeId, whiteValue); return DeviceManager::DeviceErrorNoError; } else if (action.actionTypeId() == aveaGreenActionTypeId) { int greenValue = action.param(aveaGreenActionParamTypeId).value().toInt(); diff --git a/elgato/devicepluginelgato.json b/elgato/devicepluginelgato.json index 8626a936..b531d48d 100644 --- a/elgato/devicepluginelgato.json +++ b/elgato/devicepluginelgato.json @@ -14,7 +14,7 @@ "displayName": "Avea", "deviceIcon": "LightBulb", "basicTags": ["Device", "Actuator", "Lighting"], - "interfaces": ["connectable"], + "interfaces": ["connectable", "light", "colorlight"], "createMethods": ["discovery"], "paramTypes": [ { @@ -78,6 +78,19 @@ "defaultValue": "#000000", "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", "name": "white",