Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: smatrul-bulb-corner
- friendly_name: smatrul-bulb-corner
- bk72xx:
- board: generic-bk7231n-qfn32-tuya
- framework:
- version: dev
- # Enable logging
- logger:
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot in case wifi connection fails
- ap:
- ssid: "Smatrul-Bulb-Corner"
- password: !secret ap_password
- # Enable Home Assistant API
- api:
- password: ""
- ota:
- password: ""
- web_server:
- port: 80
- external_components:
- - source: github://cossid/tasmotadevicegroupsforesphome@main
- components: [ device_groups ]
- refresh: 10 min
- device_groups:
- - group_name: "corner1" # Tasmota device group name
- lights:
- - light_smatrul_corner
- #watchdog related
- number:
- - platform: template
- id: rebootcounter
- name: Reboot Counter
- optimistic: True
- restore_value: True
- mode: box
- min_value: 0
- max_value: 120
- step: 1
- icon: mdi:restart-alert
- unit_of_measurement: Count
- globals:
- - id: counter
- type: int
- restore_value: False
- initial_value: "0"
- #watchdog related
- interval:
- - interval: 0.5min
- then:
- - if:
- condition:
- or:
- - wifi.connected:
- - lambda: return (id(disable).state != 0);
- then:
- - globals.set:
- id: counter
- value: "0"
- else:
- - lambda: id(counter) += 1;
- - if:
- condition:
- lambda: return (id(counter) >=2);
- then:
- - number.increment: rebootcounter
- - globals.set:
- id: counter
- value: "0"
- - switch.turn_on: restart_button
- switch:
- - platform: restart
- id: restart_button
- name: "Smatrul Bulb Restart"
- restore_mode: ALWAYS_OFF
- #disable button(watchdog)
- - platform: template
- name: $friendly_name Disable
- optimistic: True
- restore_mode: ALWAYS_OFF
- id: disable
- icon: mdi:stop-circle
- # Output pins
- output:
- - platform: ledc
- id: red_color
- pin: D4 #PWM1=Pin08 of the IC
- frequency: 1220Hz
- inverted: False
- - platform: ledc
- id: green_color
- pin: D5 #PWM2=Pin09 of the IC
- inverted: False
- - platform: ledc
- id: blue_color
- pin: D17 #PWM3=Pin26 of the IC
- inverted: False
- - platform: ledc
- id: cold_white
- pin: D16 #PWM4=Pin24 of the IC
- inverted: False
- # max_power: 50%
- - platform: ledc
- id: warm_white
- pin: D2 #PWM5=Pin06 of the IC
- inverted: False
- # max_power: 50%
- #light device
- light:
- - platform: rgbww
- name: "Smatrul Lights"
- id: "light_smatrul_corner"
- red: red_color
- green: green_color
- blue: blue_color
- cold_white: cold_white
- warm_white: warm_white
- cold_white_color_temperature: 6536 K
- warm_white_color_temperature: 2000 K
- color_interlock: true
- restore_mode: RESTORE_DEFAULT_ON
- default_transition_length: 0s
Advertisement
Add Comment
Please, Sign In to add comment