ilcato / homebridge-Fibaro-HC2

Homebridge plugin for Fibaro Home Center 2 (and Home Center Lite ...)
Apache License 2.0
66 stars 27 forks source link

Add RGBW support #85

Closed TimE90 closed 6 years ago

TimE90 commented 6 years ago

It would be nice if you add support for RGBW devices. API-Example of a RGBW device:

{"id":87,"name":"LED Küchenzeile","roomID":1,"type":"com.fibaro.FGRGBW441M","baseType":"com.fibaro.colorController","enabled":true,"visible":true,"isPlugin":false,"parentId":86,"remoteGatewayId":0,"interfaces":["deviceGrouping","energy","fibaroFirmwareUpdate","levelChange","light","power","zwave","zwaveSwitchAll"],"properties":{"parameters":[{"id":1,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":8,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":9,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":10,"lastReportedValue":10,"lastSetValue":10,"size":2,"value":10},{"id":11,"lastReportedValue":67,"lastSetValue":67,"size":1,"value":67},{"id":12,"lastReportedValue":255,"lastSetValue":255,"size":1,"value":255},{"id":13,"lastReportedValue":2,"lastSetValue":2,"size":1,"value":2},{"id":15,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":16,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":30,"lastReportedValue":3,"lastSetValue":3,"size":1,"value":3},{"id":38,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":39,"lastReportedValue":600,"lastSetValue":600,"size":2,"value":600},{"id":44,"lastReportedValue":30,"lastSetValue":30,"size":2,"value":30},{"id":45,"lastReportedValue":10,"lastSetValue":10,"size":1,"value":10},{"id":71,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":73,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":6,"lastReportedValue":2,"lastSetValue":2,"size":1,"value":2},{"id":14,"lastReportedValue":4369,"lastSetValue":4369,"size":2,"value":4369},{"id":42,"lastReportedValue":2,"lastSetValue":2,"size":1,"value":2}],"pollingTimeSec":0,"zwaveCompany":"Fibargroup","zwaveInfo":"3,3,52","zwaveVersion":"25.25","associationMode":"2","b":"0","brightness":"5","buttonType":"0","color":"10,0,0,14","configured":true,"currentProgram":"0","currentProgramID":"0","dead":"false","deviceControlType":"50","deviceGroup":"[]","deviceGroupMaster":"0","deviceIcon":"15","emailNotificationID":"0","emailNotificationType":"0","endPointId":"0","energy":"21.23","favoriteProgram":"0","firmwareUpdate":"{\"info\":\"\",\"progress\":0,\"status\":\"Available\",\"updateVersion\":\"26.25\"}","g":"0","isLight":"true","lastColorSet":"10,0,0,14","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","mode":"0","model":"","nodeId":"2","parametersTemplate":"231","power":"2.60","productInfo":"1,15,9,0,16,0,25,25","programsSortOrder":"1,2,3,4,5","pushNotificationID":"0","pushNotificationType":"0","r":"0","rememberColor":"true","remoteGatewayId":"0","saveLogs":"true","serialNumber":"","showEnergy":"true","smsNotificationID":"0","smsNotificationType":"0","switchAllMode":"SWITCH_ALL_INCLUDED_IN_THE_ALL_ON_ALL_OFF_FUNCTIONALITY","updateVersion":"","useTemplate":"true","userDescription":"","value":"5","w":"0"},"actions":{"reconfigure":0,"reset":0,"setB":1,"setBrightness":1,"setColor":1,"setFavoriteProgram":2,"setG":1,"setR":1,"setValue":1,"setW":1,"startLevelDecrease":0,"startLevelIncrease":0,"startProgram":1,"stopLevelChange":0,"turnOff":0,"turnOn":0,"updateFirmware":1},"created":1510246350,"modified":1510246350,"sortOrder":59}

ilcato commented 6 years ago

It's already supported. Doesn't work for you?

TimE90 commented 6 years ago

Ahhh… I can see if I change the color via Eve app under "White" setting it sometimes says: [1/29/2018, 4:25:55 PM] [FibaroHC2] Setting value to device: 226 parameter: Saturation [1/29/2018, 4:25:55 PM] [FibaroHC2] Command: setR, value: 0, to: 226 [1/29/2018, 4:25:55 PM] [FibaroHC2] Command: setB, value: 0, to: 226 [1/29/2018, 4:25:55 PM] [FibaroHC2] Command: setG, value: 0, to: 226

But if I then change the color to red it only updates "RGB" and "W" stays to 226. Due to this we get the wrong color.

TimE90 commented 6 years ago

Another example:

bildschirmfoto 2018-01-29 um 17 32 30

When I now say something like that "Hey Siri, change the color in kitchen to red" it does something like this: [1/29/2018, 4:35:25 PM] [FibaroHC2] Setting value to device: 226 parameter: Hue [1/29/2018, 4:35:25 PM] [FibaroHC2] Setting value to device: 226 parameter: On [1/29/2018, 4:35:25 PM] [FibaroHC2] Setting value to device: 226 parameter: Saturation [1/29/2018, 4:35:25 PM] [FibaroHC2] Setting value to device: 226 parameter: Brightness [1/29/2018, 4:35:25 PM] [FibaroHC2] Command: setR, value: 255, to: 226 [1/29/2018, 4:35:25 PM] [FibaroHC2] Command: setG, value: 255, to: 226 [1/29/2018, 4:35:25 PM] [FibaroHC2] Command: setB, value: 255, to: 226 [1/29/2018, 4:35:25 PM] [FibaroHC2] Command: setW, value: 255, to: 226

I don't know if this is a bug in your plugin or in HomeKit… but I think the commands above won't set the color to red...

TimE90 commented 6 years ago

"Set color to green": [1/29/2018, 4:43:17 PM] [FibaroHC2] Command: setR, value: 0, to: 226 [1/29/2018, 4:43:17 PM] [FibaroHC2] Command: setB, value: 0, to: 226 [1/29/2018, 4:43:17 PM] [FibaroHC2] Command: setG, value: 255, to: 226

But now W stays to "255" in Fibaro and I get a "lime green"… I think we should always update all channels of RGBW?

ilcato commented 6 years ago

I'm not managing correctly the mapping between HSB and RGBW. I'm only mapping RGB. Let me check if I can make change. I do not have the device so I need you in order to test the code.

TimE90 commented 6 years ago

I'm here to assist and would be happy to start controlling my RGBW lamps correctly. I think it's always important to set all color channels.

ilcato commented 6 years ago

Found the way I think. I will implement it later or tomorrow morning.

TimE90 commented 6 years ago

Perfect.. looking forward to test it 👍

ilcato commented 6 years ago

@TimE90 I implemented the fix. Can you try it? Please update all the files in the dist folder.

TimE90 commented 6 years ago

Ok, will give it a try now :)

TimE90 commented 6 years ago

Wow! It just works perfectly! Nice one bro!

ilcato commented 6 years ago

Ok, I will insert it in the next release.