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.

107 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 GitHub.
  25. external_components:
  26. - source: github://mmakaay/esphome-xiaomi_bslamp2@dev
  27. refresh: 60s
  28. # Disable the reboot timeout. By default, the lamp reboots after 15
  29. # minutes without any client connections (e.g. when home assistant is off
  30. # line, or when the WiFi is broken). Reboots are annoying though, because
  31. # the RGBWW LEDs will turn off during the reboot, causing the light to
  32. # flicker.
  33. api:
  34. reboot_timeout: 0s
  35. # The log level can be raised when needed for debugging the firmware. For
  36. # production, a low log level is recommended. Mainly because high volume log
  37. # output might interfere with the API/WiFi connection stability. So when
  38. # raising the log level, beware that you might see dropped connections from
  39. # Home Assistant and the network log viewer.
  40. logger:
  41. level: DEBUG
  42. # ----------------------------------------------------------------------
  43. # Hardware setup
  44. # ----------------------------------------------------------------------
  45. i2c:
  46. id: front_panel_i2c
  47. sda: GPIO21
  48. scl: GPIO19
  49. scan: true
  50. output:
  51. - platform: ledc
  52. id: output_red
  53. pin: GPIO13
  54. frequency: 3000
  55. channel: 0
  56. - platform: ledc
  57. id: output_green
  58. pin: GPIO14
  59. frequency: 3000
  60. channel: 1
  61. - platform: ledc
  62. id: output_blue
  63. pin: GPIO5
  64. frequency: 3000
  65. channel: 2
  66. - platform: ledc
  67. id: output_white
  68. pin: GPIO12
  69. frequency: 10000
  70. channel: 4
  71. - platform: gpio
  72. id: output_master1
  73. pin: GPIO33
  74. - platform: gpio
  75. id: output_master2
  76. pin:
  77. number: GPIO4
  78. mode: OUTPUT
  79. # This float output can be used to control the front panel illumination +
  80. # level indicator LEDs. Value 0.0 turns off the illumination. Other values
  81. # (up to 1.0) turn on the illumination and set the level indicator to the
  82. # requested level.
  83. - platform: xiaomi_bslamp2
  84. id: my_front_panel_illumination
  85. xiaomi_bslamp2:
  86. light:
  87. red: output_red
  88. green: output_green
  89. blue: output_blue
  90. white: output_white
  91. master1: output_master1
  92. master2: output_master2
  93. front_panel:
  94. i2c: front_panel_i2c
  95. address: 0x2C
  96. trigger_pin: GPIO16