Browse Source

Improved documentation.

pull/1/head
Maurice Makaay 3 years ago
parent
commit
c24fa132a0
2 changed files with 8 additions and 4 deletions
  1. +3
    -3
      README.md
  2. +5
    -1
      light.py

+ 3
- 3
README.md View File

@ -4,12 +4,12 @@
Create a folder named `custom_components` in the folder where your Create a folder named `custom_components` in the folder where your
device's yaml configuration file is stored. Then clone the the Github device's yaml configuration file is stored. Then clone the the Github
repo into that folder. For example on the command line:
repo into a subfolder `yeelight_bs2`. For example on the command line:
``` ```
# mkdir custom_components # mkdir custom_components
# cd custom_components # cd custom_components
# git clone https://github.com/mmakaay/esphome-yeelight_bs2
# git clone https://github.com/mmakaay/esphome-yeelight_bs2 yeelight_bs2
``` ```
Your folder structure should now look like: Your folder structure should now look like:
@ -17,7 +17,7 @@ Your folder structure should now look like:
config config
├── yourdevice.yaml ├── yourdevice.yaml
├── custom_components/ ├── custom_components/
│ ├── esphome-yeelight_bs2/
│ ├── yeelight_bs2/
│ . ├── README.md │ . ├── README.md
. . ├── yeelight_bs2_light_output.h . . ├── yeelight_bs2_light_output.h
. . . .


+ 5
- 1
light.py View File

@ -3,7 +3,6 @@ import esphome.config_validation as cv
from esphome.components import light, output, gpio from esphome.components import light, output, gpio
from esphome.const import CONF_RED, CONF_GREEN, CONF_BLUE, CONF_WHITE, CONF_OUTPUT_ID from esphome.const import CONF_RED, CONF_GREEN, CONF_BLUE, CONF_WHITE, CONF_OUTPUT_ID
CONF_MASTER1 = "master1" CONF_MASTER1 = "master1"
CONF_MASTER2 = "master2" CONF_MASTER2 = "master2"
@ -29,13 +28,18 @@ def to_code(config):
red = yield cg.get_variable(config[CONF_RED]) red = yield cg.get_variable(config[CONF_RED])
cg.add(var.set_red(red)) cg.add(var.set_red(red))
green = yield cg.get_variable(config[CONF_GREEN]) green = yield cg.get_variable(config[CONF_GREEN])
cg.add(var.set_green(green)) cg.add(var.set_green(green))
blue = yield cg.get_variable(config[CONF_BLUE]) blue = yield cg.get_variable(config[CONF_BLUE])
cg.add(var.set_blue(blue)) cg.add(var.set_blue(blue))
white = yield cg.get_variable(config[CONF_WHITE]) white = yield cg.get_variable(config[CONF_WHITE])
cg.add(var.set_white(white)) cg.add(var.set_white(white))
master1 = yield cg.get_variable(config[CONF_MASTER1]) master1 = yield cg.get_variable(config[CONF_MASTER1])
cg.add(var.set_master1(master1)) cg.add(var.set_master1(master1))
master2 = yield cg.get_variable(config[CONF_MASTER2]) master2 = yield cg.get_variable(config[CONF_MASTER2])
cg.add(var.set_master2(master2)) cg.add(var.set_master2(master2))

Loading…
Cancel
Save