本帖最后由 se7en 于 2018-6-6 09:35 编辑
配件清单:12V ws2812灯带,12v转5v降压模块,8266我用的是GOOUUU s1(引脚编号直接跟GPIO对应,找脚不用看图),电源12v,15A(15米,灯带30规格够用)
第一步:复制库文件到arduino,goouuu G0-GND短接插上电脑usb,查看设备管理器com设备端口号,arduino选择对应的端口。刷上下面固件(记得修改wifi和mqtt配置),重启goouuu。
第二部:配置hass
light:
- platform: mqtt
name: "Porch LEDs"
command_topic: "bruh/mqttstrip/setpower"
state_topic: "bruh/mqttstrip/setpowerpub"
rgb_state_topic: "bruh/mqttstrip/setcolorpub"
rgb_command_topic: "bruh/mqttstrip/setcolor"
brightness_state_topic: "bruh/mqttstrip/setbrightnesspub"
brightness_command_topic: "bruh/mqttstrip/setbrightness"
optimistic: false
input_select:
porch_led_effect:
name: Porch LED Effect
options:
- "BPM"
- "Candy Cane"
- "Confetti"
- "Cyclon Rainbow"
- "Dots"
- "Fire"
- "Glitter"
- "Juggle"
- "Lightning"
- "Noise"
- "Police All"
- "Police One"
- "Rainbow"
- "Rainbow with Glitter"
- "Ripple"
- "Sinelon"
- "Solid"
- "Twinkle"
initial: "Solid"
input_number:
porch_animation_speed:
name: Porch Animation Speed
initial: 150
min: 1
max: 150
step: 10
automation:
- alias: "Porch Input Effect"
initial_state: True
hide_entity: False
trigger:
- platform: state
entity_id: input_select.porch_led_effect
action:
- service: mqtt.publish
data_template:
topic: "bruh/mqttstrip/seteffect"
payload: '{{ trigger.to_state.state | string }}'
- alias: "Porch Animation Speed"
initial_state: True
hide_entity: False
trigger:
- platform: state
entity_id: input_number.porch_animation_speed
action:
- service: mqtt.publish
data_template:
topic: "bruh/mqttstrip/setanimationspeed"
payload: '{{ trigger.to_state.state | int }}'
以上配置复制到相应位置,light: input_select: automation: input_slider:
接线方法:
12v+接led红线,12v-接led白线,gpio5接绿色din,注意接箭头的起点
5米一段,每段电源并联,din串联
固件:
库文件:放到我的文档arduino/libraries下面
效果:
|