From 784f0e5d034a0de60f722d52a0881ddf3d76c18b Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Fri, 5 Mar 2021 12:29:54 +0100 Subject: [PATCH] Added yaml files that are used to build the firmware. The example-device.yaml is what can be copied to the top-level ESPHome config directory as a device configuration template. --- example-device.yaml | 30 ++++++++++++++++++++++++++ yeelight_bs2.yaml | 51 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 example-device.yaml create mode 100644 yeelight_bs2.yaml diff --git a/example-device.yaml b/example-device.yaml new file mode 100644 index 0000000..2ebda53 --- /dev/null +++ b/example-device.yaml @@ -0,0 +1,30 @@ +# Some substitutions as used by the included yaml file. + +substitutions: + name: bedside_lamp_office + friendly_name: Bedside Lamp Office + transition_length: 1s + +# Configuration options to connect the device to the network. +# The api is used for allowing connections from Home Assistant. +# The ota is used for over the air updates after the first deployment. + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + ap: + ssid: ${friendly_name} + password: !secret wifi_ap_fallback_password + +captive_portal: + +api: + password: !secret api_password + +ota: + password: !secret ota_password + +# The rest of the configuration is included. + +<<: !include esphome-yeelight_bs2/yeelight_bs2.yaml diff --git a/yeelight_bs2.yaml b/yeelight_bs2.yaml new file mode 100644 index 0000000..56f39c9 --- /dev/null +++ b/yeelight_bs2.yaml @@ -0,0 +1,51 @@ +esphome: + name: $name + platform: ESP32 + board: esp32doit-devkit-v1 + platformio_options: + platform: espressif32@1.11.0 + platform_packages: |-4 + framework-arduinoespressif32 @ https://github.com/pauln/arduino-esp32.git#solo-no-mac-crc/1.0.4 + includes: + - esphome-yeelight_bs2/yeelight_bs2.h + +# Enable logging +logger: + +# The front panel of the device uses I2C for communication +# with the ESP32 main board. The panel uses ID 0x10. +i2c: + sda: 17 + scl: 18 + scan: True + +output: + - platform: gpio + id: master1 + pin: GPIO33 + - platform: gpio + id: master2 + pin: GPIO4 + - platform: ledc + id: led_r + pin: GPIO13 + - platform: ledc + id: led_g + pin: GPIO14 + - platform: ledc + id: led_b + pin: GPIO5 + - platform: ledc + id: led_w + pin: GPIO12 + +light: + - platform: custom + lambda: |- + auto bs2light = new esphome::rgbww::YeelightBedsideLampV2LightOutput( + led_r, led_g, led_b, led_w, master1, master2); + App.register_component(bs2light); + return {bs2light}; + lights: + - name: ${friendly_name} RGBW Light + default_transition_length: ${transition_length}