差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
developmentboard:esphome_smart_light_bulb [2024/11/30 02:08] – admin | developmentboard:esphome_smart_light_bulb [2024/12/18 14:41] (当前版本) – admin | ||
---|---|---|---|
行 1: | 行 1: | ||
ESPHome Smart Light Bulb | ESPHome Smart Light Bulb | ||
- | Introduction | + | Introduction |
- | -- Detected by Home Assistant | + | |
- | -- Controlled by MQTT, Web UI, HTTP, etc | + | – Controlled by MQTT, Web UI, HTTP, etc |
- | -- Using times, scripts, rules | + | – Using times, scripts, rules |
- | -- Open source | + | – Open source |
- | -- Use ESP8285-2M as MCU | + | – Use ESP8285-2M as MCU |
- | Specification | + | Specification |
- | -- RGB+C+W, 9W | + | |
- | -- 850LM | + | – 850LM |
- | -- AC: | + | – AC: |
- | -- 2700-6500K | + | – 2700-6500K |
- | -- E26/E27 | + | – E26/E27 |
- | + | ||
- | -- 60 x 60 x 125 mm | + | |
- | + | ||
- | -- 40000 hours | + | |
+ | – 60 x 60 x 125 mm | ||
+ | – 40000 hours | ||
**GPIOs** | **GPIOs** | ||
- | GPIO4 -- PWM1 | + | GPIO4 – PWM1 – Cool WhiteGPIO5 |
- | GPIO13 | + | |
**Yaml File:** | **Yaml File:** | ||
- | ssubstitutions: | + | substitutions: |
name: " | name: " | ||
+ | |||
friendly_name: | friendly_name: | ||
+ | |||
project_name: | project_name: | ||
+ | |||
project_version: | project_version: | ||
+ | |||
light_restore_mode: | light_restore_mode: | ||
+ | |||
color_interlock: | color_interlock: | ||
esphome: | esphome: | ||
+ | |||
name: " | name: " | ||
+ | |||
name_add_mac_suffix: | name_add_mac_suffix: | ||
+ | |||
project: | project: | ||
+ | |||
name: " | name: " | ||
+ | |||
version: " | version: " | ||
preferences: | preferences: | ||
+ | |||
flash_write_interval: | flash_write_interval: | ||
esp8266: | esp8266: | ||
+ | |||
board: esp8285 | board: esp8285 | ||
+ | |||
restore_from_flash: | restore_from_flash: | ||
globals: | globals: | ||
+ | |||
- id: my_global_mode | - id: my_global_mode | ||
+ | |||
type: bool | type: bool | ||
+ | |||
restore_value: | restore_value: | ||
+ | |||
initial_value: | initial_value: | ||
行 70: | 行 82: | ||
ota: | ota: | ||
+ | |||
safe_mode: false | safe_mode: false | ||
wifi: | wifi: | ||
+ | |||
ap: {} | ap: {} | ||
interval: | interval: | ||
+ | |||
- interval: 1s | - interval: 1s | ||
+ | |||
then: | then: | ||
+ | |||
- lambda: |- | - lambda: |- | ||
+ | |||
static uint32_t cnt = 0; | static uint32_t cnt = 0; | ||
+ | |||
static int flag = 0; | static int flag = 0; | ||
- | static ESPPreferenceObject pref = global_preferences->make_preference< | + | |
- | if((flag == 1) && (network:: | + | static ESPPreferenceObject pref = global_preferences→make_preference(23332500UL, |
+ | |||
+ | if((flag == 1) && (network:: | ||
{ | { | ||
+ | |||
flag = 0; | flag = 0; | ||
+ | |||
ESP.restart(); | ESP.restart(); | ||
+ | |||
} | } | ||
+ | |||
if(cnt == 0){ | if(cnt == 0){ | ||
+ | |||
cnt++; | cnt++; | ||
+ | |||
uint32_t val = 0; | uint32_t val = 0; | ||
+ | |||
pref.load(& | pref.load(& | ||
+ | |||
val+=1; | val+=1; | ||
+ | |||
pref.save(& | pref.save(& | ||
- | global_preferences->sync(); | + | |
+ | global_preferences→sync(); | ||
if(val >= 3){ | if(val >= 3){ | ||
- | my_global_mode->value() = false; | + | |
+ | my_global_mode→value() = false; | ||
} | } | ||
+ | |||
}else if(cnt < 5){ | }else if(cnt < 5){ | ||
+ | |||
cnt++; | cnt++; | ||
+ | |||
if(cnt == 5){ | if(cnt == 5){ | ||
+ | |||
uint32_t val = 0; | uint32_t val = 0; | ||
+ | |||
pref.save(& | pref.save(& | ||
- | global_preferences->sync(); | + | |
+ | global_preferences→sync(); | ||
} | } | ||
+ | |||
} | } | ||
- | if(!my_global_mode->value()){ | + | |
+ | if(!my_global_mode→value()){ | ||
if(cnt == 1){ | if(cnt == 1){ | ||
+ | |||
char a[] = " | char a[] = " | ||
+ | |||
char b[] = " | char b[] = " | ||
- | wifi_wificomponent->clear_sta(); | + | |
- | wifi_wificomponent->save_wifi_sta(a, | + | wifi_wificomponent→clear_sta(); |
+ | |||
+ | wifi_wificomponent→save_wifi_sta(a, | ||
wifi:: | wifi:: | ||
- | wifi_wificomponent->set_ap(wifi_wifiap); | + | |
- | wifi_wificomponent->set_ap_timeout(5000); | + | wifi_wificomponent→set_ap(wifi_wifiap); |
+ | |||
+ | wifi_wificomponent→set_ap_timeout(5000); | ||
flag = 1; | flag = 1; | ||
- | rgbww_rgbwwlightoutput->set_color_interlock(false); | + | |
+ | rgbww_rgbwwlightoutput→set_color_interlock(false); | ||
} | } | ||
+ | |||
static int state = 0; | static int state = 0; | ||
+ | |||
auto call = id(my_light).turn_on(); | auto call = id(my_light).turn_on(); | ||
+ | |||
call.set_transition_length(1000); | call.set_transition_length(1000); | ||
+ | |||
call.set_brightness(1.0); | call.set_brightness(1.0); | ||
+ | |||
if (state == 0) { | if (state == 0) { | ||
+ | |||
call.set_rgb(1.0, | call.set_rgb(1.0, | ||
+ | |||
call.set_cold_white(0.0); | call.set_cold_white(0.0); | ||
+ | |||
call.set_warm_white(0.0); | call.set_warm_white(0.0); | ||
+ | |||
} else if (state == 3) { | } else if (state == 3) { | ||
+ | |||
call.set_rgb(0.0, | call.set_rgb(0.0, | ||
+ | |||
} else if (state == 5) { | } else if (state == 5) { | ||
+ | |||
call.set_rgb(0.0, | call.set_rgb(0.0, | ||
+ | |||
} else if (state == 7) { | } else if (state == 7) { | ||
+ | |||
call.set_color_brightness(0.0); | call.set_color_brightness(0.0); | ||
+ | |||
call.set_cold_white(1.0); | call.set_cold_white(1.0); | ||
+ | |||
call.set_warm_white(0.0); | call.set_warm_white(0.0); | ||
+ | |||
} else if (state == 9) { | } else if (state == 9) { | ||
+ | |||
call.set_cold_white(0.0); | call.set_cold_white(0.0); | ||
+ | |||
call.set_warm_white(1.0); | call.set_warm_white(1.0); | ||
+ | |||
} else if (state == 11) { | } else if (state == 11) { | ||
+ | |||
call.set_color_brightness(1.0); | call.set_color_brightness(1.0); | ||
+ | |||
call.set_rgb(0.0, | call.set_rgb(0.0, | ||
+ | |||
call.set_cold_white(0.0); | call.set_cold_white(0.0); | ||
+ | |||
call.set_warm_white(0.0); | call.set_warm_white(0.0); | ||
+ | |||
} | } | ||
+ | |||
call.perform(); | call.perform(); | ||
+ | |||
state += 1; | state += 1; | ||
+ | |||
if (state == 12) | if (state == 12) | ||
+ | |||
{ | { | ||
- | my_global_mode->value() = true; | + | |
+ | my_global_mode→value() = true; | ||
} | } | ||
+ | |||
} | } | ||
web_server: | web_server: | ||
+ | |||
port: 80 | port: 80 | ||
行 156: | 行 244: | ||
binary_sensor: | binary_sensor: | ||
+ | |||
- platform: status | - platform: status | ||
+ | |||
name: " | name: " | ||
sensor: | sensor: | ||
+ | |||
- platform: uptime | - platform: uptime | ||
+ | |||
update_interval: | update_interval: | ||
+ | |||
name: " | name: " | ||
button: | button: | ||
+ | |||
- platform: restart | - platform: restart | ||
+ | |||
name: " | name: " | ||
output: | output: | ||
+ | |||
- platform: esp8266_pwm | - platform: esp8266_pwm | ||
+ | |||
id: red_output | id: red_output | ||
+ | |||
pin: GPIO12 | pin: GPIO12 | ||
+ | |||
- platform: esp8266_pwm | - platform: esp8266_pwm | ||
+ | |||
id: green_output | id: green_output | ||
+ | |||
pin: GPIO14 | pin: GPIO14 | ||
+ | |||
- platform: esp8266_pwm | - platform: esp8266_pwm | ||
+ | |||
id: blue_output | id: blue_output | ||
+ | |||
pin: GPIO5 | pin: GPIO5 | ||
+ | |||
- platform: esp8266_pwm | - platform: esp8266_pwm | ||
+ | |||
id: cold_white_output | id: cold_white_output | ||
+ | |||
pin: GPIO4 | pin: GPIO4 | ||
+ | |||
- platform: esp8266_pwm | - platform: esp8266_pwm | ||
+ | |||
id: warm_white_output | id: warm_white_output | ||
+ | |||
pin: GPIO13 | pin: GPIO13 | ||
light: | light: | ||
+ | |||
- platform: rgbww | - platform: rgbww | ||
+ | |||
name: " | name: " | ||
+ | |||
restore_mode: | restore_mode: | ||
+ | |||
red: red_output | red: red_output | ||
+ | |||
green: green_output | green: green_output | ||
+ | |||
blue: blue_output | blue: blue_output | ||
+ | |||
cold_white: cold_white_output | cold_white: cold_white_output | ||
+ | |||
warm_white: warm_white_output | warm_white: warm_white_output | ||
+ | |||
cold_white_color_temperature: | cold_white_color_temperature: | ||
+ | |||
warm_white_color_temperature: | warm_white_color_temperature: | ||
+ | |||
color_interlock: | color_interlock: | ||
+ | |||
id: my_light | id: my_light | ||
text_sensor: | text_sensor: | ||
+ | |||
- platform: wifi_info | - platform: wifi_info | ||
+ | |||
ip_address: | ip_address: | ||
+ | |||
name: " | name: " | ||
- | disabled_by_default: | ||
- | Note: | + | disabled_by_default: true |
- | 1.How to restore the device. | + | |
- | A: —With Button:Long-Press button over 5 seconds | + | |
- | — Without Button:Reset the device over 3 times with an interval of no more than 5 seconds each time. | + | |
- | The device will self-test it and release the AP SSID about 5 seconds later. | + | |
- | + | ||
- | 2.HA control | + | |
- | A: Power the device, the light product will light up even though you software-shutdown it. And the other product will keep the last device state. | + | |
- | 3.OTA upgrade | + | |
- | A: In browser, land “aiyato-xxxx-xxxxxx” or IP address found in Wi-Fi router background. Enjoy it with ESPHome plugin or YAML file. | + | |
- | 4.Manually add device to HA | + | {{:developmentboard:yaml.zip|yaml.zip}} |
- | A: If HA does not automatically discover device, add integration in the lower right corner of the Devices & Services page, search for ESPhome, and enter the following host address: aiyato-xxxxx-xxxxx (xxxxxx is MAC address of your device) or you can view the IP address of the device on the router management page. Retain the default port number “6053” and submit the configuration. | + | |
- | 5. When to save the device state | + | |
- | A: Device state updates automatically every ONE minute. | + | |
- | 6. ESPHome ONLY support 2.4GHz Wi-Fi router | + | |
- | ✨DON' | + | |
- | PRODUCT PROPERTY:✨ 1: Dohome is a professional brand.Product original from cn(origin). | + | |
- | REASONS TO BUY:✨ Esphome: the rgbc light bulb is equipped with an esphome app, which can be easily connected to your home or office. | + | ---- |
- | ✨ Bulb home assistant: you can easily plug in and unplug the light bulb from your rgbcw home assistant, by replacing the battery or installing the bulb. | + | |
- | ✨ Recommended seller: the rgb led light bulb is recommended by professional designers, as well as industry-leading manufacturers. it is recommended to use at home or in the office when you have high-end products. | + | |
- | ✨ Design with care: this rgbc light bulb is made of high-quality abs material, which is durable and has a long service life. | + | |
- | ✨ Extremely convenient: the rgbcw light bulb is easy to use and can be used for home, office, classroom, etc. | + | |
- | BUYER SAYS:✨ One out of four is bad. | ||