ff-asia-light-03.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. substitutions:
  2. devicename: ff-asia-light-03
  3. low_devicename: ff_asia_light_03
  4. friendly_devicename: FF Asia Light 03
  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. output:
  30. - platform: libretiny_pwm
  31. id: output_cold_white
  32. frequency: 500Hz
  33. pin: P24
  34. - platform: libretiny_pwm
  35. id: output_warm_white
  36. frequency: 500Hz
  37. pin: P26
  38. # Example configuration entry
  39. light:
  40. - platform: cwww
  41. name: ${friendly_devicename}
  42. id: the_light
  43. cold_white: output_cold_white
  44. warm_white: output_warm_white
  45. cold_white_color_temperature: 6500 K
  46. warm_white_color_temperature: 2700 K
  47. constant_brightness: true
  48. restore_mode: RESTORE_AND_ON
  49. effects:
  50. - random:
  51. name: "Slow Random"
  52. transition_length: 30s
  53. update_interval: 30s
  54. - random:
  55. name: "Fast Random"
  56. transition_length: 4s
  57. update_interval: 5s
  58. - strobe:
  59. - flicker:
  60. 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%.
  61. intensity: 50% #The intensity of the flickering, basically the maximum amplitude of the random offsets. Defaults to 1.5%.
  62. - lambda:
  63. name: Throb
  64. update_interval: 1s
  65. lambda: |-
  66. static int state = 0;
  67. auto call = id(the_light).turn_on();
  68. // Transtion of 1000ms = 1s
  69. call.set_transition_length(1000);
  70. if (state == 0) {
  71. call.set_brightness(1.0);
  72. } else {
  73. call.set_brightness(0.01);
  74. }
  75. call.perform();
  76. state += 1;
  77. if (state == 2)
  78. state = 0;
  79. ## Blink the light if we aren't connected to WiFi.
  80. ## Uncomment below
  81. #interval:
  82. #- interval: 500ms
  83. # then:
  84. # - if:
  85. # condition:
  86. # not:
  87. # wifi.connected:
  88. # then:
  89. # - light.turn_on:
  90. # id: the_light
  91. # brightness: 50%
  92. # transition_length: 0s
  93. # - delay: 250ms
  94. # - light.turn_off:
  95. # id: the_light
  96. # transition_length: 250ms