mariusmotea / diyHue

Philips Hue emulator that is able to control multiple types of lights
Other
627 stars 107 forks source link

Entertainment Mode - Brightness Settings #309

Closed UniCizin closed 6 years ago

UniCizin commented 6 years ago

In Entertainment mode, the brightness setting (Hue Sync App f.e.) doenst work.

In dark scenes the lights (yeelight led strip) stays at full brightness.

mariusmotea commented 6 years ago

This is something wired, if you look at the debugging rgb data that i insert last time you see small values sent by hue sync? For example full red is 255,0,0 full green 0,255,0 . Do you see values like 2,0,0 for low red level, etc and the bulb is still at full brightness?

UniCizin commented 6 years ago

this is the debug output for switching from red to a black image

entertainment debug: r: 254, g: 0, b: 0 entertainment debug: computed rgb int: 16646144 entertainment debug: r: 254, g: 0, b: 0 entertainment debug: computed rgb int: 16646144 entertainment debug: r: 254, g: 0, b: 0 entertainment debug: computed rgb int: 16646144 entertainment debug: r: 254, g: 0, b: 0 entertainment debug: computed rgb int: 16646144 entertainment debug: r: 15, g: 4, b: 1 entertainment debug: computed rgb int: 984065 Sending M-Search response to 192.168.0.35 192.168.0.27 - - [04/Aug/2018 16:32:30] "GET /api/a7161538be80d40b3de98dece6e91f90/ HTTP/1.1" 200 - entertainment debug: r: 0, g: 0, b: 0 entertainment debug: computed rgb int: 0 entertainment debug: r: 0, g: 0, b: 0 entertainment debug: computed rgb int: 0 entertainment debug: r: 0, g: 0, b: 0 entertainment debug: computed rgb int: 0 entertainment debug: r: 0, g: 0, b: 0 entertainment debug: computed rgb int: 0

the bulb doenst change the color (stays on red in this case as i switched from red)

mariusmotea commented 6 years ago

Is possible that the issues are generated by bulb requests overload, than the color computing.

r: 254, g: 0, b: 0. = full red, so is ok r: 15, g: 4, b: 1 = this must be a low brightness orange, it is still full red? r: 0, g: 0, b: 0 = this must turn off the bulb. If this is not happening i need to put special off condition.

UniCizin commented 6 years ago

Wegen i picture a light Red, it is indeed a light Red Light .. but a dark Red ist Always R 255 f.e.

And the bulb never switches Off (or on on First start)

If it helps : the brigthness Slider in Hue Sync App has no function .

Edit: sorry for Typo -> german autocorrect

mariusmotea commented 6 years ago

ok, i made some tests and i confirm everything you said. The rgb mode despite contain the level of every color will not allow to setup the brightness. I will perform a new fix for this.

mariusmotea commented 6 years ago

I made new commit in develop branch for resolving this.

UniCizin commented 6 years ago

now i got a "light is not reachable" and an exception is happening

https://pastebin.com/WndEg8gu

EDIT: but when i restart the light and the emulator, i can adjust brightness with the slider in HueSync. Only the colors dont change anymore.

EDIT2: on a plain black screen, the lights are off, so this works at least.

mariusmotea commented 6 years ago

The POST request that generate the error has nothing to do with hue api. Searching on Google for /mistats/v2 i found something like:

Data are being sent to http://data.mistat.xiaomi.com/mistats/v2 (yep, no HTTPS again) with all metadata readable (device ID, device type, app ID) but most of the data is being encrypted: http://screencast.com/t/mYNAtpz

so is Xiaomi device request.

UniCizin commented 6 years ago

i rebooted everything and now it runs without exception. When i play a game with hue sync app running, the light gets dark and bright.. but no color changes anymore .

the MiStat could be an error because i tested the Phillips Hue App on my Xioami Mi

mariusmotea commented 6 years ago

Ok, let me check what can be the problem with the colors.

mariusmotea commented 6 years ago

I made new change in develop branch. Please note that i push all my local changes not only the hue entertainment part, but i don't expect to have any problems (most of them are improvements). Regarding the entertainment changes i made live test with Yeelight color bulb. I saw that 100ms is not a smooth transition and i increase this to 300ms. The method to send one time the brightness and another time the color generate in some cases almost 2 second of latency between the screen and the light so i change this to store the previews brightness and if this don't change with more than 50 (range is 1 - 255) i will not update it. For me watching some youtube clips show to be a good approach, the brightness request was send after every 5-7 color requests.

UniCizin commented 6 years ago

okay, now the colors AND the brightness are working.. but i noticed: when you switch from blue to black -> lights go out.. and then from black to red -> light gets blue for a sec and then switches to red

i guess this is a question of the update sequence?

mariusmotea commented 6 years ago

Check what color is send by hue sync, the issue may be related to the position of the lights you set in entertainment room. I can fix only if hue sync send one color and the bulb is displaying different color.

UniCizin commented 6 years ago

okay, after making a clean install (and having problems with generating a new certificate and so on...) i tried your newest dev build and during a game .. it just looks great :)

The brightness gets set as it should, even if the color needs some finetuning i guess (but this depends on the bulb)

you can close this issue.