gf-office-rgb-02.yaml 3.5 KB

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