##先定义一个温度传感器
dallas:
- pin: D2
update_interval: 10s
sensor:
- platform: dallas
address: 0x9367fdbd
name: "小鱼缸温度"
id: "Fishbowl2Temperature"
filters:
- filter_out: NAN
- median:
window_size: 3
send_every: 3
##定义一个switch开关,用以控制加热或降温的设备
switch:
- platform: gpio
name: "小鱼缸加热棒"
pin: D5
id: gpiod5
restore_mode: ALWAYS_OFF
##这里定义空调组件,我只用加热,不用降温,所以用的是bang_bang类型的空调组件,同时需要加热和降温就用thermostat类型的空调组件
climate:
- platform: bang_bang
id: climate42
name: "小鱼缸温控"
sensor: Fishbowl2Temperature
default_target_temperature_low: 27 °C
default_target_temperature_high: 27.1 °C
# min_heating_off_time: 60s
# min_heating_run_time: 10s
# min_idle_time: 60s
heat_action:
- switch.turn_on: gpiod5
# - repeat:
# count: 288
# then:
# - switch.turn_on: gpiod5
# - delay: 240s
# - switch.turn_off: gpiod5
# - delay: 60s
idle_action:
- switch.turn_off: gpiod5
# heat_deadband: 0.1 #降到设定温度以下几度开始加热
# heat_overrun: 0.1 #加热到设定温度以上几度停止加热
visual:
min_temperature: 20 °C
max_temperature: 30 °C
|