
Unit Watering 是一款电容式土壤湿度检测调节 Unit,产品集成水泵与测量极板,用于土壤湿度检测与水泵抽水控制,应用在植物智能养殖场景中,能够非常便捷的实现湿度检测与灌溉控制。测量极板采用电容式设计,与电阻式极板相比,该设计能够有效避免实际使用时极板的腐蚀问题。
电容式土壤湿润程度传感器会汇报 电压/ADC 读数,所以需要根据选择的主控启用并配置 ADC 组件:
# Example configuration entry
sensor:
- platform: adc
pin: GPIOXX
name: "xxxx"
update_interval: 60s 比如使用 Atom Lite:
# Example configuration entry
sensor:
- platform: adc
pin: GPIO32
name: "xxxx"
update_interval: 60s 配置水泵开关:
switch:
- platform: gpio
pin: GPIO26
name: "Water pump" 如此就可以在 Home Assistant 前端控制电机的开/关用于抽水
完整配置范例:
sensor:
- platform: adc
pin: GPIO1
id: voltage
name: "Voltage"
attenuation: auto
update_interval: 10s
- platform: template
id: adc_reading
name: "ADC Reading"
lambda: |-
return roundf( id(voltage).state * 1000.0f );
update_interval: 10s
text_sensor:
- platform: template
name: "Soil Moisture"
icon: "mdi:water-percent"
lambda: |-
const int ADC_DRY = 1550; // Dry threshold
const int ADC_WET = 1450; // Wet threshold
if ( id(adc_reading).state >= ADC_DRY) {
return {"Dry"};
} else if ( id(adc_reading).state >= ADC_WET) {
return {"Wet"};
} else {
return {"Saturated"};
}
update_interval: 10s
switch:
- platform: gpio
pin: GPIO2
id: water_pump
name: "Water pump"
icon: "mdi:water-pump"
restore_mode: RESTORE_DEFAULT_OFF 其中,template 传感器可以根据实际测量到的数据进行修改,根据区间数值,汇报土壤湿润程度
const int ADC_DRY = 1550; // Dry threshold
const int ADC_WET = 1450; // Wet threshold 一般而言,土壤越干燥,该值越大;土壤越湿润,数值越小。亦可根据传感器读数创建自动化动作,控制水泵的开关,以实现定时或者根据土壤湿润程度浇水。
如果在 ESPHome 中实现定时开启开关,可以参考 time 组件
比如设置工作日的每天早上 7 点 30 分打开水泵,持续浇水一分钟,之后关闭水泵开关:
# Example configuration entry
time:
- platform: homeassistant
id: homeassistant_time
on_time:
# Every morning on weekdays
- seconds: 0
minutes: 30
hours: 7
days_of_week: MON-FRI
then:
- switch.turn_on: water_pump
- delay: 60s
- switch.turn_off: water_pump 完成配置后,您可以在 Home Assistant 中查看传感器数据
