ferbulous

smatrul bulb

Aug 21st, 2023
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. esphome:
  2. name: smatrul-bulb-corner
  3. friendly_name: smatrul-bulb-corner
  4.  
  5. bk72xx:
  6. board: generic-bk7231n-qfn32-tuya
  7. framework:
  8. version: dev
  9.  
  10. # Enable logging
  11. logger:
  12.  
  13. wifi:
  14. ssid: !secret wifi_ssid
  15. password: !secret wifi_password
  16.  
  17. # Enable fallback hotspot in case wifi connection fails
  18. ap:
  19. ssid: "Smatrul-Bulb-Corner"
  20. password: !secret ap_password
  21.  
  22. # Enable Home Assistant API
  23. api:
  24. password: ""
  25.  
  26. ota:
  27. password: ""
  28.  
  29. web_server:
  30. port: 80
  31.  
  32. external_components:
  33. - source: github://cossid/tasmotadevicegroupsforesphome@main
  34. components: [ device_groups ]
  35. refresh: 10 min
  36.  
  37. device_groups:
  38. - group_name: "corner1" # Tasmota device group name
  39. lights:
  40. - light_smatrul_corner
  41.  
  42. #watchdog related
  43. number:
  44. - platform: template
  45. id: rebootcounter
  46. name: Reboot Counter
  47. optimistic: True
  48. restore_value: True
  49. mode: box
  50. min_value: 0
  51. max_value: 120
  52. step: 1
  53. icon: mdi:restart-alert
  54. unit_of_measurement: Count
  55. globals:
  56. - id: counter
  57. type: int
  58. restore_value: False
  59. initial_value: "0"
  60.  
  61.  
  62. #watchdog related
  63. interval:
  64. - interval: 0.5min
  65. then:
  66. - if:
  67. condition:
  68. or:
  69. - wifi.connected:
  70. - lambda: return (id(disable).state != 0);
  71. then:
  72. - globals.set:
  73. id: counter
  74. value: "0"
  75. else:
  76. - lambda: id(counter) += 1;
  77. - if:
  78. condition:
  79. lambda: return (id(counter) >=2);
  80. then:
  81. - number.increment: rebootcounter
  82. - globals.set:
  83. id: counter
  84. value: "0"
  85. - switch.turn_on: restart_button
  86.  
  87. switch:
  88. - platform: restart
  89. id: restart_button
  90. name: "Smatrul Bulb Restart"
  91. restore_mode: ALWAYS_OFF
  92.  
  93. #disable button(watchdog)
  94. - platform: template
  95. name: $friendly_name Disable
  96. optimistic: True
  97. restore_mode: ALWAYS_OFF
  98. id: disable
  99. icon: mdi:stop-circle
  100.  
  101. # Output pins
  102. output:
  103. - platform: ledc
  104. id: red_color
  105. pin: D4 #PWM1=Pin08 of the IC
  106. frequency: 1220Hz
  107. inverted: False
  108. - platform: ledc
  109. id: green_color
  110. pin: D5 #PWM2=Pin09 of the IC
  111. inverted: False
  112. - platform: ledc
  113. id: blue_color
  114. pin: D17 #PWM3=Pin26 of the IC
  115. inverted: False
  116. - platform: ledc
  117. id: cold_white
  118. pin: D16 #PWM4=Pin24 of the IC
  119. inverted: False
  120. # max_power: 50%
  121. - platform: ledc
  122. id: warm_white
  123. pin: D2 #PWM5=Pin06 of the IC
  124. inverted: False
  125. # max_power: 50%
  126.  
  127. #light device
  128. light:
  129. - platform: rgbww
  130. name: "Smatrul Lights"
  131. id: "light_smatrul_corner"
  132. red: red_color
  133. green: green_color
  134. blue: blue_color
  135. cold_white: cold_white
  136. warm_white: warm_white
  137. cold_white_color_temperature: 6536 K
  138. warm_white_color_temperature: 2000 K
  139. color_interlock: true
  140. restore_mode: RESTORE_DEFAULT_ON
  141. default_transition_length: 0s
Advertisement
Add Comment
Please, Sign In to add comment