Utiliser une ampoule ou une prise connectée Wiz (API ou wizcon)
Pilotage de l'ampoule avec l'API Wiz
Exemples d'utilisation avec API Wiz
Turn smart bulb on and set brightness
pgd@rpi01:~ $ echo '{"id":1,"method":"setState","params": {"state":true, "dimming":<brightness 10-100>}}' | nc -u -w 1 <ip address> 38899
Turn smart bulb off
pgd@rpi01:~ $ echo '{"id":1,"method":"setState","params": {"state":false}}' | nc -u -w 1 <ip address> 38899
Turn smart bulb on and set scene
pgd@rpi01:~ $ echo '{"id":1,"method":"setState","params": {"state":true, "dimming":<brightness 10-100>, "sceneId":<id>, "speed":<20-200>}}' | nc -u -w 1 <ip address> 38899
Get parameters for Wiz light
pgd@rpi01:~ $ echo '{"method":"getPilot","params": {}}' | nc -u -w 1 <ip address> 38899
API Wiz
Parameter | Description | Type | Example |
timestamp | Event timestamp, UNIX time | Long | 1580366320 |
mac | MAC address of the device | String | "a8bb50343f9a" |
connected | Connection status of the device: true if connected, false if not | Boolean | true |
rssi | WiFi signal strength, in negative dBm (for debugging purpose) | Int | -71 |
state | Status of the Device : true if ON, false if OFF | Boolean | true |
sceneId | ID of the light mode being played | Int | 12 |
speed | Transition speed in % | Int | 100 |
r | Red component value | Int | 25 |
g | Green component value | Int | 25 |
b | Blue component value | Int | 25 |
c | Cool white component value | Int | 25 |
w | Warm white component value | Int | 25 |
colorTemperature | Color temperature value, K | Int | 4200 |
dimming | Brightness value, 0-100 | Int | 90 |
consumptionRateInHour | How much does the device consume in 1h, W/h | Float | 9.6 |
onSince | UNIX timestamp when the device was turned ON, 0 if it’s OFF now | Long | 1580366320 |
offSince | UNIX timestamp when the device was turned OFF, 0 if it’s ON now | Long | 1580256641 |
Light state input
r - type Int, Red track value. Valid range: 0-255
g - type Int, Green track value. Valid range: 0-255
b - type Int, Blue track value. Valid range: 0-255
cw - type Int, Cool White track value. Valid range: 0-255
ww - type Int, Warm White track value. Valid range: 0-255
dimming - type Int, Brightness value. Valid range: 10-100
sceneId - type Int, one of predefined light modes. Valid range: 1-32. Full list
speed - type Int, Speed of dynamic light modes (Ocean, Romance, Forest, etc). Valid range: 20-200
ratio - type Int, Ratio for dual-zone devices. Valid range: 0-100
state - type Boolean, State of the device. true - the device is turned on, false - the device is turned off
temperature - type Int, CCT value, measured in Kelvins. Valid range depends on the product, common range is 2700-6500K
Light modes
Les ampoules WiZ ont des capacités différentes selon la configuration matérielle, mais généralement elles peuvent être divisés en plusieurs groupes distincts :
RGBTW : elles ont des LED rouges, vertes, bleues, blanc froid et blanc chaud. Ce type d'ampoules peut prendre en charge tous les modes d'éclairage fournis par le système WiZ
TW : elles ont des LED blanc froid et blanc chaud. Ces appareils prennent en charge la plupart des modes d'éclairage statique + contrôle CCT
DW : elles n'ont que des LED blanches à intensité variable. Ces appareils ne prennent en charge que les modes de gradation, de réveil, d'heure du coucher et de nuit.
Résumé des modes d'éclairage que vous pouvez trouver dans le tableau suivant :
ID | Name | RGBTW | TW | DW | Adjustable speed | Adjustable dimming |
1 | Ocean | ✓ | | | ✓ | ✓ |
2 | Romance | ✓ | | | ✓ | ✓ |
3 | Sunset | ✓ | | | ✓ | ✓ |
4 | Party | ✓ | | | ✓ | ✓ |
5 | Fireplace | ✓ | | | ✓ | ✓ |
6 | Cozy | ✓ | ✓ | | ✓ | ✓ |
7 | Forest | ✓ | | | ✓ | ✓ |
8 | Pastel Colors | ✓ | | | ✓ | ✓ |
9 | 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 | ✓ | ✓ | ✓ | ✓ | ✓ |
33 | Diwali | ✓ | ✓ | ✓ | ✓ | ✓ |
Pilotage de l'ampoule avec wizcon
Pré-requis
Python
Installation de wizcon
pgd@rpi01:~ $ pip install wizcon
Utilisation de wizcon
pgd@rpi01:~ $ wizcon [-h] [-si {1-32}] [-b {0-255}] [-rgb {0-255} {0-255} {0-255}] [-v] IP {ON,OFF,SWITCH}
Exemples d'utilisation avec wizcon
Turn smart bulb on
pgd@rpi01:~ $ wizcon <ip address> ON
Turn smart bulb off
pgd@rpi01:~ $ wizcon <ip address> OFF
Switch smart bulb between on and off states
pgd@rpi01:~ $ wizcon <ip address> SWITCH
Set scene to "Deepdive" using scene ID
pgd@rpi01:~ $ wizcon --scene_id <scene ID> <ip address> ON
Set brightness to 255 (max brightness)
pgd@rpi01:~ $ wizcon --brightness 255 <ip address> ON
Set smart bulb color to blue
pgd@rpi01:~ $ wizcon -rgb 0 0 255 <ip address> ON