本帖最后由 liujiaqi 于 2020-3-7 10:23 编辑
本帖适合正在装修的用户,因为安装这个东西需要重新下线!
前不久看某鱼,esp8266又涨价了,想我这种学生党(穷B),多买几个简直就是要了血命 ,正巧手里有一个Arduino Mega 2560,和一个esp-01所以我就在设计,能不能实现esp8266负责联网通讯,然后Arduino负责数据处理采集和控制,试了一下,完全ok!
先上测试图:
分部控制
集合控制
集合控制(为了这个我苦思了2天)
数据采集(因为是仿真所以数据不真实)
人体感应检查
关于人体感应给大家讲讲这些系统的一些创新的地方,声音辅助人体感应,所谓的声音辅助人体感应就是指在人体感应的基础上又添加了一道声音识别防止发生误判断。给大家演示一些。
启动“声音辅助人体感应”后只感应到人体灯不会亮
当声音和人体感应同时检测到的时候灯才会亮
以上就是演示内容,还有一些细节例如TM1638控制面板(因为仿真程序没有这个集成块),就没有给大家演示。这时有人就会问了,为啥只有模拟测试,其实我在实体开发板上也调试过了,但是后来因为高考原因就被家长收起来了,也没有在拿出来安装。目前我手头只有一个esp8266,所以我就决定用protues模拟,并用串口与esp8266通讯。随便跟大家说一下protues的一个心得(坑):ttl不能并联!(不要想着可以两个串口并联控制一台设备)。
我的艰苦开发环境
好了寒暄完了,我们聊正事:
先看一下接线图:(我家是 两 室 两厅 )
大家可以选择性安装。下面是一下参考名词:(我英语60分
)
然后是HA配置:
light:
- platform: mqtt
name: "客厅的灯"
command_topic: "homeassistant/light/LivLight/set"
state_topic: "homeassistant/light/LivLight/state"
- platform: mqtt
name: "餐厅的灯"
command_topic: "homeassistant/light/EatLight/set"
state_topic: "homeassistant/light/EatLight/state"
- platform: mqtt
name: "大卧室的灯"
command_topic: "homeassistant/light/BbadLight/set"
state_topic: "homeassistant/light/BbadLight/state"
- platform: mqtt
name: "洗手间的灯"
command_topic: "homeassistant/light/WashLight/set"
state_topic: "homeassistant/light/WashLight/state"
- platform: mqtt
name: "厨房的灯"
command_topic: "homeassistant/light/KitLight/set"
state_topic: "homeassistant/light/KitLight/state"
- platform: mqtt
name: "小卧室的灯"
command_topic: "homeassistant/light/LbadLight/set"
state_topic: "homeassistant/light/LbadLight/state"
switch:
- platform: mqtt
name: "启用客厅人体感应"
command_topic: "homeassistant/switch/LivCheckuse/set"
state_topic: "homeassistant/switch/LivCheckuse/state"
- platform: mqtt
name: "启用餐厅人体感应"
command_topic: "homeassistant/switch/EatCheckuse/set"
state_topic: "homeassistant/switch/EatCheckuse/state"
- platform: mqtt
name: "启用卫生间人体感应"
command_topic: "homeassistant/switch/WashCheckuse/set"
state_topic: "homeassistant/switch/WashCheckuse/state"
- platform: mqtt
name: "启动声音辅助人体感应"
command_topic: "homeassistant/switch/voiceauxiliary/set"
state_topic: "homeassistant/switch/voiceauxiliary/state"
- platform: mqtt
name: "启动照明系统"
command_topic: "homeassistant/switch/power/set"
state_topic: "homeassistant/switch/power/state"
- platform: mqtt
name: "无线模块升级"
command_topic: "homeassistant/switch/espupdata/set"
state_topic: "homeassistant/switch/espupdata/state"
binary_sensor:
- platform: mqtt
name: "客厅人体感应"
state_topic: "homeassistant/sensor/LivCheck/state"
device_class: motion
- platform: mqtt
name: "餐厅人体感应"
state_topic: "homeassistant/sensor/EatCheck/state"
device_class: motion
- platform: mqtt
name: "卫生间人体感应"
state_topic: "homeassistant/sensor/WashCheck/state"
device_class: motion
sensor:
- platform: mqtt
state_topic: "homeassistant/sensor/temperature"
name: "室内温度"
device_class: temperature
unit_of_measurement: "℃"
- platform: mqtt
state_topic: "homeassistant/sensor/humidity"
name: "室内湿度"
device_class: humidity
unit_of_measurement: "%"
- platform: mqtt
state_topic: "homeassistant/sensor/voice"
name: "声音强度"
device_class: signal_strength
unit_of_measurement: "dB"
- platform: mqtt
state_topic: "homeassistant/sensor/illuminance"
name: "室内光线强度"
device_class: illuminance
unit_of_measurement: "lx"
复制代码
接下来说一下我的开发进度:我正在研究天猫精灵接入,和全局自动化,以及添加红外控制功能。但是由于高考原因我会缓慢更新。
大家如果喜欢(催更)的话可以评论个666。
谢谢大家听我磨叽了这么多,最后作为礼物,把还没有成熟的ESP8266 代码给大家,可以参考参考,希望大家喜欢。
sketch_mar01a.zip
(9.18 KB, 下载次数: 20)