Utiliser une ampoule Philips 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>}}'


Turn smart bulb off
pgd@rpi01:~ $ echo '{"id":1,"method":"setState","params": {"state":false}}'


Get parameters for Philips Wiz light
pgd@rpi01:~ $ echo '{"method":"getPilot","params": {}}'


API Wiz

ParameterDescriptionTypeExample
timestampEvent timestamp, UNIX timeLong1580366320
macMAC address of the deviceString"a8bb50343f9a"
connectedConnection status of the device: true if connected, false if notBooleantrue
rssiWiFi signal strength, in negative dBm (for debugging purpose)Int-71
stateStatus of the Device : true if ON, false if OFFBooleantrue
sceneIdID of the light mode being playedInt12
speedTransition speed in %Int100
rRed component valueInt25
gGreen component valueInt25
bBlue component valueInt25
cCool white component valueInt25
wWarm white component valueInt25
colorTemperatureColor temperature value, KInt4200
dimmingBrightness value, 0-100Int90
consumptionRateInHourHow much does the device consume in 1h, W/hFloat9.6
onSinceUNIX timestamp when the device was turned ON, 0 if it’s OFF nowLong1580366320
offSinceUNIX timestamp when the device was turned OFF, 0 if it’s ON nowLong1580256641

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 :
    IDNameRGBTWTWDWAdjustable speedAdjustable dimming
    1Ocean
    2Romance
    3Sunset
    4Party
    5Fireplace
    6Cozy
    7Forest
    8Pastel Colors
    9Wake up
    10Bedtime
    11Warm white
    12Daylight
    13Cool white
    14Night light
    15Focus
    16Relax
    17True colors
    18TV Time
    19Plant growth
    20Spring
    21Summer
    22Fall
    23Deep dive
    24Jungle
    25Mojito
    26Club
    27Christmas
    28Halloween
    29Candlelight
    30Golden white
    31Pulse
    32Steampunk
    33Diwali


    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