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.

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