home-assistant / homebridge-homeassistant

DEPRECATED in favor of native HomeKit support. -  Homebridge plugin for Home Assistant
https://www.home-assistant.io/components/homekit/
Other
682 stars 144 forks source link

RGB support #84

Closed JohanLeirnes closed 7 years ago

JohanLeirnes commented 7 years ago

RGB and RGBW support is needed. Somthing like this may help?

There seem to bee alot of HSB(HSV) to RGB converters out there. Maby this can help: https://gist.github.com/eyecatchup/9536706

tobre6 commented 7 years ago

I have been playing around with this issue a couple of days now. I got this working with good results. Please see PR https://github.com/home-assistant/homebridge-homeassistant/pull/85

JohanLeirnes commented 7 years ago

Oh nice.. tried to install yours the crude way of just copy pasting your git onto my computer but im getting this error when trying to start my homebridge now

Error: Cannot find module 'request'

How would one go about installing your modified homebridge-homeassistant? :D Or should i just wait for the PR to be commited :D

tobre6 commented 7 years ago

I'm sure there is something else wrong, because I changed basically only light.js accessory file. Try to replace that.

JohanLeirnes commented 7 years ago

Ok will try

JohanLeirnes commented 7 years ago

Hmm well it seems it has issues with siri. When changing color manually it only sets them to a maximum of 255. But after issuing a change color command with siri it tries to change color beyond that spectrum resulting in nothing.

Log: Pre chatting to siri: [2016-12-30 23:06:07] [HomeAssistant] Successfully set power state on the 'Vardagsrumsbordlamp-RGB' to on [2016-12-30 23:06:07] [HomeAssistant] Successfully set brightness on the 'Vardagsrumsbordlamp-RGB' to 100 [2016-12-30 23:06:13] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:06:14] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 255,251,5 [2016-12-30 23:06:27] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:06:27] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 255,0,60 [2016-12-30 23:06:29] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:06:29] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 255,0,208 [2016-12-30 23:06:39] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:06:39] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 255,34,0 [2016-12-30 23:06:40] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:06:40] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 0,0,255 [2016-12-30 23:06:41] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:06:41] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 0,255,42

After chatting to siri and asking her to change to color to red (nothing happend and after that i cannot change color of the lamp:

[2016-12-30 23:08:35] [HomeAssistant] Setting power state on the 'Vardagsrumsbordlamp-RGB' to on [2016-12-30 23:08:35] [HomeAssistant] Setting brightness on the 'Vardagsrumsbordlamp-RGB' to 100 [2016-12-30 23:08:35] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 650,0,0 [2016-12-30 23:08:35] [HomeAssistant] Successfully set power state on the 'Vardagsrumsbordlamp-RGB' to on [2016-12-30 23:08:35] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:08:35] [HomeAssistant] Successfully set brightness on the 'Vardagsrumsbordlamp-RGB' to 100 [2016-12-30 23:08:56] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 509,650,0 [2016-12-30 23:08:56] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:10:50] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 650,314,0 [2016-12-30 23:10:50] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:10:51] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 650,0,22 [2016-12-30 23:10:51] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:10:51] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 641,104,650 [2016-12-30 23:10:51] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined [2016-12-30 23:10:53] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 520,650,0 [2016-12-30 23:10:53] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined

To get it working again i need to power cycle the lamp in home.

JohanLeirnes commented 7 years ago

Also the corresponding colors to the hue with some saturation is well not accurate :P

tobre6 commented 7 years ago

I confirmed siri issue. I will look into this. But colors corresponding to real life is tricky. It depends on the leds and hardware. :)

But at least it is a start. :)

JohanLeirnes commented 7 years ago

Another way of doing this would be to have a mqtt scetch that reports both RGB and HSV values of the lamp and using the HSV values here on the homebrige plugin and the rgb ones on HASS.

This scetch has all that but i am unable to compile it due to some iram issues.

https://github.com/ge0rg/WiFI-RGBWW-module

JohanLeirnes commented 7 years ago

But that would be only for mqtt and not for all RGB/RGBW/RGBWW lamps :D

JohanLeirnes commented 7 years ago

here is the debug when askin siri to change color to pink:

HAPServer [CC:22:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms Accessory [Homebridge] Processing characteristic set: [{"aid":32,"iid":8,"value":true},{"aid":32,"iid":9,"value":100},{"aid":32,"iid":15,"value":350},{"aid":32,"iid":16,"value":25}] +1ms Accessory [Homebridge] Setting Characteristic "On" to value true +0ms [2016-12-31 00:13:29] [HomeAssistant] Setting power state on the 'Vardagsrumsbordlamp-RGB' to on Accessory [Homebridge] Setting Characteristic "Brightness" to value 100 +2ms [2016-12-31 00:13:29] [HomeAssistant] Setting brightness on the 'Vardagsrumsbordlamp-RGB' to 100 Accessory [Homebridge] Setting Characteristic "Hue" to value 350 +2ms Accessory [Homebridge] Setting Characteristic "Saturation" to value 25 +1ms [2016-12-31 00:13:29] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to 650,488,515 EventedHTTPServer [::ffff:192.168.1.174] Muting event '32.16' notification for this connection since it originated here. +61ms [2016-12-31 00:13:29] [HomeAssistant] Successfully set power state on the 'Vardagsrumsbordlamp-RGB' to on [2016-12-31 00:13:29] [HomeAssistant] Successfully set rgb on the 'Vardagsrumsbordlamp-RGB' to undefined EventedHTTPServer [::ffff:192.168.1.174] Muting event '32.15' notification for this connection since it originated here. +20ms [2016-12-31 00:13:29] [HomeAssistant] Successfully set brightness on the 'Vardagsrumsbordlamp-RGB' to 100 EventedHTTPServer [::ffff:192.168.1.174] HTTP Response is finished +4ms

JohanLeirnes commented 7 years ago

The difference in chaning color manually and asking siri to do so is that siri sends 4 commands (on, brightness, hue and saturation) and when only changing colors only hue and saturation is sent.

tobre6 commented 7 years ago

I'm using this sketch on my hardware: https://github.com/tobre6/mqtt-h801

I will investigate siri issue.

tobre6 commented 7 years ago

I fixed siri issue.

cmsimike commented 7 years ago

Is closed by today's merging of !85?