应该不是让890na关于违章建筑投诉范文了,关建是www890nacom安全联盟没栏截

看到前面有答机械表的,我也来凑个热闹。&br&&br&提名积家Atoms空气钟&br&无需电池,无需上发条,通过温度变化引起内部气体体积变化驱动指针转动。永动机毕竟是有悖于物理定律,而空气钟则是用天才的灵感,精巧的设计,精密的工艺创造了了近似于“永动”的奇迹。&br&&br&&br&&figure&&img src=&https://pic2.zhimg.com/v2-4dbfde7eb65_b.png& data-rawwidth=&400& data-rawheight=&400& class=&content_image& width=&400&&&/figure&&br&&br&&figure&&img src=&https://pic3.zhimg.com/v2-e12d0cca772_b.png& data-rawwidth=&400& data-rawheight=&400& class=&content_image& width=&400&&&/figure&&br&&br&&figure&&img src=&https://pic1.zhimg.com/v2-15ca6bc4c2be86cda1e9f18aabf0eac0_b.png& data-rawwidth=&400& data-rawheight=&400& class=&content_image& width=&400&&&/figure&&br&&br&&figure&&img src=&https://pic4.zhimg.com/v2-f2ec942c74b44dc3cdce5e8f_b.png& data-rawwidth=&400& data-rawheight=&400& class=&content_image& width=&400&&&/figure&&br&&br&&figure&&img src=&https://pic2.zhimg.com/v2-89eaf4cc195_b.png& data-rawwidth=&400& data-rawheight=&400& class=&content_image& width=&400&&&/figure&&br&&br&&figure&&img src=&https://pic1.zhimg.com/v2-8f3c24ac8adf598de2bc72ef5711ffe0_b.png& data-rawwidth=&400& data-rawheight=&400& class=&content_image& width=&400&&&/figure& ↑以上图片来自积家官网。&br&&br&论复杂程度可能远逊于很多复杂功能的机械表,价格也仅仅与一块一线品牌的基础款腕表相当,但这个东西我觉得真的算是机械的艺术了。&br&&br&&br&↓以下是转自《腕表之家》的介绍,略有删节,侵删。&br&
“Atmos空气钟无需人为上链,接近列奥纳多o达o 芬奇(Léonard de Vinci)所追求的永动机的梦想。其运转本身就是一场盛大演出,独一无二,别具匠心。&br&&br&&figure&&img src=&https://pic4.zhimg.com/v2-76e0e49153edc7d8cf1ad2b_b.jpg& data-rawwidth=&700& data-rawheight=&681& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic4.zhimg.com/v2-76e0e49153edc7d8cf1ad2b_r.jpg&&&/figure&&br&以空气为动力的座钟&br&
温度发生变化时,在机芯背面的密封罩内,一种混合气体(氯甲酸乙酯C2H5CI)犹如手风琴风箱一样膨胀收缩。当温度上升时,气体膨胀,进而使罩体增大。当温度下降时,气体收缩,罩体体积减小。每当密封罩大小改变时,都会牵动小链条为空气钟上链。&br&&br&
该系统的惊人之处在于它极佳的敏感性。当温度在15到30摄氏度之间时,每一度的变化足以保证两天的动力储存。为实现这一制表创举,空气钟必须在几乎没有摩擦且稳定的情况下运转。&br&&br&&figure&&img src=&https://pic4.zhimg.com/v2-ba54556a1b_b.jpg& data-rawwidth=&700& data-rawheight=&590& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic4.zhimg.com/v2-ba54556a1b_r.jpg&&&/figure&&br&&br&精妙机械一览无余&br&
在Atmos Classique经典空气钟、Atmos by Marc Newson空气钟等许多采用透明钟壳设计的作品上,视线可以直接触及其齿轮构造中心。空气钟的秘密展露无遗。空气钟的“肺部”清晰可见,一呼一吸之间,与温度的变化完美和谐。气体的膨胀与收缩缓慢无痕,肉眼难以觉察。平衡摆轮旋转极为缓慢,上演着一场华丽演出。一分钟仅左右摆动一次,即传统座钟的1/60,腕表的1/14 400!&br&&br&&figure&&img src=&https://pic3.zhimg.com/v2-7fb8f260afe_b.jpg& data-rawwidth=&700& data-rawheight=&732& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic3.zhimg.com/v2-7fb8f260afe_r.jpg&&&/figure&&br&机械的奥秘就在一根丝线上&br&
平衡摆轮是由一根极为细长平滑的丝线悬吊于空气钟上部的。这根丝线的扭力足以支撑平衡摆轮左右摆动。&br&&br&
没有了这根丝线,一切都无法实现。这根丝线采用几乎不受温度变化影响的合金材质,这种合金是由诺贝尔物理学奖获得者、来自瑞士的查尔斯·埃杜德·纪尧姆(Charles-Edouard Guillaume)发明的。合金丝在表厂经过人工秘密工序处理。至于其供应方面,则需要6年的时间才能找到足够的优质金属来制成这一合金。&br&&br&&br&&figure&&img src=&https://pic2.zhimg.com/v2-cc7b09bf7daacd_b.jpg& data-rawwidth=&700& data-rawheight=&945& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic2.zhimg.com/v2-cc7b09bf7daacd_r.jpg&&&/figure&&br&超前的环保意识&br&
其成果是十分惊人的!六千万台Atmos空气钟加在一起竟然不超过一只15瓦灯泡的能耗!机械运转是如此的完美,其齿轮构造无需上油。由于Atmos空气钟是针对千年以上的使用周期而设计的,因此润滑油老化太快。”
看到前面有答机械表的,我也来凑个热闹。 提名积家Atoms空气钟 无需电池,无需上发条,通过温度变化引起内部气体体积变化驱动指针转动。永动机毕竟是有悖于物理定律,而空气钟则是用天才的灵感,精巧的设计,精密的工艺创造了了近似于“永动”的奇迹。 ↑以…
&figure&&img src=&https://pic1.zhimg.com/v2-5c187c773003bcdb25d3_b.jpg& data-rawwidth=&720& data-rawheight=&764& class=&origin_image zh-lightbox-thumb& width=&720& data-original=&https://pic1.zhimg.com/v2-5c187c773003bcdb25d3_r.jpg&&&/figure&&p&“打算全家装修智能家居,应该怎么操作?” 基本上你会收获两类回答:&/p&&p&&br&&/p&&p&一种是土豪任性型,装修大别野的传统厂商,全套绑定他们的产品,从此以后又贵又难修;&/p&&p&&br&&/p&&p&另外一种就是无所谓美观型,因为可选的智能家居品牌就那么点,最后控制面板装了一堆,app也装了满满一屏,活脱脱把家里整成了一个买家秀。&br&&/p&&p&&br&&/p&&p&两种方案我都无法接受,那就只有自己动手上了。那么,把全家打造成智能家居,需要多少成本,需要在手机上装多少个app呢?这是我的答案:&/p&&p&&br&&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-5e2cd1af2_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1190& data-rawheight=&1246& data-thumbnail=&https://pic1.zhimg.com/v2-5e2cd1af2_b.jpg& class=&origin_image zh-lightbox-thumb& width=&1190& data-original=&https://pic1.zhimg.com/v2-5e2cd1af2_r.jpg&&&/figure&&p&&br&&/p&&p&实用面积70平的房子,一万元的成本,手机上零app,接入了18个品牌的110个设备。&br&&/p&&p&&br&&/p&&h2&&b&1 门禁系统&/b&&/h2&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-5bb166ea1fab86e03fc36_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&720& data-rawheight=&408& data-thumbnail=&https://pic2.zhimg.com/v2-5bb166ea1fab86e03fc36_b.jpg& class=&origin_image zh-lightbox-thumb& width=&720& data-original=&https://pic2.zhimg.com/v2-5bb166ea1fab86e03fc36_r.jpg&&&/figure&&p&&br&&/p&&p&(原配品牌:耶鲁密码锁,加装控制器)&/p&&p&&br&&/p&&p&一个具备科技感的家,从进门的那一刻就开始了。刚出电梯手机连上了wifi,家门就会自动打开;手机没电了?拿着手机扫一下门锁,门也能开;双手都拎着重物腾不出手来?不要紧,对着Siri喊一句芝麻开门,大门依旧能够为你而开。&/p&&p&&br&&/p&&h2&&i&2 &/i&全屋智能照明&/h2&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-5baa072ac8afcc45f879f_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&500& data-rawheight=&333& data-thumbnail=&https://pic1.zhimg.com/v2-5baa072ac8afcc45f879f_b.jpg& class=&origin_image zh-lightbox-thumb& width=&500& data-original=&https://pic1.zhimg.com/v2-5baa072ac8afcc45f879f_r.jpg&&&/figure&&p&&br&&/p&&p&(改装小米开关面板,改造成本3000元)&/p&&p&进入屋内,迎接你的是全天候无间隙智能照明系统。夜晚回到家中,打开门的瞬间入户灯亮起;回房睡觉的时候,卧室外的灯光自动关闭;起夜的时候,过道的小夜灯亮起,温柔而不刺眼。人来灯亮,人走灯灭,即使是第一次来访的客人,或是毫不懂技术的老人家,都能瞬间适应这样的操作。只要待上一两个小时,你就会忘了开关的存在。&/p&&p&&br&&/p&&h2&&i&3 &/i&空气净化系统&/h2&&figure&&img src=&https://pic4.zhimg.com/v2-4ac1bab68e583d0b81f687f_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1000& data-rawheight=&618& class=&origin_image zh-lightbox-thumb& width=&1000& data-original=&https://pic4.zhimg.com/v2-4ac1bab68e583d0b81f687f_r.jpg&&&/figure&&p&&br&&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-a307e4dbbbfb34ccf45f61_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&852& data-rawheight=&718& class=&origin_image zh-lightbox-thumb& width=&852& data-original=&https://pic1.zhimg.com/v2-a307e4dbbbfb34ccf45f61_r.jpg&&&/figure&&p&(原配:松下新风系统、IQAir 空气净化器;加装远程控制器、pm2.5传感器)&/p&&p&&br&&/p&&p&7*24小时自我运转的空气净化系统,如果满足了预先设定的条件,净化系统就会自动打开。而空气质量达标之后,净化系统又会自动关闭。&/p&&p&
√ 室内pm2.5是否超标&/p&&p&
√ 窗户是否已关闭&/p&&p&
√ 家中是否有人&/p&&p&
√ 是否有人在睡觉&/p&&p&&br&&/p&&h2&&i&4
&/i&空调地暖&/h2&&figure&&img src=&https://pic2.zhimg.com/v2-41c15fe83d38afc9d3c6a8_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1120& data-rawheight=&428& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic2.zhimg.com/v2-41c15fe83d38afc9d3c6a8_r.jpg&&&/figure&&p&&br&&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-6623ceec3520f9b7ef8ba_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1108& data-rawheight=&1140& class=&origin_image zh-lightbox-thumb& width=&1108& data-original=&https://pic4.zhimg.com/v2-6623ceec3520f9b7ef8ba_r.jpg&&&/figure&&p&&br&&/p&&p&(原配:大金中央空调、威能水地暖;加装远程控制器、小米温湿度传感器)&/p&&p&中央空调跟地暖,原有控制面板的预约设置都非常的不人性化,于是经常早上着急出门就忘了关,或者晚上回家还得慢慢等设备启动一会。&/p&&p&&br&&/p&&p&于是,干脆把它们都接到了系统里,搭配以每个房间一个的小米温度传感器 —— 咔哒,获得一个自制的nest温控!&br&&/p&&p&&br&&/p&&p&根据当前室内的温度、家里有没有人、该时间段电费是不是便宜、主人是不是要回家了,等等一系列的条件,来自动控制地暖空调的开关。经过试验,地暖费从第一个月的1500,直接降到了第二月的500。&/p&&p&&br&&/p&&h2&&i&5 &/i&智能音箱&/h2&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-d016cabc9af7ae2a07df41b888fd359f_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&520& data-rawheight=&520& class=&origin_image zh-lightbox-thumb& width=&520& data-original=&https://pic4.zhimg.com/v2-d016cabc9af7ae2a07df41b888fd359f_r.jpg&&&/figure&&p&&br&&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-647fecdbde6bddd480fd8_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1023& data-rawheight=&575& data-thumbnail=&https://pic4.zhimg.com/v2-647fecdbde6bddd480fd8_b.jpg& class=&origin_image zh-lightbox-thumb& width=&1023& data-original=&https://pic4.zhimg.com/v2-647fecdbde6bddd480fd8_r.jpg&&&/figure&&p&&br&&/p&&p&在一众智能音箱中,我毫不犹豫地选择了Amazon Echo Dot, 小小一个打折的时候只需30美元。取下一只射灯,把它塞入天花板中,供电也解决了,再也看不到恼人的电源线,完美!&/p&&p&&br&&/p&&p&于是在要睡觉的时候,喊一句“echo 晚安”,所有的灯全部自动关闭,开着的电视、游戏机、空气净化器等各个设备也通通自动关掉,主卧的空调地暖跳转至预先设定的温度,所有操作一步到位。&/p&&p&&br&&/p&&p&&br&&/p&&h2&&i&6 &/i&情景模式&/h2&&figure&&img src=&https://pic2.zhimg.com/v2-da3fb983dedcab4d7ef834_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1176& data-rawheight=&556& class=&origin_image zh-lightbox-thumb& width=&1176& data-original=&https://pic2.zhimg.com/v2-da3fb983dedcab4d7ef834_r.jpg&&&/figure&&p&&br&&/p&&p&家中可以建立的情景模式其实不少,但最让我自豪的,还是这个市面上仅此一份的泡澡模式!&/p&&p&&br&&/p&&p&想要泡澡了,喊一句“我要泡澡”,浴缸就会自动开始放水。等水放到位了,出水口自动关闭,通过音箱通知我,可以开始泡澡啦。于此同时,阳台的落地玻璃进入磨砂模式,灯光变暗、电视开启,就可以开始愉悦地享受生活啦。&/p&&p&&br&&/p&&h2&&i&7
&/i&调光窗户&/h2&&figure&&img src=&https://pic1.zhimg.com/v2-7c873e274d1ccddd6b1a9fe6_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&500& data-rawheight=&319& data-thumbnail=&https://pic1.zhimg.com/v2-7c873e274d1ccddd6b1a9fe6_b.jpg& class=&origin_image zh-lightbox-thumb& width=&500& data-original=&https://pic1.zhimg.com/v2-7c873e274d1ccddd6b1a9fe6_r.jpg&&&/figure&&p&&br&&/p&&p&几经搜寻,才寻找到玻璃的供应商。为什么在客厅阳台采用这样的玻璃,而不是窗帘呢?一是因为浴缸就在那边上,布料容易潮湿;二是因为不久的将来,一马路之隔就将拔地而起一座办公楼,为了保护自己的隐私,又保持透光性,想来这种磨砂的效果就是最好的选择。没人在家的时候,断电状态下是磨砂模式。白体如果有人在客厅活动,就通电变成透光模式。而如果在泡澡的时候,窗户就又自动关闭了。&/p&&p&&br&&/p&&h2&&i&8
&/i&电动窗帘/卷帘&/h2&&figure&&img src=&https://pic2.zhimg.com/v2-bce3c63ead_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&500& data-rawheight=&333& data-thumbnail=&https://pic2.zhimg.com/v2-bce3c63ead_b.jpg& class=&origin_image zh-lightbox-thumb& width=&500& data-original=&https://pic2.zhimg.com/v2-bce3c63ead_r.jpg&&&/figure&&p&&br&&/p&&p&平日里开关窗帘倒也不多,所以电动卷帘对我来说最大的意义,是可以跟娱乐影音系统相关联,想要看电视或者玩游戏的时候,只需一步操作,就能让幕布下降,投影仪跟电视盒子同时启动。&br&&/p&&h2&&i&9 &/i&全屋安防&/h2&&figure&&img src=&https://pic4.zhimg.com/v2-7f8a0ed1b258e0eabcb1_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&1160& data-rawheight=&792& class=&origin_image zh-lightbox-thumb& width=&1160& data-original=&https://pic4.zhimg.com/v2-7f8a0ed1b258e0eabcb1_r.jpg&&&/figure&&p&&br&&/p&&p&猫眼里藏入一个拆得全裸的小米摄像头,不管是怪叔叔还是偷懒的保洁,全都尽收眼底。&/p&&p&&br&&/p&&p&把开发商配备的鸡肋感应器通通拆除,保留外壳,内部换上了小米的传感器芯片,于是直接利用了原有的供电系统,无需担心电池耗尽的问题。全屋三十多个传感器,覆盖了烟雾、水浸、人体、门窗、光线、温湿度、空气质量等等方面,一有风吹草动,手机上都会收到推送,如果投保房屋险,保险公司是不是应该给我点折扣哇?&/p&&p&&br&&/p&&p&结合各类传感器,还可以设定一些非常实用的提醒。比如每天早上我走到玄关的时候,结合当天的天气预报,系统会提醒我应该带伞还是擦防晒。虽然雨伞就放在玄关处,但是之前总是要等到了楼下才意识到又忘了带了...&br&&/p&&hr&&p&&br&&/p&&p&最后附图一张,致敬那些曾经安装过的那些app们。现在!总算!可以把他们全部都卸载了!在我看来,为了智能还要在手机上再点击app去控制,那简直就是智障家居。只有这种全程无需人工干预,自己独立运转的体系,才总算跟智能搭了点点边。&/p&&p&&br&&/p&&p&所以,我是不是可以自豪地回答知乎上的这个问题—— 喜欢宅的人,如何把家里装修成全世界最舒服的地方?&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-9b3c58e4d4eaa_b.jpg& data-caption=&& data-size=&normal& data-rawwidth=&754& data-rawheight=&800& class=&origin_image zh-lightbox-thumb& width=&754& data-original=&https://pic1.zhimg.com/v2-9b3c58e4d4eaa_r.jpg&&&/figure&&p&&br&&/p&&p&我的智能家居装修项目,在2017年的尾巴总算告一段落了。如果你有任何疑问,欢迎在本帖留言,接下来将陆陆续续选取疑问最多的部分,写些更详细的解说贴。&/p&&p&&br&&/p&&p&附上一些之前参考链接:&br&&/p&&ul&&li&全屋结构:&a href=&https://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMzI5NjAwMTA0OQ%3D%3D%26mid%3D%26idx%3D1%26sn%3Dfe780e04ba2%26chksm%3Df460d40dcbb56b1edee267f01cd9ccc69abe8220%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&我把精装修敲成了毛坯,就为了一个无印良品风格的家&/a&&/li&&li&全屋照明:&a href=&https://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMzI5NjAwMTA0OQ%3D%3D%26mid%3D%26idx%3D1%26sn%3Dae1e18c6e5f30%26chksm%3Df460d44ccde85deea75ec0ff8ad33b3e3d85921beb562f%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&【智能家居 - 灯控篇 】史上最实用的智能灯控改造指南&/a& &/li&&li&门禁卡改造:&a href=&https://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMzI5NjAwMTA0OQ%3D%3D%26mid%3D%26idx%3D1%26sn%3D3053eadd6f7eafb69d9d020e0ffa7e6a%26chksm%3Df460d599cca0bee356e93ecd76f2c28f270c%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&亲爱的,我把门卡缩小了&/a&&/li&&li&浴缸龙头:&a href=&https://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMzI5NjAwMTA0OQ%3D%3D%26mid%3D%26idx%3D1%26sn%3Dd726ad8b6a6eedc7fe336ee%26chksm%3Df460d467ca9ab260acf0ffeaac2e86e25dadb%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&79元打造一个智能水龙头,某宝商家要哭了&/a&&/li&&li&新风系统:&a href=&https://link.zhihu.com/?target=http%3A//mp.weixin.qq.com/s%3F__biz%3DMzI5NjAwMTA0OQ%3D%3D%26mid%3D%26idx%3D1%26sn%3D5edecdc7d4cbae88b4e0abaf%26chksm%3Df460d588ce68dffab298bfb942c2cebdf61fd67%26scene%3D21%23wechat_redirect& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&新房&精装修&带新风系统,竟然没有pm2.5净化?...&/a&&/li&&/ul&&p&&/p&&p&&/p&
“打算全家装修智能家居,应该怎么操作?” 基本上你会收获两类回答: 一种是土豪任性型,装修大别野的传统厂商,全套绑定他们的产品,从此以后又贵又难修; 另外一种就是无所谓美观型,因为可选的智能家居品牌就那么点,最后控制面板装了一堆,app也装了满…
&p&原文链接:&a href=&https://link.zhihu.com/?target=http%3A//blog.yxwang.me/2017/10/smart-home-2/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&智能家居之实践篇 · Aiur&/a&&/p&&hr&&p&装修了半年多,两个月前正式入住,可以开始好好折腾智能家居了。现在用的一些方案和之前写的&a href=&https://link.zhihu.com/?target=http%3A//blog.yxwang.me/2017/03/remodel-smart-home/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&智能家居之计划篇&/a&差了不少,于是有了这篇博客聊聊现在的设计。这里直入主题,之前的计划篇里有更多的背景介绍。&/p&&hr&&h2&服务器&/h2&&p&我用了一台几年前的联想笔记本做服务器,装了个 Debian。这篇文章提到的大多数应用其实在树莓派上都能跑。下面主要讲软件部分。&/p&&p&&b&中控系统&/b&&/p&&p&一开始用的是 &a href=&https://link.zhihu.com/?target=https%3A//www.smartthings.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&SmartThings&/a&,尝试了 &a href=&https://link.zhihu.com/?target=http%3A//homeassistant.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Home Assistant&/a& 之后就决定改用它了。HA 相对于 ST 有不少优势,首先 ST 的大部分需要联网才能工作,增加了额外的不稳定因素和延迟;同时 HA 是开源的 Python 项目,可定制性比 ST 高很多,例如可以把所有状态变化记录到第三方数据库,支持 FloorPlan 等强大的插件。&/p&&p&HA 本身只是个软件,并不直接支持 Z-Wave 和 Zigbee 等协议。我选了 &a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B00X0AWA6E/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB00X0AWA6E%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D8ede6e70eadc2d5f88d8df& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Aeotec Z-Stick Gen5&/a& 用来接收 Z-Wave 的信号,家里 Zigbee 的设备不多,需要的时候也可以用 ST 通过 MQTT 传给 HA。&/p&&p&下图就是 Home Assistant 的面板截图,可以设置多个场景方便控制。比如我在睡觉前会看一眼 Security 确保门都锁好,以及其他监控正常。 &/p&&figure&&img src=&https://pic3.zhimg.com/v2-85c12c910c2f3c22c5d2aee54d9d0129_b.jpg& data-caption=&& data-rawwidth=&1520& data-rawheight=&782& class=&origin_image zh-lightbox-thumb& width=&1520& data-original=&https://pic3.zhimg.com/v2-85c12c910c2f3c22c5d2aee54d9d0129_r.jpg&&&/figure&&p&&br&&/p&&p&&b&数据库和监控&/b&&/p&&p&Home Assistant 默认会把所有的事件信息保存在 SQLite 数据库里,并不适合长时间保存,而且没法简单的导出给其他应用。我把所有的事件信息都保存到了 InfluxDB 里,在前端搭了一个 Grafana 做监控面板。&/p&&p&HA 对 InfluxDB 的支持很好,参考&a href=&https://link.zhihu.com/?target=https%3A//home-assistant.io/components/influxdb/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&官方文档&/a&就能搞定,设置好以后所有的传感器更新、开关变化等信号都会保存到 InfluxDB 里。下图就是温度、湿度和占空传感器的一个 Grafana 页面。 &/p&&figure&&img src=&https://pic1.zhimg.com/v2-f06d46fa97ff1ada40f99dfc_b.jpg& data-caption=&& data-rawwidth=&1214& data-rawheight=&822& class=&origin_image zh-lightbox-thumb& width=&1214& data-original=&https://pic1.zhimg.com/v2-f06d46fa97ff1ada40f99dfc_r.jpg&&&/figure&&p&&br&&/p&&p&以及 Unifi AP 的信号监控页面,借用了网上的一个 &a href=&https://link.zhihu.com/?target=https%3A//grafana.com/dashboards/1486& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Grafana 模版&/a& &/p&&figure&&img src=&https://pic1.zhimg.com/v2-2e2f58c8cf6cb1fb9cef_b.jpg& data-caption=&& data-rawwidth=&1838& data-rawheight=&1064& class=&origin_image zh-lightbox-thumb& width=&1838& data-original=&https://pic1.zhimg.com/v2-2e2f58c8cf6cb1fb9cef_r.jpg&&&/figure&&p&&br&&/p&&p&&b&传感器&/b&&/p&&p&传感器可以用来监控房间的温度、湿度,是否有人,以及门窗是否关好等。接下来介绍一下我研究过的几款传感器。&/p&&p&&b&&a href=&https://link.zhihu.com/?target=https%3A//www.ecobee.com/room-sensors/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Ecobee Room Sensor&/a&&/b&&/p&&p&因为家里是用 Ecobee 控制暖气的,所以多买几个 Room Sensor 可以很方便的集成到网络里。Ecobee 会根据有人的房间的温度控制暖气,同时 Ecobee API 也会输出这些 Sensor 的数据(温度、是否有人)。&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B00NXRYOIQ/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB00NXRYOIQ%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Dbf12dbe58d& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&购买链接&/a&&/p&&p&&b&Monoprice Door Sensor&/b&&/p&&p&性价比挺高的门窗传感器,外观也比较低调。基于 Z-Wave Plus 协议,会报告剩余电量。&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B01I5YERWE/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB01I5YERWE%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Df3b689b8a27166fda688e& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&购买链接&/a&&/p&&p&&b&Monoprice Z-Wave Plus Multi Sensor&/b&&/p&&p&可以报告温度、湿度、是否有人和自身电量。默认的报告频率有点低(差 2 度才会发送更新),需要发个指令调节。&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B01MRYFE90/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB01MRYFE90%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Dd94de752e690d75a41ec56f15bf416d4& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&购买链接&/a&&/p&&p&&b&&a href=&https://link.zhihu.com/?target=https%3A//store.wirelesstag.net/collections/all& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Wireless Sensor Tags&/a&&/b&&/p&&p&需要先买一个 Tag Manager,可以接入多达 40 个传感器,而且有效范围在 400ft (120m)。这个方案看起来很不错,不过我用 Ecobee sensor 再加几个 Monoprice 的 multi sensor 已经够用了。&/p&&p&&b&&a href=&https://link.zhihu.com/?target=http%3A//list.mi.com/130& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&小米的智能家庭套装&/a&&/b&&/p&&p&小米的温湿度传感器和门窗传感器都只要 ?49,性价比非常高,而且外观也不错。不过最后我还是没买小米的设备,主要原因是小米用的是私有的 Zigbee 协议,不支持 Smart Things,得买小米自己的中控。然而小米中控的有效范围在 10m 左右,用电池的传感器也不支持信号中继,得在楼上楼下放好几个小米中控才能保证足够的覆盖范围。&/p&&p&&b&Monoprice Z-Wave Plus Door and Window Sensor&/b&&/p&&p&Monoprice 的门窗感应器,我在两扇院子门上各装了一个,方便查看院子门有没有关上。&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B073WFL9SC/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB073WFL9SC%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D0296fd2dbd39d14a45a56b62d2252010& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&购买链接&/a&&/p&&p&&br&&/p&&p&&b&监控摄像头&/b&&/p&&p&一开始我用的是 Arlo Pro,然而用了一阵子后觉得 Arlo 还是有不少问题,比如有录像延迟,检测到物体时经常会错过一开始的几秒,而且不付月租费话不支持 24 小时录像,即使插电源也不可以。&/p&&p&最后决定还是用传统 IP 摄像头 + NVR。视频录制在 NVR 的本地硬盘,出于安全考虑 NVR 不直接暴露给外网,而是通过中控服务器上的 &a href=&https://link.zhihu.com/?target=https%3A//zoneminder.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&ZoneMinder&/a& 间接访问。ZoneMinder 是一个开源的录像监控方案,其实它的功能已经相当强大了,但是同时监控几个摄像头会长时间占用中控的 CPU,所以我还是用了 NVR 专门负责监控录像。&/p&&hr&&h2&照明&/h2&&p&&b&智能开关&/b&&/p&&p&研究了几个带亮度控制的开关,主要推荐两款,都是 Z-Wave Plus 协议的:&/p&&ul&&li&&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B01DFRWZNE/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB01DFRWZNE%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Dc380f6b2d28bc& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&HomeSeer HS-WD100+ Dimmer&/a&,有对应的&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B01DFSOTSM/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB01DFSOTSM%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D5be4fb10d80b7dfca17e& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&双联开关&/a&。HomeSeer 的开关可以实时更新状态,不过得保证开关盒里有零线和地线。有些老房子的开关盒里不一定有零线。&/li&&li&&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B01MUCZA1C/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB01MUCZA1C%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Dddff23cf93da7eea87f6& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GE Z-Wave Plus Dimmer&/a&,这款是 GE 的,价格比 HomeSeer 的便宜一点,也有对应的&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B00RKJS8MQ/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB00RKJS8MQ%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D5aab742aee13f37cb6b6cd& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&双联开关&/a&。GE 的这款开关不支持实时更新状态,但是优点在于不需要零线,老房子也能用。&/li&&/ul&&p&另外我还试过 &a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B00LEWQY6C/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB00LEWQY6C%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D6d30fccbe37c9d8a6b291& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Leviton DZMX1-1LZ&/a&,不推荐这款,要求有零线,价格不便宜而且还不支持 Z-Wave Plus。Leviton 应该有新款的开关,不过我没研究过。&/p&&p&&b&智能灯泡&/b&&/p&&p&这一块没怎么研究,Hue 用过一段时间,还算方便,但就像之前&a href=&https://link.zhihu.com/?target=http%3A//localhost%3A/remodel-smart-home/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&那篇文章&/a&里提到的,智能灯泡的问题在于很难和普通开关一起用,得用配套的遥控开关才行,会导致墙上多不少开关。&/p&&p&另外 IKEA 今年出了不少智能灯泡,用了 Zigbee 协议,看&a href=&https://link.zhihu.com/?target=https%3A//home-assistant.io/blog//ikea-tradfri-internet-of-things-done-right/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&评测&/a&感觉很有前途。&/p&&p&&b&网络&/b&&/p&&p&一开始我在 &a href=&https://link.zhihu.com/?target=https%3A//eero.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Eero&/a& 和 &a href=&https://link.zhihu.com/?target=https%3A//www.netgear.com/orbi/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Orbi&/a& 之间纠结,结果有位研究无线网络 4 年的同事给我推荐 &a href=&https://link.zhihu.com/?target=https%3A//www.ubnt.com/unifi/unifi-ap/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Unifi&/a& 的无限路由,试了下的确好用。&/p&&p&&a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B015PRO512/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB015PRO512%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D5bedfccaac4ec8b35c93a8e4& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&UniFi Pro AP (UAP-PRO)&/a& 可以通过 PoE 供电。不过 Unifi 设备的 PoE 比较特殊,这款 UAC-PRO 是同时支持 802.3af 和 802.3at 协议的,然而 &a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B015PR20GY/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB015PR20GY%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D4783b79acf8b41b2bebb2e& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&UAP-AC-LITE&/a& 只支持 802.3at。如果你打算用 Unifi 官方的 PoE 网关,不需要担心这个问题。但如果你像我一样用的是其他的(我用了 &a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B00GG1ACX2/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB00GG1ACX2%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Dbeeb71f12cac& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&NETGEAR JGS516PE&/a&),买之前得研究下这个供电问题。&/p&&p&Unifi Pro AP 的信号覆盖很好,我家楼上楼下各有 1400 sqft(130 平方米),院子不大。我在楼下入口和楼上靠近院子的房间各放了一个 AP,基本上就做到整个房子包括院子无死角覆盖了。这样算下来成本其实和用 Eero / Orbi 也差不多,但是性能会好很多,因此推荐给房间里布置了网线口的朋友。&/p&&p&Unifi 也出了类似 Eero 的 mesh network 的解决方案,没有研究过所以不做评价。&/p&&p&&b&影音&/b&&/p&&p&客厅用了原来的 Harmony 遥控,配合 Amazon Echo 开关电视很方便。&/p&&p&装修的时候在其他房间布置了天花板音响,但是没有现成的价格又不是太贵的多个房间的音响解决方案。研究了一通之后采用了 Echo Dot + T-Amp 的方案,每个房间配一个 Echo Dot 和一个小型功放,用手机控制各个房间的音乐。功放我用的是 &a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B005D7SKWK/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB005D7SKWK%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3D85ff501b1a139ccd8a3ac42& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Topping TP30&/a&,不算音响成本大概在 $130 左右,比起其他动辄两千的解决方案划算多了。&/p&&hr&&h2&其他&/h2&&p&&b&Homebridge&/b&&/p&&p&网上有一个&a href=&https://link.zhihu.com/?target=https%3A//github.com/home-assistant/homebridge-homeassistant& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&开源的 Homebridge 插件&/a&,可以让 Homebridge 支持 Home Assistant,这样在 HomeKit 里面控制 HA 上的设备了。不过我很少用 HomeKit,没有花时间把一个个设备整理好。&/p&&p&&b&门锁&/b&&/p&&p&门锁用的是 &a href=&https://link.zhihu.com/?target=https%3A//www.amazon.com/gp/product/B00D1M5YTG/ref%3Das_li_tl%3Fie%3DUTF8%26camp%3D1789%26creative%3D9325%26creativeASIN%3DB00D1M5YTG%26linkCode%3Das2%26tag%3Daiurblog-20%26linkId%3Dea5cee83b213d0039887eced& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Schlage Camelot Touchscreen Deadbolt&/a&,Z-Wave 协议,很稳定,用到现在没出什么问题。用电量很小,三个月下来我的几个门锁还有 99% 的电(当然也有可能是 Z-Wave 电量报告不准确)。&/p&&p&&b&Automatic&/b&&/p&&p&&a href=&https://link.zhihu.com/?target=https%3A//www.automatic.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Automatic&/a& 是一个车载装置,它可以记录你的车辆行驶状态、当前位置等信息,HA 官方支持 Automatic,可以把车辆信息作为条件放到 HA 的自动化脚本里,比如车在车库里熄火以后关闭内部摄像头。&/p&&p&&b&用电量&/b&&/p&&p&试了下 &a href=&https://link.zhihu.com/?target=https%3A//aeotec.com/z-wave-home-energy-measure& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Aeotec 的电量检测工具&/a&,需要安装在电箱附近。这套工具价格不贵($15 左右),但是很不好用,有实时更新的问题。Home Assistant 的论坛上有个&a href=&https://link.zhihu.com/?target=https%3A//community.home-assistant.io/t/aeotec-dsb09104-home-energy-meter-not-updating-in-hass/12104/5& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&帖子&/a&讨论怎么搞定它的自动更新。&/p&&p&&b&车库门控制&/b&&/p&&p&家里车库门的动力引擎用了 &a href=&https://link.zhihu.com/?target=https%3A//www.liftmaster.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&LiftMaster&/a&,所以我就买了他家的 &a href=&https://link.zhihu.com/?target=http%3A//amzn.to/2gJPkEU& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Chamberlain MYQ-G0201 MyQ-Garage&/a&。这个设备不支持 Z-Wave 协议,但是 Home Assistant 有个插件可以以用户名密码的方式登陆后台控制。&/p&&p&如果想要支持 Z-Wave 协议的车库门开关,可以考虑 &a href=&https://link.zhihu.com/?target=http%3A//amzn.to/2wZBgNy& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&GoControl GD00Z-4&/a&。&/p&&p&&b&电动窗帘&/b&&/p&&p&看下来 Bali 的方案还不错,Home Depot 可以试,不过最后因为各种原因还是没装。&/p&&p&&b&Twilio&/b&&/p&&p&发短信的平台,配合 HA 的自动脚本很好用。比如我的设置里有一条规则是外门超过 5 分钟以上没锁就发短信提醒自己。&/p&&hr&&h2&One More Thing: Floorplan&/h2&&p&最近在折腾的一个叫 &a href=&https://link.zhihu.com/?target=https%3A//github.com/pkozul/ha-floorplan& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Floorplan&/a& 的 HA 插件,顾名思义就是让所有的智能设备显示在一个平面图上方便控制。 &/p&&figure&&img src=&https://pic4.zhimg.com/v2-fdb2c860ebaa4444253feb_b.jpg& data-caption=&& data-rawwidth=&1043& data-rawheight=&935& class=&origin_image zh-lightbox-thumb& width=&1043& data-original=&https://pic4.zhimg.com/v2-fdb2c860ebaa4444253feb_r.jpg&&&/figure&&p&&br&&/p&&p&这是我目前的效果图,现在只加入了灯光、占空和温度信息,点击对应的房间可以控制这个房间的灯光。接下来打算在左侧放一排全局控制的按键,把弄一个平板挂到墙上,就可以在进家和出门的时候方便的控制全屋设备了。类似下图的效果(&a href=&https://link.zhihu.com/?target=http%3A//www.vmwareinfo.com/2017/07/visualizing-smart-home-using-home.html& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&图片来源&/a&)。 &/p&&figure&&img src=&https://pic3.zhimg.com/v2-b3ae235e3082d0fca40d5_b.jpg& data-caption=&& data-rawwidth=&1015& data-rawheight=&768& class=&origin_image zh-lightbox-thumb& width=&1015& data-original=&https://pic3.zhimg.com/v2-b3ae235e3082d0fca40d5_r.jpg&&&/figure&&p&&/p&
原文链接:装修了半年多,两个月前正式入住,可以开始好好折腾智能家居了。现在用的一些方案和之前写的差了不少,于是有了这篇博客聊聊现在的设计。这里直入主题,之前的计划篇里有更多的背景介绍。服务器我用了一…
如果你在用安卓,有些事我不说,你也懂吧。&br&&br&当我决定摆脱某UI无比臃肿的制定rom,艰难地转战android原生时,犹如走进了一个全新的世界,我怀着轻松愉悦的心情举目四望,呼吸新鲜的空气,发现同是安卓,原生竟然可以这么流畅。我踏着轻松的脚步进入应用商店,满目是互联网三大毒瘤的棋子,但又不得不用。过一阵子感觉有点卡,看看后台运行应用,沃日,一般的安全卫士关闭自启的完全不管用,野火烧不尽,春风吹又生。。。。&br&在我欲哭无泪的时候,有三个陌生的哥们拍拍我的肩膀,说,“兄弟别气馁,谁欺负你了,我干它Y的!”。&br&&br&神器~xposed框架&br&&figure&&img src=&https://pic1.zhimg.com/a67cf8a7ef9aa3c55af30d1d14db69dc_b.png& data-rawwidth=&984& data-rawheight=&1749& class=&origin_image zh-lightbox-thumb& width=&984& data-original=&https://pic1.zhimg.com/a67cf8a7ef9aa3c55af30d1d14db69dc_r.png&&&/figure&&br&Xposed框架是一款可以在不修改APK的情况下影响程序运行(修改系统)的框架服务,基于它可以制作出许多功能强大的模块,且在功能不冲突的情况下同时运作。&br&当前,Per APP Setting(为每个应用设置单独的dpi或修改权限)、Cydia、XPrivacy(防止隐私泄露)、对原生Launcher替换图标等应用或功能均基于此框架。&br&_______________________________________&br&&br&&br&老二~阻止运行&br&&figure&&img src=&https://pic4.zhimg.com/d5b8792be8aeec01fcbcf43_b.png& data-rawwidth=&984& data-rawheight=&1749& class=&origin_image zh-lightbox-thumb& width=&984& data-original=&https://pic4.zhimg.com/d5b8792be8aeec01fcbcf43_r.png&&&/figure&阻止运行通过劫持几个系统api,阻止应用程序在你不使用时运行,内心独白:“并不只是针对你阿里系和百度系,我的意思是在座的都是**”&br&_______________________________________&br&&br&&br&三爷~绿色守护&br&&figure&&img src=&https://pic4.zhimg.com/d35b6c284d00ea6a55dc2dab41a36677_b.png& data-rawwidth=&984& data-rawheight=&1749& class=&origin_image zh-lightbox-thumb& width=&984& data-original=&https://pic4.zhimg.com/d35b6c284d00ea6a55dc2dab41a36677_r.png&&&/figure&休眠功能能省下一大波的电,也有和阻止运行相似的功能。&br&&br&经过一番周折,三管齐下一进一出,管控手机如遛番狗。&br&嗯,这个世界原来还是很美好的嘛。&br&&br&不过话说回来,花自己的钱买的手机,然后还要花这么多心思,去争夺手机的控制权,你们不觉得好奇怪吗?
如果你在用安卓,有些事我不说,你也懂吧。 当我决定摆脱某UI无比臃肿的制定rom,艰难地转战android原生时,犹如走进了一个全新的世界,我怀着轻松愉悦的心情举目四望,呼吸新鲜的空气,发现同是安卓,原生竟然可以这么流畅。我踏着轻松的脚步进入应用商店…
&figure&&img src=&https://pic4.zhimg.com/v2-9d2f0d051cd12ee812db4c3_b.jpg& data-rawwidth=&700& data-rawheight=&233& class=&origin_image zh-lightbox-thumb& width=&700& data-original=&https://pic4.zhimg.com/v2-9d2f0d051cd12ee812db4c3_r.jpg&&&/figure&&p&&/p&&p&本章讲一讲「高级版自动化」。你可以现在设想一下:天气预报说要下雨了,网关灯变红!如果爸爸回家,手机接入 Wi-Fi,赶紧推送告诉我不要看小视频了!只要米家 + &a href=&http://link.zhihu.com/?target=https%3A//ifttt.com/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&IFTTT&/a& + &a href=&http://link.zhihu.com/?target=https%3A//home-assistant.io/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&HomeAssistant&/a& 就可以做到!&/p&&blockquote&前情回顾&br&上一章题目是《&a href=&http://link.zhihu.com/?target=https%3A//sspai.com/post/39851& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&入门智能家居,从米家到 HomeKit(一)&/a&》&br&主要讲的是在「树莓派」上通过 HomeBridge 把米家智能家居接入到 iOS 的 HomeKit 中。&/blockquote&&p&&b&实在非常抱歉,因为本人本职工作最近负责开发一个项目,一月赶工无休,所以实在没法抽出时间更新这个系列,现在项目有一些模块已经上线,时间相对宽裕一些,遂把这个坑填了。&/b&&/p&&p&这一章我们除了使用到上一章的 HomeBridge,还会使用 HomeAssistant。&/p&&p&那么,问题来了:&/p&&figure&&img src=&https://pic1.zhimg.com/v2-b622d5d31aef210a515f5f68_b.png& data-rawwidth=&1120& data-rawheight=&373& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic1.zhimg.com/v2-b622d5d31aef210a515f5f68_r.jpg&&&/figure&&h2&0. HomeKit、HomeBridge、HomeAssistant 分别是什么?关系是什么?&/h2&&h2&0.1. 概念&/h2&&ul&&li&HomeKit:苹果于 2015 年 5 月发布的智能家居平台。&/li&&li&HomeBridge:一个开源程序,用于让 HomeKit 支持一些原生不支持 HomeKit 的设备(如米家家居)。&/li&&li&HomeAssistant:一个第三方的智能家居平台。&/li&&/ul&&h2&0.2. 关系&/h2&&ul&&li&上一章的关系图:&/li&&/ul&&figure&&img src=&https://pic4.zhimg.com/v2-55f056df09a11b23feedff_b.png& data-rawwidth=&626& data-rawheight=&111& class=&origin_image zh-lightbox-thumb& width=&626& data-original=&https://pic4.zhimg.com/v2-55f056df09a11b23feedff_r.jpg&&&/figure&&p&可以看到,上一章米家设备通过插件 HomeBridge-Mi-Aqara 来与 HomeBridge 沟通,让我们的 iPhone 通过 Siri(HomeKit)来接入 HomeBridge 达到最终控制米家设备的目的。&/p&&ul&&li&本章的关系图:&/li&&/ul&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-2cf187bb6a1d610fe5d6311dae4faf21_b.png& data-rawwidth=&880& data-rawheight=&285& class=&origin_image zh-lightbox-thumb& width=&880& data-original=&https://pic2.zhimg.com/v2-2cf187bb6a1d610fe5d6311dae4faf21_r.jpg&&&/figure&&p&&br&&/p&&p&可以看到,这一章将要介绍的情况,米家、IFTTT 这些智能家居并没有直接接入到 HomeBridge,而是先接入到第三方智能家居平 HomeAssistant,然后 HomeAssistant 与 HomeBridge 通过插件 HomeBridge-HomeAssistant 进行交互沟通,最后把结果反馈到你的手机上。&/p&&h2&0.3. 我为什么要搞多一个 HomeAssistant?&/h2&&p&因为接入了 HomeAssistant,能够给你的家居智能化上升到一个新的高度,HomeAssistant 支持一系列的组件。&/p&&p&HomeBridge 因为自身的一些条件限制,以及条件束缚,只能够一次控制一类家居,比如 HomeBridge-Mi-Aqara 就只能控制米家类家居。&/p&&p&而 HomeAssistant 能够做到,「如果天气预报说要下雨了,网关灯变红,多云变黄,晴天就变绿啊」,或者是「爸爸回家了手机自动联入 Wi-Fi,会发推送告诉我不要看小视频了」等等,可以说,让更多的事情加入到智能化这一行列。&/p&&p&让事情变得更好玩,更有趣,更智能,是我引入 HomeAssistant 的目的所在。&/p&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-f99c8dcefe8214ddf4ae6_b.png& data-rawwidth=&878& data-rawheight=&756& class=&origin_image zh-lightbox-thumb& width=&878& data-original=&https://pic3.zhimg.com/v2-f99c8dcefe8214ddf4ae6_r.jpg&&&/figure&&p&&br&&/p&&h2&0.4. 我想告诉你的&/h2&&p&如果你是希望「用 iPhone 或者 Siri 控制一些米家家居,或者回到家打开门台灯自动亮起来欢迎你」,那么其实 &a href=&http://link.zhihu.com/?target=https%3A//sspai.com/post/39851& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&上一章内容&/a& 已经完全满足你的需求,已经 OK 了。&/p&&p&这一章虽然带来了很多新的有趣的「骚操作」,但是因为引入了 HomeAssistant,所以也会相应的增加了操作量,所以你要自我衡量考虑一下要不要继续折腾噢~&/p&&p&涉及到的新操作 &b&IFTTT&/b&、&b&动态域名解析&/b&、&b&Liunx 部分新命令&/b&。&/p&&h2&1. 开始前的准备&/h2&&p&准备:&/p&&ol&&li&你需要有一个&b&树莓派&/b&,它是一个&b&已知 IP 地址&/b&,&b&开启了 SSH&/b&,&b&干净正常耐操&/b&的树莓派。&/li&&li&希望你最好有 linux 的基础。&/li&&/ol&&p&通关路线:&/p&&ul&&li&如果对于上面两条你已经做到了,那么直接从往下看。&/li&&li&如果你是完全按照上一章内容操作,并且完成了所有功能实现,那么请看&a href=&http://link.zhihu.com/?target=https%3A//sspai.com/post/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&这里&/a&,为你跳过重复部分。&/li&&li&如果你对于这个准备毫无头绪,不妨先回顾一下 &a href=&http://link.zhihu.com/?target=https%3A//sspai.com/post/39851& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&上一章内容&/a&,在上一章的第 0~1 章有相应的&b&手把手教学&/b&。&/li&&li&如果你已经配置好了 HomeAssistant & HomeBridge,可以直接拉到下面查看关于「联动 IFTTT 的骚操作教程」。&/li&&/ul&&h2&2. 整个应用框架的安装&/h2&&h2&2.1. 安装 NodeJS&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
&/code&&/pre&&/div&&figure&&img src=&https://pic1.zhimg.com/v2-046acd53ae398_b.png& data-rawwidth=&906& data-rawheight=&753& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic1.zhimg.com/v2-046acd53ae398_r.jpg&&&/figure&&p&&br&&/p&&p&安装完要使用nodejs -v看看版本是不是 v6.xx,如果不是的话,再次执行这两条命令。&/p&&h2&2.2. 安装 avahi 包&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo apt-get install libavahi-compat-libdnssd-dev
&/code&&/pre&&/div&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-7ae4ee1ea11bc1de81deb_b.png& data-rawwidth=&906& data-rawheight=&744& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic4.zhimg.com/v2-7ae4ee1ea11bc1de81deb_r.jpg&&&/figure&&p&&br&&/p&&h2&2.3. 安装 HomeBridge&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo npm install -g --unsafe-perm homebridge
&/code&&/pre&&/div&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-84ba00e8a542ecd458bcdb8f16f53f2c_b.png& data-rawwidth=&906& data-rawheight=&744& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic1.zhimg.com/v2-84ba00e8a542ecd458bcdb8f16f53f2c_r.jpg&&&/figure&&p&&br&&/p&&h2&2.4. 安装 HomeBridge-HomeAssistant&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo npm install -g homebridge-homeassistant
&/code&&/pre&&/div&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-cc325b25b9d64ae24d3bd_b.png& data-rawwidth=&906& data-rawheight=&744& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic2.zhimg.com/v2-cc325b25b9d64ae24d3bd_r.jpg&&&/figure&&p&&br&&/p&&h2&2.5. 安装 HomeAssistant&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo pip3 install homeassistant
&/code&&/pre&&/div&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-40d1f902f79ee598cf0f695e04cf4d66_b.png& data-rawwidth=&906& data-rawheight=&744& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic3.zhimg.com/v2-40d1f902f79ee598cf0f695e04cf4d66_r.jpg&&&/figure&&p&&br&&/p&&h2&2.6. 配置 HomeAssistant&/h2&&h2&2.6.1. 初始化 HomeAssistant 配置文件&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&mkdir ~/.homeassistant
vi ~/.homeassistant/configuration.yaml
&/code&&/pre&&/div&&p&在打开的编辑器中,单击键盘的i键,进入输入状态。&/p&&p&复制以下初始化内容到文件中。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
# 设置你的经纬度,判断日落时间
latitude: 42.7683
longitude: 129.3364
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 0
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Asia/Shanghai
# Show links to resources in log and frontend
introduction:
# Enables the frontend
# Enables configuration UI
# Uncomment this to add a password (recommended!)
# 这里推荐设置一个登陆密码
api_password: HaHb7890
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# base_url: example.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog//explaining-the-updater/
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
# View all events in a logbook
# Track the sun
# Weather prediction
- platform: yr
# Text to speech
- platform: google
group: !include groups.yaml
automation: !include automations.yaml
&/code&&/pre&&/div&&p&然后点击键盘 esc,输入 :wq 进行保存并推出编辑器。&/p&&h2&2.6.2. 安装 HomeAssistant 初始化所需要的插件&/h2&&p&HomeAssistant 安装完后,其实只是安装了一个主体程序,实际上还需要安装很多小控件的安装,往往需要 Root 权限,所以在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo hass --open-ui
&/code&&/pre&&/div&&p&等待程序自动运行,他会安装一些 HomeAssistant 所需要的一些组件。&/p&&p&我们可以在浏览器中输入http://树莓派IP地址:8123 进行访问,去了解 HomeAssistant 是否初始化成功。&/p&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-d7f22caddd68a_b.png& data-rawwidth=&906& data-rawheight=&744& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic3.zhimg.com/v2-d7f22caddd68a_r.jpg&&&/figure&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-dfd2a33ddfa9_b.png& data-rawwidth=&1120& data-rawheight=&685& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic2.zhimg.com/v2-dfd2a33ddfa9_r.jpg&&&/figure&&p&&br&&/p&&p&当你的浏览器看到这个页面,表示已经成功初始化插件安装了。这个时候你需要多按几次 Ctrl+C(Mac 电脑是 Control+C)来退出这个程序,一直按到你出到能输出命令的终端页面。如下图所示:&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-8d079c2e6a663b4f19e1f0_b.png& data-rawwidth=&906& data-rawheight=&744& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic4.zhimg.com/v2-8d079c2e6a663b4f19e1f0_r.jpg&&&/figure&&p&ha-hb-8&/p&&p&&br&&/p&&p&注意,以 Root 权限运行的 HomeAssistant 在实际操作中发现,并不能按照我们的配置文件进行配置,所以我们还需要以当前用户 pi 权限来运行 HomeAssistant。&/p&&p&然后在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&hass --open-ui
&/code&&/pre&&/div&&p&等待片刻,我们用浏览器访问 http://树莓派IP地址:8123,如果你在前面配置文件中有设置密码 HaHb7890,就会显示一个登陆页面,说明你能够正式使用 HomeAssistant 系统了。&/p&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-e2f84fedbee135db02d50c61cc286691_b.png& data-rawwidth=&1046& data-rawheight=&640& class=&origin_image zh-lightbox-thumb& width=&1046& data-original=&https://pic2.zhimg.com/v2-e2f84fedbee135db02d50c61cc286691_r.jpg&&&/figure&&p&&br&&/p&&h2&2.6.3. 记录米家智能家居硬件的相关信息&/h2&&p&打开 米家 App(小米智能家居官方硬件),选择智能网关设备,点选右上角的 ··· 功能符号,进入后点选 关于。&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-fc697ee8bc971cdec375f53ff7416848_b.png& data-rawwidth=&1120& data-rawheight=&748& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic1.zhimg.com/v2-fc697ee8bc971cdec375f53ff7416848_r.jpg&&&/figure&&p&&br&&/p&&p&然后你看到的是下图左边的样子,这时候你需要疯狂输出,要不断的点击空白处,片刻后界面就会变成右边的样子,多了局域网通信协议还有网关信息选项。&/p&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-bf83efee4fb0a43cd94c71_b.png& data-rawwidth=&1120& data-rawheight=&1126& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic2.zhimg.com/v2-bf83efee4fb0a43cd94c71_r.jpg&&&/figure&&p&&br&&/p&&p&这时候,分别点选他们,记录你的网关的局域网通信协议密码以及网关的 MAC 地址,请记好噢。&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-e26b0a9eef_b.png& data-rawwidth=&1120& data-rawheight=&1126& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic4.zhimg.com/v2-e26b0a9eef_r.jpg&&&/figure&&p&&br&&/p&&h2&2.6.4. 把 HomeAssistant 配置米家智能家居&/h2&&blockquote&需要注意的是,HomeAssistant 在 50.0 版本后,已经从官方上集成对小米智能家居,所以我们直接在 HomeAssistant 配置文件上配置即可。&/blockquote&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&vi ~/.homeassistant/configuration.yaml
&/code&&/pre&&/div&&p&进入编辑器后,按住 shift 然后单击键盘 g 键,会自动跳转到最后一行(Vim 的 G 键代表跳到最后一行)。然后单击键盘 o 键,开始进入编辑模式。&/p&&p&输入以下字段:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&xiaomi:
- mac: B827EBDA70F9(你的小米网关MAC地址,地址中间如果加`-`会报错)
key: 通讯密码(请全部大写,不然只能看智能家居状态不能控制)
&/code&&/pre&&/div&&p&然后,单击键盘esc键,再输入:wq进行保存退出。&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-426ad471e536131edd1ec90abe1cdfdb_b.png& data-rawwidth=&906& data-rawheight=&767& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic4.zhimg.com/v2-426ad471e536131edd1ec90abe1cdfdb_r.jpg&&&/figure&&p&&br&&/p&&p&Ok,配置好,就要软重启一下 HomeAssistant,进入 HomeAssistant 页面,选择左下角的Developer Tools(开发者工具)下的第一个图标,然后在右边的标签页中填写相应的信息:&/p&&ul&&li&Domain: homeassistant&/li&&li&Service: restart&/li&&/ul&&p&然后点击CALL SERVICE来唤起 HomeAssistant 的重启。&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-21cdbe33fcdc_b.png& data-rawwidth=&1046& data-rawheight=&640& class=&origin_image zh-lightbox-thumb& width=&1046& data-original=&https://pic1.zhimg.com/v2-21cdbe33fcdc_r.jpg&&&/figure&&p&&br&&/p&&blockquote&原理介绍:HomeAssistant 把很多功能都以组件来看待,然后我们就是调用了核心组件homeassistant里面其中一个方法restart来对 HomeAssistant 进行重启。&/blockquote&&p&这个时候,HomeAssistant 的页面会告诉你已经与服务器断开连接了,事实上你只要静静地等待就好了,等到重新正常连接就 OK 了。但是耐不住寂寞的你肯定想看看进度如何对吧,这个时候,你知道打开刚刚输入了hass --open-ui代码的终端窗口,就可以看到实时情况,如下面的截图就是说,我在安装的过程中,而且安装过程已经超过 10s 了。&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-4aede4b7b135d2f75e2e86ac8a2ac5e4_b.png& data-rawwidth=&906& data-rawheight=&823& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic1.zhimg.com/v2-4aede4b7b135d2f75e2e86ac8a2ac5e4_r.jpg&&&/figure&&p&&br&&/p&&p&稍安勿躁,去泡杯茶回来,网页版的 HomeAssistant 已经能够正常连接了,你点击左边栏的States按钮,回到总览页面,你就可以看到,小!米!智!能!家!居!出!现!了!&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-7f03f44e41dc_b.png& data-rawwidth=&1046& data-rawheight=&750& class=&origin_image zh-lightbox-thumb& width=&1046& data-original=&https://pic1.zhimg.com/v2-7f03f44e41dc_r.jpg&&&/figure&&p&&br&&/p&&p&OK,那说明你的小米智能家居已经成功的接入了 HomeAssistant 平台了,恭喜你往高端玩家又进了一步请继续阅读下文哈。&/p&&h2&2.7. 配置 HomeBridge-HomeAssistant&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&mkdir ~/.homebridge
cd ~/.homebridge
vi config.json
&/code&&/pre&&/div&&p&在打开的文件界面中,单击键盘的i键,进入输入状态。&/p&&p&复制以下内容到文件中。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&{
&bridge&: {
&name&:&Homebridge&,
&username&:&B8:27:EB:DA:70:F9&,
&port&:51826,
&pin&:&233-78-123&
&platforms&: [
&platform&: &HomeAssistant&,
&name&: &HomeAssistant&,
&host&: &http://127.0.0.1:8123&,
&password&: &HaHb7890&,
&supported_types&: [&binary_sensor&, &climate&, &cover&, &device_tracker&, &fan&, &group&, &input_boolean&, &light&, &lock&, &media_player&, &remote&, &scene&, &sensor&, &switch&]
&/code&&/pre&&/div&&ul&&li&bridge-name : 你在 iPhone 的 HomeKit 上面看到桥接设备网关的名称&/li&&li&bridge-username : 树莓派 MAC 地址&/li&&li&bridge-port : HomeBridge 使用的端口,默认就好&/li&&li&bridge-pin : 在 iPhone 上认证 HomeBridge 网关的密码,这个按照你自己喜好来输入吧&/li&&li&platforms-host : 你访问 HomeAssistant 的地址+端口&/li&&li&platforms-password : 你在 HomeAssistant 设置的登陆密码&/li&&/ul&&h2&2.8. 配置 HomeBridge&/h2&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&homebridge -D
&/code&&/pre&&/div&&p&运行成功后,会如下图所示:&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-5a39f38d9ba7_b.png& data-rawwidth=&906& data-rawheight=&823& class=&origin_image zh-lightbox-thumb& width=&906& data-original=&https://pic4.zhimg.com/v2-5a39f38d9ba7_r.jpg&&&/figure&&p&&br&&/p&&h2&2.9. iOS 的 HomeKit 配置&/h2&&p&进入家庭App,添加配件,你就可以看到 HomeBridge 了&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-c0ba88ef87b2ebfe52f62eeebe4213c7_b.png& data-rawwidth=&1120& data-rawheight=&748& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic4.zhimg.com/v2-c0ba88ef87b2ebfe52f62eeebe4213c7_r.jpg&&&/figure&&p&&br&&/p&&p&把里面的配件添加进来,你的 HomeKit 就已经具备了他应该有的功能了。&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-4dd72f126071ffe3a440fce051aff768_b.png& data-rawwidth=&1120& data-rawheight=&1126& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic1.zhimg.com/v2-4dd72f126071ffe3a440fce051aff768_r.jpg&&&/figure&&p&&br&&/p&&h2&2.10. 设置长久运行的 Homebridge&/h2&&p&事实上,你现在如果关闭了 SSH 链接,那么你的 HomeKit 也会处于失效状态,因为你的 Homebridge 随着 SSH 的连接关闭导致被关闭了,如果解决?&/p&&p&使用SCREEN工具,在终端下输入:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo apt-get install screen
&/code&&/pre&&/div&&p&然后输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&SCREEN -dmS hb homebridge
# 开启一个名字叫做hb的窗口并运行homebridge命令,hb这个名字你随意取
SCREEN -dmS ha hass --open-ui
# 开启一个名字叫做ha的窗口并运行'hass --open-ui'命令,hb这个名字你随意取
&/code&&/pre&&/div&&p&在 screen 里开启的 Homebridge 不会随着 SSH 关闭而被关闭。那么如何暂时退出这个窗口呢?&/p&&p&先按Ctrl+A然后按完再按一下d就可以跳出来做其他事情了,如何回去?使用screen -x hb即可。&/p&&h2&2.11. 设置开机自启动 HomeBridge & HomeAssistant&/h2&&p&事实上,树莓派关机后,两个程序会被关闭,可以使用SCREEN工具,并且在rc.local里面添加开机自启动任务。&/p&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo vi /etc/rc.local
&/code&&/pre&&/div&&p&然后进入了编辑器,单击键盘的i键进入编辑模式。在exit 0这一行前面添加:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&su -c &screen -dmS hb homebridge& -s /bin/sh pi
su -c &screen -dmS ha hass --open-ui& -s /bin/sh pi
&/code&&/pre&&/div&&p&然后单击键盘esc退出编辑模式,然后输入:wq保存文件并推出编辑器。&/p&&h2&2.12. 设置远程化运行的 HomeKit&/h2&&p&苹果规定,HomeKit 一般情况下,只能在同一个 Wi-Fi 下操作,如果你要远程化和自动化操作。请充(yao)值(mai)信(mai)仰(mai)!&/p&&p&远程控制起步是iPad mini 2 或者 Apple TV 3&/p&&p&自动化起步是iPad mini2 或者 Apple TV 4&/p&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-502bdd3d45ae8f99a406640dbe57586a_b.png& data-rawwidth=&834& data-rawheight=&800& class=&origin_image zh-lightbox-thumb& width=&834& data-original=&https://pic3.zhimg.com/v2-502bdd3d45ae8f99a406640dbe57586a_r.jpg&&&/figure&&p&&br&&/p&&p&[&a href=&http://link.zhihu.com/?target=https%3A//support.apple.com/zh-cn/HT207057& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&地址戳我&/a&]&/p&&h2&3. 联动 IFTTT 的骚操作开始&/h2&&p&终于来到激动人心的时刻了,要开始真正的骚操作了。&/p&&h2&3.1. 给 HomeAssistant 配置 IFTTT 组件&/h2&&p&类似小米智能家居的通信密钥,IFTTT 有一个 key,从[&a href=&http://link.zhihu.com/?target=https%3A//ifttt.com/maker_webhooks& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&Webhook 这个位置&/a&]获取得到。&/p&&p&拿到之后,在终端中输入以下命令:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&vi ~/.homeassistant/configuration.yaml
&/code&&/pre&&/div&&p&进入编辑器后,按住shift然后单击键盘g键,会自动跳转到最后一行(vim 的 G 键代表跳到最后一行)。然后单击键盘o键,开始进入编辑模式,输入以下字段:&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&ifttt:
key: xxxxx_xxxxxxxxxxxxx
&/code&&/pre&&/div&&p&然后,单击键盘esc键,再输入:wq进行保存退出。&/p&&p&然后按照上面的教程,重新 restart 一下 HomeAssistant。&/p&&h2&3.2. IFTTT 作为触发条件&/h2&&p&做一个简单演示,如果我们用 HomeAssistant 调用了 IFTTT,就给手机版的 IFTTT 发一条推送。&/p&&p&作为 IF 条件,Event Name 就是我们给这个事件声明的名字,我们以HA_TEST来做这个事件的声明名字。&/p&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-db5032bbfba9a_b.png& data-rawwidth=&1046& data-rawheight=&796& class=&origin_image zh-lightbox-thumb& width=&1046& data-original=&https://pic2.zhimg.com/v2-db5032bbfba9a_r.jpg&&&/figure&&p&&br&&/p&&p&然后触发条件,选择Notification,推送的内容,可以设置一些预设的变量函数,包含我们给这个事件声明的名字Event Name,也可以包含我们传过去的 Value 值。&/p&&p&&br&&/p&&figure&&img src=&https://pic3.zhimg.com/v2-34c64b1c7c01bbaa4aac86_b.png& data-rawwidth=&1022& data-rawheight=&1046& class=&origin_image zh-lightbox-thumb& width=&1022& data-original=&https://pic3.zhimg.com/v2-34c64b1c7c01bbaa4aac86_r.jpg&&&/figure&&p&&br&&/p&&p&创建完 IFTTT 的 Applets,我们回到 HomeAssistant 测试一下。&/p&&p&在 HomeAssistant 的Developer Tools的第一个图标,然后配置如图。Data 一般是以JSON格式来传输的。&/p&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-280df36e391f07dfa60a69_b.png& data-rawwidth=&1022& data-rawheight=&1046& class=&origin_image zh-lightbox-thumb& width=&1022& data-original=&https://pic2.zhimg.com/v2-280df36e391f07dfa60a69_r.jpg&&&/figure&&p&&br&&/p&&p&点击调用后,几秒钟你的手机的 IFTTT 就会给你发来一条推送了。&/p&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-b7c6d2bcd0c2d70befb48_b.png& data-rawwidth=&616& data-rawheight=&1255& class=&origin_image zh-lightbox-thumb& width=&616& data-original=&https://pic1.zhimg.com/v2-b7c6d2bcd0c2d70befb48_r.jpg&&&/figure&&p&&br&&/p&&p&实际上,用 HomeAssistant 还能用内置的automation来调用 IFTTT,相当于内置的 IFTTT,但是支持的控件没 IFTTT 那么丰富。&/p&&h2&3.3. IFTTT 作为触发结果&/h2&&p&OK,前面是一个小的应用,最主要的还是要介绍 IFTTT 作为触发结果。&/p&&h2&3.3.1. HomeAssistant API&/h2&&p&HomeAssistant 支持丰富的 API,通俗来说,就是你访问一个网络地址就能控制你家的台灯开与关。&/p&&p&OK,地址是http://树莓派地址:8123/api/services?api_password=登陆密码,你可以看到所有 HomeAssistant 能支持的 API,抽取其中一个给大家介绍一下。&/p&&p&其中一个是关于对灯光的 API 介绍。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&{
domain: &light&,
services: {
turn_on: {
description: &Turn a light on&,
brightness: {
description: &Number between 0..255 indicating brightness&,
example: 120
color_name: {
description: &A human readable color name&,
example: &red&
entity_id: {
description: &Name(s) of entities to turn on&,
example: &light.kitchen&
rgb_color: {
description: &Color for the light in RGB-format&,
example: &[255, 100, 100]&
&/code&&/pre&&/div&&p&所以你发起一个 POST 请求,我是使用了 Mac 版的 Paw 软件来发起请求,当然你可以使用 Chrome 上面的 PostMan 扩展来做测试。&/p&&p&我请求的地址是/api/services/light/turn_on然后附上 URL 的 PARAMS 是entity_id代表要开的灯的 id,然后附上 API 调用密码api_password.&/p&&p&然后在主体 BODY PARAMS 里面写入灯光的颜色color_name,以及亮度brightness。&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&POST 192.168.1.100:8123/api/services/light/turn_on?entity_id=Gateway_Light_34ce&api_password=HaHb7890
Body Params {&color_name&:&red&,&brightness&:&50&}
&/code&&/pre&&/div&&p&&br&&/p&&figure&&img src=&https://pic1.zhimg.com/v2-964fab0c82f1e2e4aa5d4_b.png& data-rawwidth=&1120& data-rawheight=&733& class=&origin_image zh-lightbox-thumb& width=&1120& data-original=&https://pic1.zhimg.com/v2-964fab0c82f1e2e4aa5d4_r.jpg&&&/figure&&p&ha-hb-19&/p&&p&&br&&/p&&p&调用后,你家里的网关灯就会变红了,而且亮度设定在 50。&/p&&h2&3.3.2. 如果明天下雨,我的网关灯要变红&/h2&&p&流程图&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&+ - - - - - - - - - - - - - - - +
+ - - - - - - - - - - - - - - - - - -+
' HomeAssistant:
' +----------+
+----------+ '
' +-------------------+
+------+ '
' | 外面下雨
| --& | 调用事件
| ' --& ' | HomeAssistant API | --& | 灯亮
' +----------+
+----------+ '
' +-------------------+
+------+ '
+ - - - - - - - - - - - - - - - +
+ - - - - - - - - - - - - - - - - - -+
&/code&&/pre&&/div&&p&其实关于 HomeAssistant 部分,我们在3.4.1已经介绍了。现在需要介绍IFTTT设定以及IFTTT 如何调用HomeAssistant.&/p&&h2&3.3.2.1. 域名动态解析&/h2&&p&我们现在调用的 API 地址是一个局域网的地址,形如192.168.x.x,这个在广域网(互联网)是无法调用的,简单来说就是,你在公司的网络是调用不了你在家里的这台树莓派的 API 的,更何况 IFTTT。&/p&&p&所以,为了解决这个问题,你可以:&/p&&ul&&li&购买固定 IP:向宽带提供商 ISP 购买一个固定 IP,无论你如何重启路由器啊,这个IP就是能指向你家路由器,这个一般费用比较高昂,不推荐。&/li&&li&使用动态解析域名(推荐):现在一般的路由器都内置了动态解析的组件,可以把内网的某一个机器的某一个端口映射到指定的域名端口,或者整个内网机器映射到外网,推荐前者,比较安全。具体自己找方法啦&/li&&li&内网穿透:可以了解一下ngrok&/li&&/ul&&h2&3.3.2.2. IFTTT 设置&/h2&&p&在IF条件,你可以选择 IFTTT 中的Weather Underground中的Current condition changes to触发器,选择Rain。代表,如果天气预报发现你那里快要下雨了,就触发这个事件。&/p&&p&&br&&/p&&figure&&img src=&https://pic2.zhimg.com/v2-8faed6c89b9a7aebd3fbdadc96c30659_b.png& data-rawwidth=&1086& data-rawheight=&795& class=&origin_image zh-lightbox-thumb& width=&1086& data-original=&https://pic2.zhimg.com/v2-8faed6c89b9a7aebd3fbdadc96c30659_r.jpg&&&/figure&&p&&br&&/p&&p&在THEN条件,选择IFTTT的webhook:&/p&&ul&&li&请求地址URL跟我们的3.4.1中的地址一样,只是树莓派的地址和端口换成动态解析后的域名与端口。&/li&&li&请求方法METHOD选择POST,&/li&&li&传输内容类型Content Type选择application/json,&/li&&li&传输内容Body写关于灯光的详细配置,颜色变红亮度50{&color_name&:&red&,&brightness&:&50&}&/li&&li&点击Creata action进行保存&/li&&/ul&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-3c8a879c81fb3874ef33_b.png& data-rawwidth=&1086& data-rawheight=&1169& class=&origin_image zh-lightbox-thumb& width=&1086& data-original=&https://pic4.zhimg.com/v2-3c8a879c81fb3874ef33_r.jpg&&&/figure&&p&&br&&/p&&p&最后,Review一下,给这个自动化设定一个名字,下面的按钮的意思是每次出发了这个自动化,要不要给你手机的 IFTTT 发一个推送证明它发送了。&/p&&p&&br&&/p&&figure&&img src=&https://pic4.zhimg.com/v2-569fc51cfd600e8fa770c04b80eaf07f_b.png& data-rawwidth=&1086& data-rawheight=&1006& class=&origin_image zh-lightbox-thumb& width=&1086& data-original=&https://pic4.zhimg.com/v2-569fc51cfd600e8fa770c04b80eaf07f_r.jpg&&&/figure&&p&&br&&/p&&p&OK,那么整个流程到这里就算是完成搞掂了~&/p&&blockquote&其实这个流程有 1 点不太安全的是,IFTTT 的 POST 请求明文调用了树莓派的 API 密码,我研究了一下好像 IFTTT 的 Applet 只会针对个人,不对外分享,所以还算是安全。然后动态解析尽量针对端口吧,对外开放太多端口容易受到攻击,同时 API 密码请申请的高强度一下,SSH 使用密钥登陆。&/blockquote&&h2&4. 其他&/h2&&h2&4.1. 已经完全实施了上一章的读者&/h2&&p&因为上一章的完全实施,所以你已经安装了 HomeBridge-Mi-aqara,Homebridge 对于插件好像有些蜜汁互斥,所以你需要先卸载他,再按照上面的教程继续走。&/p&&p&在终端中输入&/p&&div class=&highlight&&&pre&&code class=&language-text&&&span&&/span&sudo npm uninstall -g homebridge-mi-aqara
&/code&&/pre&&/div&&h2&5. 致谢&/h2&&ul&&li&&a href=&http://link.zhihu.com/?target=http%3A//kittenyang.com/homeassistant_practice_02/& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&利用 HomeAssistant +树莓派+ Amazon Echo 的智能家居实践(二)—— 初识 HomeAssistant&/a&&/li&&/ul&&p&--------------------------------------------------------------------------------------------------------&/p&&p&&br&&/p&&p&&a href=&http://link.zhihu.com/?target=https%3A//sspai.com/column/162& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&对树莓派感兴趣?欢迎到「明明白白玩派」专栏了解更多树莓派技巧&/a&
&/p&&figure&&img src=&https://pic1.zhimg.com/v2-e9b87c5a1b232e39a6e5cb8_b.png& data-rawwidth=&697& data-rawheight=&233& class=&origin_image zh-lightbox-thumb& width=&697& data-original=&https://pic1.zhimg.com/v2-e9b87c5a1b232e39a6e5cb8_r.jpg&&&/figure&&p&&/p&&p&&/p&
本章讲一讲「高级版自动化」。你可以现在设想一下:天气预报说要下雨了,网关灯变红!如果爸爸回家,手机接入 Wi-Fi,赶紧推送告诉我不要看小视频了!只要米家 +
就可以做到!前情回顾 上一章题目是《
&p&小星认为选择原则还是从心。那就来谈谈三辆车的心(发动机)吧。&/p&&p&&br&&/p&&p&奥迪RS3&/p&&figure&&img data-rawheight=&600& src=&https://pic3.zhimg.com/v2-efaad09a0787c06_b.jpg& data-rawwidth=&800& class=&origin_image zh-lightbox-thumb& width=&800& data-original=&https://pic3.zhimg.com/v2-efaad09a0787c06_r.jpg&&&/figure&&p&↑奥迪RS3 Sportback动力总成示意图(来自&a href=&//link.zhihu.com/?target=http%3A//NetCarShow.com& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&NetCarShow.com&/span&&span class=&invisible&&&/span&&/a&)&/p&&p&&br&&/p&&figure&&img data-rawheight=&1030& src=&https://pic1.zhimg.com/v2-ffa0d26a2bc85b184cbcc_b.jpg& data-rawwidth=&1800& class=&origin_image zh-lightbox-thumb& width=&1800& data-original=&https://pic1.zhimg.com/v2-ffa0d26a2bc85b184cbcc_r.jpg&&&/figure&&p&↑奥迪RS3 Sportback直列五缸发动机加四驱系统(来自&a href=&//link.zhihu.}

我要回帖

更多关于 关于违章建筑投诉范文 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信