gf-office-rgb-02.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. substitutions:
  2. devicename: gf-office-rgb-02
  3. low_devicename: gf_office_rgb_02
  4. friendly_devicename: GF Office RGB Light 02
  5. esphome:
  6. name: $devicename
  7. friendly_name: ${friendly_devicename}
  8. bk72xx:
  9. board: generic-bk7231t-qfn32-tuya
  10. # Enable logging
  11. logger:
  12. web_server:
  13. port: 80
  14. # Enable Home Assistant API
  15. api:
  16. encryption:
  17. key: "ejeMnlF5M60w/yuYwAWn/kIBz701xLwVkUGf9iN8uLA="
  18. ota:
  19. password: "2c27af3ab81f992e23745c20ab5dfc02"
  20. wifi:
  21. ssid: !secret iot_ssid
  22. password: !secret iot_password
  23. domain: .int.mmax.cloud
  24. text_sensor:
  25. # - platform: debug
  26. # reset_reason:
  27. # name: Reset Reason
  28. - platform: libretiny
  29. version:
  30. name: LibreTiny Version
  31. packages:
  32. diag: !include common/diag.yaml
  33. bp5758d:
  34. clock_pin: P24
  35. data_pin: P26
  36. #output:
  37. # - platform: bp5758d
  38. # id: output_red
  39. # channel: 3
  40. # current: 14
  41. # - platform: bp5758d
  42. # id: output_green
  43. # channel: 2
  44. # current: 14
  45. # - platform: bp5758d
  46. # id: output_blue
  47. # channel: 1
  48. # current: 14
  49. # - platform: bp5758d
  50. # id: output_cold
  51. # channel: 5
  52. # current: 29
  53. # - platform: bp5758d
  54. # id: output_warm
  55. # channel: 4
  56. # current: 29
  57. output:
  58. - platform: bp5758d
  59. id: output_red
  60. channel: 2
  61. current: 14
  62. - platform: bp5758d
  63. id: output_green
  64. channel: 1
  65. current: 14
  66. - platform: bp5758d
  67. id: output_blue
  68. channel: 3
  69. current: 14
  70. - platform: bp5758d
  71. id: output_cold_white
  72. channel: 5
  73. current: 29
  74. - platform: bp5758d
  75. id: output_warm_white
  76. channel: 4
  77. current: 29
  78. #light:
  79. # - platform: rgbww
  80. # id: light_rgbww
  81. # name: "light"
  82. # color_interlock: true
  83. # cold_white_color_temperature: 6500 K
  84. # warm_white_color_temperature: 2700 K
  85. # red: output_red
  86. # green: output_green
  87. # blue: output_blue
  88. # cold_white: output_cold
  89. # warm_white: output_warm
  90. # restore_mode: RESTORE_AND_ON
  91. # effects:
  92. # - random:
  93. # - strobe:
  94. # - flicker:
  95. # alpha: 50% #The percentage that the last color value should affect the light. More or less the “forget-factor” of an exponential moving average. Defaults to 95%.
  96. # intensity: 50%
  97. light:
  98. - platform: rgbww
  99. name: ${friendly_devicename}
  100. id: the_light
  101. restore_mode: RESTORE_DEFAULT_ON
  102. red: output_red
  103. green: output_green
  104. blue: output_blue
  105. cold_white: output_cold_white
  106. warm_white: output_warm_white
  107. cold_white_color_temperature: 6500 K
  108. warm_white_color_temperature: 2700 K
  109. color_interlock: true
  110. constant_brightness: true
  111. effects:
  112. - random:
  113. name: "Slow Random"
  114. transition_length: 30s
  115. update_interval: 30s
  116. - random:
  117. name: "Fast Random"
  118. transition_length: 4s
  119. update_interval: 5s
  120. - strobe:
  121. - flicker:
  122. alpha: 50% #The percentage that the last color value should affect the light. More or less the “forget-factor” of an exponential moving average. Defaults to 95%.
  123. intensity: 50% #The intensity of the flickering, basically the maximum amplitude of the random offsets. Defaults to 1.5%.
  124. - lambda:
  125. name: Throb
  126. update_interval: 1s
  127. lambda: |-
  128. static int state = 0;
  129. auto call = id(the_light).turn_on();
  130. // Transtion of 1000ms = 1s
  131. call.set_transition_length(1000);
  132. if (state == 0) {
  133. call.set_brightness(1.0);
  134. } else {
  135. call.set_brightness(0.01);
  136. }
  137. call.perform();
  138. state += 1;
  139. if (state == 2)
  140. state = 0;