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.

109 lines
3.0 KiB

  1. # --------------------------------------------------------------------------
  2. # Substitutions as used by the configuration packages
  3. # These can be overriden from the main device configuration file.
  4. # --------------------------------------------------------------------------
  5. substitutions:
  6. name: bedside-lamp
  7. friendly_name: Bedside Lamp
  8. light_name: ${friendly_name} RGBWW Light
  9. light_mode_text_sensor_name: ${friendly_name} Light Mode
  10. default_transition_length: 800ms
  11. # --------------------------------------------------------------------------
  12. # Core setup
  13. # --------------------------------------------------------------------------
  14. esphome:
  15. name: ${name}
  16. esp32:
  17. board: esp32doit-devkit-v1
  18. framework:
  19. type: esp-idf
  20. sdkconfig_options:
  21. CONFIG_FREERTOS_UNICORE: y
  22. advanced:
  23. ignore_efuse_mac_crc: true
  24. # Retrieve the code for the xiaomi_bslamp2 platform from a local clone
  25. # of the github repository, in the same directory as the config file.
  26. external_components:
  27. - source:
  28. type: local
  29. path: ./esphome-xiaomi_bslamp2/
  30. # Disable the reboot timeout. By default, the lamp reboots after 15
  31. # minutes without any client connections (e.g. when home assistant is off
  32. # line, or when the WiFi is broken). Reboots are annoying though, because
  33. # the RGBWW LEDs will turn off during the reboot, causing the light to
  34. # flicker.
  35. api:
  36. reboot_timeout: 0s
  37. # The log level can be raised when needed for debugging the firmware. For
  38. # production, a low log level is recommended. Mainly because high volume log
  39. # output might interfere with the API/WiFi connection stability. So when
  40. # raising the log level, beware that you might see dropped connections from
  41. # Home Assistant and the network log viewer.
  42. logger:
  43. level: WARN
  44. # ----------------------------------------------------------------------
  45. # Hardware setup
  46. # ----------------------------------------------------------------------
  47. i2c:
  48. id: front_panel_i2c
  49. sda: GPIO21
  50. scl: GPIO19
  51. scan: true
  52. output:
  53. - platform: ledc
  54. id: output_red
  55. pin: GPIO13
  56. frequency: 3000
  57. channel: 0
  58. - platform: ledc
  59. id: output_green
  60. pin: GPIO14
  61. frequency: 3000
  62. channel: 1
  63. - platform: ledc
  64. id: output_blue
  65. pin: GPIO5
  66. frequency: 3000
  67. channel: 2
  68. - platform: ledc
  69. id: output_white
  70. pin: GPIO12
  71. frequency: 10000
  72. channel: 4
  73. - platform: gpio
  74. id: output_master1
  75. pin: GPIO33
  76. - platform: gpio
  77. id: output_master2
  78. pin:
  79. number: GPIO4
  80. mode: OUTPUT
  81. # This float output can be used to control the front panel illumination +
  82. # level indicator LEDs. Value 0.0 turns off the illumination. Other values
  83. # (up to 1.0) turn on the illumination and set the level indicator to the
  84. # requested level.
  85. - platform: xiaomi_bslamp2
  86. id: my_front_panel_illumination
  87. xiaomi_bslamp2:
  88. light:
  89. red: output_red
  90. green: output_green
  91. blue: output_blue
  92. white: output_white
  93. master1: output_master1
  94. master2: output_master2
  95. front_panel:
  96. i2c: front_panel_i2c
  97. address: 0x2C
  98. trigger_pin: GPIO16