You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
3.0 KiB

  1. substitutions:
  2. name: bedside_lamp
  3. friendly_name: Bedside Lamp
  4. transition_length: 1s
  5. # Use your own preferences for these components.
  6. wifi:
  7. #ssid: "Your-SSID"
  8. #password: "Your-Password"
  9. #use_address: 192.168.10.12
  10. #
  11. # Enable fallback hotspot (captive portal) in case wifi connection fails
  12. #ap:
  13. # ssid: "Bedside_lamp_$name"
  14. # password: "bedside2021"
  15. captive_portal:
  16. api:
  17. ota:
  18. logger:
  19. # Special platform + package are used for enabling unicore and disabling the
  20. # efuse mac crc check. These two changes are required for the ESP32-WROOM-32D
  21. # that is used in the Yeelight bedside lamp 2.
  22. esphome:
  23. name: $name
  24. platform: ESP32
  25. board: esp32doit-devkit-v1
  26. platformio_options:
  27. platform: espressif32@3.2.0
  28. platform_packages: |-4
  29. framework-arduinoespressif32 @ https://github.com/pauln/arduino-esp32.git#solo-no-mac-crc/1.0.6
  30. # NOTE: HIGHLY OPTIONAL BLOCK
  31. #
  32. # This yeelight_bs2 comopnent acts as the hub for the device. Other
  33. # components talk to the hardware via this component. Normally, you
  34. # wouldn't need to change anything in the default implementation. You
  35. # can even fully omit this element from the configuration.
  36. # Only define this when you need different pin numbers or want to
  37. # assign specific ID's to the pin components.
  38. yeelight_bs2:
  39. red_id: TheRedOne
  40. red: GPIO13
  41. green_id: TheGreenOne
  42. green: GPIO14
  43. blue_id: TheBlueOne
  44. blue: GPIO5
  45. white_id: TheWhiteOne
  46. white: GPIO12
  47. master1_id: TheFirstMaster
  48. master1: GPIO33
  49. master2_id: TheSecondMaster
  50. master2: GPIO4
  51. sda: GPIO21
  52. scl: GPIO19
  53. trigger_pin: GPIO16
  54. # This component controls the light of the device.
  55. light:
  56. - platform: yeelight_bs2
  57. name: ${friendly_name} RGBW Light
  58. default_transition_length: ${transition_length}
  59. # You can use any effects that you like. These are just examples.
  60. effects:
  61. - random:
  62. name: "Slow Random"
  63. transition_length: 30s
  64. update_interval: 30s
  65. - random:
  66. name: "Fast Random"
  67. transition_length: 3s
  68. update_interval: 3s
  69. binary_sensor:
  70. # When pressing the power button, turn on the light.
  71. - platform: yeelight_bs2
  72. id: ${name}_power_button
  73. part: power button
  74. on_press:
  75. then:
  76. - light.toggle: ${name}
  77. # When holding the color button, turn on night light mode.
  78. - platform: yeelight_bs2
  79. id: ${name}_color_button
  80. part: color button
  81. on_multi_click:
  82. - timing:
  83. - ON for at least 0.8s
  84. then:
  85. - light.turn_on:
  86. id: ${name}
  87. brightness: 0.01
  88. red: 0
  89. green: 1
  90. blue: 0
  91. sensor:
  92. # When the slider is touched, update the brightness.
  93. # Brightness 0.01 initiates the light night mode, which has already
  94. # been handle above. Therefore, brightness starts from 0.02 here,
  95. # so night mode is not triggered from the slider.
  96. - platform: yeelight_bs2
  97. id: ${name}_slider_level
  98. range_from: 0.02
  99. on_value:
  100. then:
  101. - light.turn_on:
  102. id: ${name}
  103. brightness: !lambda return x;