|
起因是自己烧水泡茶,因为电烧水壶在厨房,我在书房打游戏,,然后就忘了,水烧开又放凉了,于是重新烧,然后又忘了...
于是想用智能音箱TTS语音播放提示音,那么就需要能监控烧水壶状态的传感器,接入HA,用自动化TTS播放预设的文字内容
之前考虑用温度传感器,到100度就播放,后来觉得实现有难度,因为烧水壶烧开后会自动关闭,那么电量是会变化的,于是考虑用电量监控来实现.
所以拆了一个家里的旧公牛插排改造一下,由于插排比较小,得去掉几个插孔,只留了一个孔位.
网上买了零件,具体如下:
PZEM-004T电能模块 30元
ESP-01S 模块 6.5元
1路继电器模块 2元
AC-DC5v模块 4.5
吐槽一下,不知道为什么电能模块为啥那么贵,,DIY成本大部分都在这,而且厂家好像就一个宁波的,这模块不能自制嘛.
排放如图:
接线如图,不会画电路图,手工画的,不是为了发帖画的,就是为了自己照着接线,,插排很小,线路像蜘蛛网,刚开始都搞糊涂了,正极负极,5V 3.3V搞混几次,只好通电用万用表量了才知道.于是画了个手工图,才算清楚的走完了线.
刷固件是最新的tasmato 8.2,,,,刷固件方法参照https://bbs.hassbian.com/thread-6081-1-1.html,有个坑是须短接GPIO0和GND的同时通电,才能刷,搞了半天查了好多资料才知道.
固件设置好MQTT,,还有模式,如图就可以了.
接入HA
sensor:
- platform: mqtt
name: "zong"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Total }}"
unit_of_measurement: "KWH"
- platform: mqtt
name: "zuotian"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Yesterday }}"
unit_of_measurement: "KWH"
- platform: mqtt
name: "jintian"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Today }}"
unit_of_measurement: "KWH"
- platform: mqtt
name: "gonglv"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Power }}"
unit_of_measurement: "W"
- platform: mqtt
name: "yinshu"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Factor }}"
unit_of_measurement: " "
- platform: mqtt
name: "dianya"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Voltage }}"
unit_of_measurement: "V"
- platform: mqtt
name: "dianliu"
state_topic: "tele/diyswitch/SENSOR"
value_template: "{{value_json['ENERGY'].Current }}"
unit_of_measurement: "A"
switch:
- platform: mqtt
name: "pzem"
state_topic: "stat/diyswitch/POWER"
command_topic: "cmnd/diyswitch/POWER"
qos: 0
payload_on: "ON"
payload_off: "OFF"
retain: true
自动化TTS播报:
automation:
- alias: 烧水提醒
initial_state: true
trigger:
- entity_id: sensor.gonglv
platform: numeric_state
below: 5
condition:
- condition: state
entity_id: switch.pzem
state: 'on'
action:
- service: tts.baidu_say
entity_id: media_player.192_168_123_242
message: '请注意,水已经烧好了,可以泡茶啦'
cache: false
完工,,,然后去某宝搜了一下,,发现公牛现在还没有做智能WIFI插线板,只有WIFI插座,我就算给他填补空白吧.
|
评分
-
查看全部评分
|