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.

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