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.

110 lines
3.0 KiB

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