本帖最后由 orangetree 于 2024-2-6 16:42 编辑
在咸鱼上买的联想插座,App已不能用,到手拆机后刷esphome固件,已可以接入HomeAssistant,还要完善,时间控制功能还没有。
gpio5是控制继电器,gpio12是控制蓝色LED,gpio4是按键。
<font _mstmutation="1"><font _mstmutation="1">esphome:
name: smartplug2
friendly_name: smartplug2
esp8266:
board: esp07
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "****************" #esphome自动生成
ota:
password: "88888888" #自己设置的密码
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Smartplug2" #自己设置的AP名称
password: "88888888" #自己设置的密码
captive_portal:
# web_server调试时用,可取消。
web_server:
port: 80
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode:
input: true
pullup: true
inverted: true
name: "smartplug Button"
on_press:
- switch.toggle: relay
- platform: status
name: "smartplug Status"
switch:
- platform: gpio
name: "smartplug Relay"
pin: GPIO5
id: relay
output:
# Register the green LED as a dimmable output ....
- platform: esp8266_pwm
id: smartplug_blue_led
pin:
number: GPIO12
inverted: true
light:
# ... and then make a light out of it.
- platform: monochromatic
name: "smartplug Green LED"
output: smartplug_blue_led</font></font></font></font></font>
|