#### 需求:装修时没细考虑,壁挂式太阳能保留了,增加了燃气热水器。水管中这两个设备是并列关系,需要用哪一个就要跑过去打开角阀,不用的就要关掉角阀。一个在厨房,一个在阳台,使用一段时间发现真是不方便。有时天气好太阳能能达到60度左右,但冬天洗澡的话也就洗一个人多点,后面的还是要换成燃气的。如果只用燃气又感觉太阳能的热水浪费了。
ha的自动化能很好的解决以上问题,前期的硬件工作是关键。
#### 设备现状:
燃气热水器断电时是打开状态,则通电时保持打开状态。这样就不需要有什么改装,只要通断电就能开关热水器。太阳能热水器通电就能显示温度值,通不能电不影响使用。
先后购买了两个常闭型电动阀(通电打开,断电关闭)、两个米家蓝牙mesh墙壁插座。电源打开则对应管道的阀门就打开,电源关闭对应管理的阀门也就关闭。
#### 安装效果图:
燃气热水器:
太阳能热水器:
#### 基本需求:
1、打开太阳能热水器,自动关闭燃气热水器。
2、打开燃气热水器,自动关闭太阳能热水器。
ha自动化:
- id: '161435528888888'
alias: 燃气热水器与太阳能互控
description: ''
trigger:
- platform: state
entity_id: switch.28d1272b27be_switch
to: 'on'
- platform: state
entity_id: switch.28d12736597a_switch
to: 'on'
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.entity_id == "switch.28d1272b27be_switch" }}'
- condition: state
state: 'on'
entity_id: switch.28d12736597a_switch
for: '30'
sequence:
- service: switch.turn_off
data: {}
entity_id: switch.28d12736597a_switch
- conditions:
- condition: template
value_template: '{{ trigger.entity_id == "switch.28d12736597a_switch" }}'
- condition: state
entity_id: switch.28d1272b27be_switch
state: 'on'
for: '30'
sequence:
- service: switch.turn_off
data: {}
entity_id: switch.28d1272b27be_switch
default: []
mode: single
有人回到家就自动打开太阳能,如果需要切换可以利用一个hassmart的多余开关或者小米开关等触发切换。
#### 进阶需求:
1、基本需要保留
2、太阳能温度低于30度时自动切换燃气热水器,并且标记 input“使用太阳能”为off。
3、需要使用热水时打开一个开关,根据 input“使用太阳能"的值决定打开太阳能还是打开燃气。
4、每天14:00和18:00分别标记 input“使用太阳能”为on。
这个需要将太阳能的温度值接入到ha中,为了不破坏电器(其实是不会弄),采用ssocr来识别。
这个比较麻烦,调试参数重启了n次系统
本例代码:
image_processing:
- platform: seven_segments
x_position: 0
y_position: 0
width: 640
height: 480
threshold: 60
digits: 2
extra_arguments: -f white
source:
- entity_id: camera.esp32cam
sensor:
- platform: template
sensors:
taiyannengwendu:
value_template: "{{ states('image_processing.sevensegment_ocr_esp32cam') }}"
friendly_name: '太阳能温度'
unit_of_measurement: '°C'
这个测试没问题后,自动化就可以做了
- id: '1614361998512'
alias: 洗澡时选用太阳能关闭则打开天然气
description: ''
trigger:
- platform: state
entity_id: input_boolean.xuan_yong_tai_yang_neng
to: 'off'
condition:
- condition: state
entity_id: binary_sensor.e4aaec34d5e2_contact
state: 'off'
for: '120'
- condition: state
entity_id: input_boolean.athome
state: 'on'
- condition: state
entity_id: light.hassmartweishengjiandeng
state: 'on'
action:
- service: switch.turn_on
data: {}
entity_id: switch.28d1272b27be_switch
mode: single
- id: '1614400275701'
alias: 每天重置选择太阳能
description: ''
trigger:
- platform: time
at: '14:00:00'
- platform: time
at: '18:00:00'
condition:
- condition: state
entity_id: input_boolean.xuan_yong_tai_yang_neng
state: 'off'
action:
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.xuan_yong_tai_yang_neng
mode: single
- id: '1614400878432'
alias: 太阳能温度低于30度时取消选用太阳能
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.taiyannengwendu
below: '30'
for: '10'
condition: []
action:
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.xuan_yong_tai_yang_neng
mode: single
最后用多余的一个hassmart开关做在卫生间中操作的关联开关:
- id: '1613889412561'
alias: 浴室镜开关关联热水开关
description: ''
trigger:
- platform: state
entity_id: switch.hassmartweishengyushideng
to: 'on'
- platform: state
entity_id: switch.hassmartweishengyushideng
to: 'off'
condition: []
action:
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- choose:
- conditions:
- condition: state
entity_id: switch.hassmartweishengyushideng
state: 'on'
- condition: state
state: 'off'
entity_id: switch.28d12736597a_switch
- condition: state
entity_id: switch.28d1272b27be_switch
state: 'off'
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.xuan_yong_tai_yang_neng
state: 'on'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.28d12736597a_switch
- service: automation.turn_on
data: {}
entity_id: automation.tai_yang_neng_wen_du_di_yu_30du_shi_qu_xiao_xuan_yong_tai_yang_neng
default:
- service: switch.turn_on
data: {}
entity_id: switch.28d1272b27be_switch
- conditions:
- condition: state
entity_id: switch.hassmartweishengyushideng
state: 'off'
sequence:
- service: switch.turn_off
data: {}
entity_id: switch.28d1272b27be_switch
- service: switch.turn_off
data: {}
entity_id: switch.28d12736597a_switch
default: []
mode: single
还可以增加小米开关等设备作为开关设置在需要用水的地方,用热水时就不要到处跑了。
太阳能电源打开时功率4W至5W,燃气热水器电源打开时功率约2W。不需要用时就关掉两个,需要用时就自动判断开启对应的电源或都切换电源。
发帖子当一个记录和经验分享,可能有些错漏之处。
|