kpsuperplane / homebridge-wiz-lan

Control Wiz lights over LAN
Apache License 2.0
114 stars 37 forks source link

Use Any WiZ Bulb Setting in HomeKit Automations!!!! #106

Open MoTechnicalities opened 2 years ago

MoTechnicalities commented 2 years ago

!!! WARNING !!! !!! THIS IS AWSOME!!!

Even without using the new "scene feature" of the plugin, you can use HomeKit SSH Script automations to set any exact RGBWC, SceneID, Dimming, and State value to a WiZ Bulb.

You only need: your Raspberry Pi's IP Address, your WiZ Bulb's Mac and IP Address, and the settings you want to apply!

This example sets a WiZ Bulb to its built-in Party scene: image

This means you can now have automations that control your WiZ lights in any way you want.

You can even add additional echo commands to the same script to set additional bulbs!!! To do so, just add a double && between the commands.

Experiment and have fun!🤩

MoTechnicalities commented 2 years ago

@kpsuperplane Can we have this info added to the instruction page(s)?

JiGSaW113 commented 2 years ago

Here is a list of all the possible scenes with their correspondent names from the WiZ app.

01 Ocean 02 Romance 03 Sunset 04 Party 05 Fireplace 06 Cozy 07 Forest 08 Pastel colors 09 Wake-up 10 Bedtime 11 Warm white 12 Daylight 13 Cool white 14 Night light 15 Focus 16 Relax 17 True colors 18 TV time 19 Plant growth 20 Spring 21 Summer 22 Fall 23 Deep dive 24 Jungle 25 Mojito 26 Club 27 Christmas 28 Halloween 29 Candlelight 30 Golden white 31 Pulse 32 Steampunk

MoTechnicalities commented 2 years ago

POSSIBLE VALUES

ON OR OFF SETTINGS “state”:true/false true for ON or false for OFF

LED SETTINGS - Note: the minimally acceptable setting requires at least one of the RGBW or C Light Emitting Diodes to be set to 1. You may not be able to get the bulb to emit light if you go from “state”:false to true with the minimum intensity setting of 1, I’ve discovered that for a minimal setting, 10 is required to properly energize an LED. additionally “dimming“: would need to be at 100, and might explain why the minimal “dimming”: value is 10. “r”:0 to 255 Red LED intensity “g”:0 to 255 Green LED intensity “b”:0 to 255 Blue LED intensity “w”:0 to 255 Worm White LED intensity “c”:0 to 255 Cool White LED intensity

LED USAGE FOR RGB MODE HomeKid allows either RGB mode OR Temperature mode, but not both at the same time. The WiZ bulb uses RGB LEDs, plus the W LED to add saturation. WiZ also abides by HUE rules, meaning that under normal WiZ App operation, only two of the RGB LEDs can be on simultaneously. Example: Purple without any saturation is "r":255,"g":0,"b":255,"w":0,"c":0, and the C LED is never used unless bulb is in the Tempuratur mode.

Saturation is interesting. Increasing saturation with Purple as an example of Hue, the bulb's RGBWC settings using the official WiZ App progressively look like this: "r":255,"g":0,"b":255,"w":0,"c":0 <_Purple Hue with Zero White saturation_.> "r":255,"g":0,"b":255,"w":140,"c":0 <Purple Hue with White saturation. (partial saturation)> "r":26,"g":0,"b":26,"w":140,"c":0 <White with the smallest touch of Purple Hue (Fully saturated).> So, first, the W LED increases and maxes out at 140, then the RGB LED drops from 255 down to 26 with the W LED remaining at 140.

The Send commands over SSH feature allows us to bypass and set all LEDs to whatever setting we desire!

LED USAGE FOR TEMPERATURE MODE When using Temperature mode, do not set the individual LEDs. The bulb's built-in software will automatically adjust the W & C LEDs when you specify the "temp": within the bulb's range.

HomeKit handles Color Temperature in Mirek (50 - 400). That means HomKit can handle a range of 2500K to 20000K! WiZ RGBWC Bulbs support temperature in Kelvin (2600K - 6500K). So, the Mirek range is 385 - 153, because 1000000/2600K = 385 Mirek.

DIMMING VALUES “dimming”:10 to 100 are normalized to HomeKit's 1 to 100 values. Note: some scene modes such as Nightlight do not allow a dimming value. So, a NaN Error will pass to Homebridge.

MoTechnicalities commented 2 years ago

If anyone has experimented with the Run scrips over SSH method and knows how to get this to post commands directly to the bulbs on the same network as the HomeKit Bridge without going through the Raspberry PI (Homebridge). Please post that info here. Thanks.

asyba commented 1 year ago

If anyone has experimented with the Run scrips over SSH method and knows how to get this to post commands directly to the bulbs on the same network as the HomeKit Bridge without going through the Raspberry PI (Homebridge). Please post that info here. Thanks.

found this, and checking the code is not using the Wiz API public url, maybe is using the bulb IP? https://github.com/sbidy/pywizlight

asyba commented 1 year ago

If anyone has experimented with the Run scrips over SSH method and knows how to get this to post commands directly to the bulbs on the same network as the HomeKit Bridge without going through the Raspberry PI (Homebridge). Please post that info here. Thanks.

found this, and checking the code is not using the Wiz API public url, maybe is using the bulb IP? https://github.com/sbidy/pywizlight

https://github.com/sbidy/pywizlight/issues/91

here it says that talks direclty to the IP of the bulb,

asyba commented 1 year ago

it appears is a UDP packages and not HTTP calls. maybe a Terminal with Shortcuts that can run UDP packages ?