Skip to content

Commit f50ce62

Browse files
authored
Merge pull request webdjoe#138 from sdrapha/multicolor-bulb
Add support to Valceno Multicolor bulb
2 parents c493a07 + c6de414 commit f50ce62

19 files changed

+797
-211
lines changed

README.md

Lines changed: 141 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pyvesync is a library to manage VeSync compatible [smart home devices](#supporte
1010
- [Wall Switches](#wall-switches)
1111
- [Levoit Air Purifiers](#levoit-air-purifiers)
1212
- [Etekcity Bulbs](#etekcity-bulbs)
13+
- [Valceno Bulbs](#valceno-bulbs)
1314
- [Levoit Humidifiers](#levoit-humidifiers)
1415
- [Usage](#usage)
1516
- [Configuration](#configuration)
@@ -30,9 +31,11 @@ pyvesync is a library to manage VeSync compatible [smart home devices](#supporte
3031
- [Air Purifier Methods](#air-purifier-methods)
3132
- [Levoit Purifier Core200S/300S/400S Properties](#levoit-purifier-core200s300s400s-properties)
3233
- [Levoit Purifier Core200S/300S/400S Methods](#levoit-purifier-core200s300s400s-methods)
33-
- [Dimmable Smart Light Bulb Method and Properties](#dimmable-smart-light-bulb-method-and-properties)
34-
- [Tunable Smart Light Bulb Methods and Properties](#tunable-smart-light-bulb-methods-and-properties)
35-
- [Dimmable Switch Methods and Properties](#dimmable-switch-methods-and-properties)
34+
- [Lights API Methods & Properties](#lights-api-methods-properties)
35+
- [Dimmable Light Bulb Method and Properties](#dimmable-light-bulb-method-and-properties)
36+
- [Tunable Light Bulb Methods and Properties](#tunable-light-bulb-methods-and-properties)
37+
- [Multicolor light bulb Methods and Properties](#multicolor-light-bulb-methods-and-properties)
38+
- [Dimmable Switch Methods and Properties](#dimmable-switch-methods-and-properties)
3639
- [Levoit Humidifier Methods and Properties](#levoit-humidifier-methods-and-properties)
3740
- [Humidifier Properties](#humidifier-properties)
3841
- [Humidifer Methods](#humidifer-methods)
@@ -41,7 +44,9 @@ pyvesync is a library to manage VeSync compatible [smart home devices](#supporte
4144
- [JSON Output for All Devices](#json-output-for-all-devices)
4245
- [JSON Output for Outlets](#json-output-for-outlets)
4346
- [JSON Output for Dimmable Switch](#json-output-for-dimmable-switch)
44-
- [JSON Output for Bulbs](#json-output-for-bulbs)
47+
- [JSON Output for Dimmable Bulb](#json-output-for-dimmable-bulb)
48+
- [JSON Output for Tunable Bulb](#json-output-for-tunable-bulb)
49+
- [JSON Output for Multicolor Bulb](#json-output-for-multicolor-bulb)
4550
- [JSON Output for Air Purifier](#json-output-for-air-purifier)
4651
- [JSON Output for 300S Humidifier](#json-output-for-300s-humidifier)
4752
- [JSON Output for Core200S Purifier](#json-output-for-core200s-purifier)
@@ -89,6 +94,9 @@ pip install pyvesync
8994
1. Soft White Dimmable Smart Bulb (ESL100)
9095
2. Cool to Soft White Tunable Dimmable Bulb (ESL100CW)
9196

97+
### Valceno Bulbs
98+
1. Multicolor Bulb (XYD0001)
99+
92100
### Levoit Humidifiers
93101
1. Dual 200S
94102
2. Classic 300S
@@ -116,6 +124,12 @@ my_switch.turn_off()
116124

117125
# Get energy usage data for outlets
118126
manager.update_energy()
127+
128+
# Set bulb brightness to 75% of first bulb in the list
129+
my_bulb = manager.bulbs[0]
130+
my_bulb.set_brightness(75)
131+
# get its details in JSON and print
132+
print(my_bulb.displayJSON())
119133
```
120134
Devices are stored in the respective lists in the instantiated `VeSync` class:
121135

@@ -126,7 +140,7 @@ manager.update()
126140
manager.outlets = [VeSyncOutletObjects]
127141
manager.switches = [VeSyncSwitchObjects]
128142
manager.fans = [VeSyncFanObjects]
129-
manger.bulbs = [VeSyncBulbObjects]
143+
manager.bulbs = [VeSyncBulbObjects]
130144

131145
# Get device (outlet, etc.) by device name
132146
dev_name = "My Device"
@@ -312,21 +326,79 @@ Compatible levels for each model:
312326
`VeSyncFan.set_night_light('on'|'dim'|'off')` - Set night light brightness
313327

314328

315-
### Dimmable Smart Light Bulb Method and Properties
329+
### Lights API Methods & Properties
330+
331+
#### Dimmable Light Bulb Method and Properties
316332

317333
`VeSyncBulb.brightness` - Return brightness in percentage (1 - 100)
318334

319335
`VeSyncBulb.set_brightness(brightness)` - Set bulb brightness values from 1 - 100
320336

321-
### Tunable Smart Light Bulb Methods and Properties
337+
#### Tunable Light Bulb Methods and Properties
338+
339+
`VeSyncBulb.brightness` - Return brightness in percentage (1 - 100)
340+
341+
`VeSyncBulb.set_brightness(brightness)` - Set bulb brightness values from 1 - 100
322342

323343
`VeSyncBulb.color_temp_pct` - Return color temperature in percentage (0 - 100)
324344

325345
`VeSyncBulb.color_temp_kelvin` - Return brightness in Kelvin
326346

327-
`VeSyncBulb.set_color_temp(color_temp)` - Set color temperature in percentage (0 - 100)
347+
`VeSyncBulb.set_color_temp(color_temp)` - Set white temperature in percentage (0 - 100)
348+
349+
#### Multicolor Light Bulb Methods and Properties
350+
351+
**Properties**
352+
353+
`VeSyncBulb.brightness` - Return brightness in percentage (int values from 1 - 100)
354+
355+
`VeSyncBulb.color_temp_pct` - Return white temperature in percentage (int values from 0 - 100)
356+
357+
`VeSyncBulb.color_temp_kelvin` - Return white temperature in Kelvin (int values from 2700-6500)
358+
359+
`VeSyncBulb.color_value_hsv` - Return color value in HSV format (float 0.0-360.0, float 0.0-100.0, int 0-100 )
360+
361+
`VeSyncBulb.color_value_rgb` - Return color value in RGB format (float values up to 255.0, 255.0, 255.0 )
362+
363+
`VeSyncBulb.color_mode` - Return bulb color mode (string values: 'white' , 'hsv' )
364+
365+
`VeSyncBulb.color_hue` - Return color hue (float values from 0.0 - 360.0)
366+
367+
`VeSyncBulb.color_saturation` - Return color saturation (float values from 0.0 - 100.0)
368+
369+
`VeSyncBulb.color_value` - Return color value (int values from 0 - 100)
370+
371+
**Methods**
372+
373+
`VeSyncBulb.set_brightness(brightness)`
374+
- Set bulb brightness (int values from 0 - 100)
375+
- (also used to set Color Value when in color mode)
328376

329-
### Dimmable Switch Methods and Properties
377+
`VeSyncBulb.set_color_mode(color_mode)`
378+
- Set bulb color mode (string values: `white` , `hsv` )
379+
- `color` may be used as an alias to `hsv`
380+
381+
`VeSyncBulb.set_color_temp(color_temp)`
382+
- Set bulb white temperature (int values from 0 - 100)
383+
- Setting this will automatically force the bulb into White mode
384+
385+
`VeSyncBulb.set_color_hue(color_hue)`
386+
- Set color hue (float values from 0.0 - 360.0)
387+
- Setting this will automatically force the bulb into Colored mode
388+
389+
`VeSyncBulb.set_color_saturation(color_saturation)`
390+
- Set color saturation (float values from 0.0 - 100.0)
391+
- Setting this will automatically force the bulb into Colored mode
392+
393+
`VeSyncBulb.set_color_value(color_value)`
394+
- Set color value (float values from 0.0 - 100.0)
395+
- Setting this will automatically force the bulb into Colored mode
396+
397+
`VeSyncBulb.set_status(brightness, color_temp, color_saturation, color_hue, color_mode color_value)`
398+
- Set every property, in a single call
399+
- All parameters are optional
400+
401+
#### Dimmable Switch Methods and Properties
330402

331403
`VeSyncSwitch.brightness` - Return brightness of switch in percentage (1 - 100)
332404

@@ -437,27 +509,27 @@ device.displayJSON()
437509
#Returns:
438510

439511
{
440-
'Device Name': 'Device 1',
441-
'Model': 'Device Model',
442-
'Subdevice No': '1',
443-
'Status': 'on',
444-
'Online': 'online',
445-
'Type': 'Device Type',
446-
'CID': 'DEVICE-CID'
512+
"Device Name": "Device 1",
513+
"Model": "Device Model",
514+
"Subdevice No": "1",
515+
"Status": "on",
516+
"Online": "online",
517+
"Type": "Device Type",
518+
"CID": "DEVICE-CID"
447519
}
448520
```
449521

450522
#### JSON Output for Outlets
451523

452524
```python
453525
{
454-
'Active Time': '1', # in minutes
455-
'Energy': '2.4', # today's energy in kWh
456-
'Power': '12', # current power in W
457-
'Voltage': '120', # current voltage
458-
'Energy Week': '12', # totaly energy of week in kWh
459-
'Energy Month': '50', # total energy of month in kWh
460-
'Energy Year': '89', # total energy of year in kWh
526+
"Active Time": "1", # in minutes
527+
"Energy": "2.4", # today's energy in kWh
528+
"Power": "12", # current power in W
529+
"Voltage": "120", # current voltage
530+
"Energy Week": "12", # totaly energy of week in kWh
531+
"Energy Month": "50", # total energy of month in kWh
532+
"Energy Year": "89", # total energy of year in kWh
461533
}
462534
```
463535

@@ -467,23 +539,47 @@ This output only applies to dimmable switch. The standard switch has the defaul
467539

468540
```python
469541
{
470-
'Indicator Light': 'on', # status of indicator light
471-
'Brightness': '50', # percent brightness
472-
'RGB Light': 'on' # status of RGB Light on faceplate
542+
"Indicator Light": "on", # status of indicator light
543+
"Brightness": "50", # percent brightness
544+
"RGB Light": "on" # status of RGB Light on faceplate
473545
}
474546
```
475547

476-
#### JSON Output for Bulbs
548+
#### JSON Output for Dimmable Bulb
477549

478550
```python
479551
# output for dimmable bulb
480552
{
481-
'Brightness': '50' # brightness in percent
553+
# all default outputs plus...
554+
"Brightness": "50" # brightness in percent
482555
}
556+
```
557+
558+
#### JSON Output for Tunable Bulb
483559

560+
```python
484561
# output for tunable bulb
485562
{
486-
'Kelvin': '5400' # color temperature in Kelvin
563+
# all default outputs plus...
564+
"Brightness": "50" # brightness in percent
565+
"Kelvin": "5400" # white temperature in Kelvin
566+
}
567+
568+
569+
```
570+
571+
#### JSON Output for Multicolor Bulb
572+
573+
```python
574+
# output for valceno multicolor bulb
575+
{
576+
# all default outputs plus...
577+
"Brightness": "100", # brightness in percent (also used for color value in hsv mode)
578+
"WhiteTemperaturePct": "0", # white temperature in percent
579+
"WhiteTemperatureKelvin": "2700", # white temperature in Kelvin
580+
"ColorHSV": "hsv(hue=79.99, saturation=90.0, value=100)", # color definition in HSV model
581+
"ColorRGB": "rgb(red=178.5, green=255.0, blue=25.5)", # color definition in RGB model
582+
"ColorMode": "hsv" # color mode ( white / hsv )
487583
}
488584

489585
```
@@ -492,28 +588,28 @@ This output only applies to dimmable switch. The standard switch has the defaul
492588

493589
```python
494590
{
495-
'Active Time': '50', # minutes
496-
'Fan Level': '2', # fan level 1-3
497-
'Air Quality': '95', # air quality in percent
498-
'Mode': 'auto',
499-
'Screen Status': 'on',
500-
'Filter Life': '99' # remaining filter life in percent
591+
"Active Time": "50", # minutes
592+
"Fan Level": "2", # fan level 1-3
593+
"Air Quality": "95", # air quality in percent
594+
"Mode": "auto",
595+
"Screen Status": "on",
596+
"Filter Life": "99" # remaining filter life in percent
501597
}
502598
```
503599
#### JSON Output for 300S Humidifier
504600

505601
```python
506602
{
507-
'Mode': 'manual', # auto, manual, sleep
508-
'Humidity': 20, # percent
509-
'Mist Virtual Level': 6, # Mist level 1 - 9
510-
'Water Lacks': True, # True/False
511-
'Water Tank Lifted': True, # True/False
512-
'Display': True, # True/False
513-
'Automatic Stop Reach Target': True,
514-
'Night Light Brightness': 10, # 1 - 100
515-
'Auto Target Humidity': True, # True/False
516-
'Automatic Stop': True # True/False
603+
"Mode": "manual", # auto, manual, sleep
604+
"Humidity": 20, # percent
605+
"Mist Virtual Level": 6, # Mist level 1 - 9
606+
"Water Lacks": true, # True/False
607+
"Water Tank Lifted": true, # True/False
608+
"Display": true, # True/False
609+
"Automatic Stop Reach Target": true,
610+
"Night Light Brightness": 10, # 1 - 100
611+
"Auto Target Humidity": true, # True/False
612+
"Automatic Stop": true # True/False
517613
}
518614
```
519615

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='pyvesync',
13-
version='2.0.3',
13+
version='2.0.4',
1414
description='pyvesync is a library to manage Etekcity\
1515
Devices and Levoit Air Purifier',
1616
long_description=long_description,

0 commit comments

Comments
 (0)