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.

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