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.

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