『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 2046|回复: 2

[基础教程] 米家智能门锁多模网关接入ha,利用nr分离门和锁的属性

[复制链接]

14

主题

123

帖子

2034

积分

金牌会员

Rank: 6Rank: 6

积分
2034
金钱
1906
HASS币
40
发表于 2023-3-15 10:24:22 | 显示全部楼层 |阅读模式
本帖最后由 mcone 于 2023-3-15 10:24 编辑

分离效果:

微信截图_20230315102249.png


nr代码:
[{"id":"9e51144e2cf3d254","type":"group","z":"f12b4ad3531eeb96","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["1ff739c4d569d30a","73ece47df911e34e","971ffb237cee0f14","f8995f468ff5ca17","5fc8cc2b0489a12a","dcf7be073f532450","223c39c190d46060","db24423c57db54dc","dd3087492a34f656","f2e6be576cce91f5","4f11ebbd969080bf","4ed693cf4ca6d0c2","1411fc1db409f2b0","2acc4eb7d1c547ca","a3dbd2c42d49c3db","dd680dedfe9fd7cb"],"x":14,"y":299,"w":1052,"h":262},{"id":"1ff739c4d569d30a","type":"server-state-changed","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"门锁","server":"9b9f41a8.34d99","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.da900df3e856_action","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":90,"y":440,"wires":[["73ece47df911e34e"]]},{"id":"73ece47df911e34e","type":"switch","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"lock","vt":"str"},{"t":"eq","v":"door","vt":"str"},{"t":"eq","v":"fingerprint","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":250,"y":440,"wires":[["971ffb237cee0f14","f2e6be576cce91f5"],["f8995f468ff5ca17"],["db24423c57db54dc"]]},{"id":"971ffb237cee0f14","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"提取锁状态","rules":[{"t":"move","p":"data.new_state.attributes.message","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":400,"wires":[["dcf7be073f532450"]]},{"id":"f8995f468ff5ca17","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"提取门状态","rules":[{"t":"move","p":"data.new_state.attributes.message","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":460,"wires":[["5fc8cc2b0489a12a"]]},{"id":"5fc8cc2b0489a12a","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"设定状态为中文","rules":[{"t":"change","p":"payload","pt":"msg","from":"Door is closed","fromt":"str","to":"门已关","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Door is open","fromt":"str","to":"门已开","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Timeout is not closed","fromt":"str","to":"门超时未关","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":460,"wires":[["4ed693cf4ca6d0c2"]]},{"id":"dcf7be073f532450","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"设定状态为中文","rules":[{"t":"change","p":"payload","pt":"msg","from":"Unlock inside the door","fromt":"str","to":"室内解锁","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Turn off anti-lock","fromt":"str","to":"解除反锁","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Turn on anti-lock","fromt":"str","to":"反锁","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Lock","fromt":"str","to":"上提把手锁门","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Unlock outside the door","fromt":"str","to":"室外解锁","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":400,"wires":[["1411fc1db409f2b0"]]},{"id":"223c39c190d46060","type":"comment","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"智能门锁拆分","info":"","x":170,"y":380,"wires":[]},{"id":"db24423c57db54dc","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"提取指纹状态","rules":[{"t":"move","p":"data.new_state.attributes.message","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":520,"wires":[["dd3087492a34f656"]]},{"id":"dd3087492a34f656","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"设定状态为中文","rules":[{"t":"change","p":"payload","pt":"msg","from":"Match successful","fromt":"str","to":"匹配成功","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":520,"wires":[["2acc4eb7d1c547ca"]]},{"id":"f2e6be576cce91f5","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"提取用户","rules":[{"t":"move","p":"data.new_state.attributes.key_id","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":340,"wires":[["dd680dedfe9fd7cb"]]},{"id":"4f11ebbd969080bf","type":"change","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"设定状态为中文","rules":[{"t":"change","p":"payload","pt":"msg","from":"11","fromt":"num","to":"主人","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":340,"wires":[["a3dbd2c42d49c3db"]]},{"id":"4ed693cf4ca6d0c2","type":"ha-sensor","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"入户门","entityConfig":"b791e085e6f5d6d6","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":970,"y":460,"wires":[[]]},{"id":"1411fc1db409f2b0","type":"ha-sensor","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"入户锁","entityConfig":"1c7c5106340f29d3","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":970,"y":400,"wires":[[]]},{"id":"2acc4eb7d1c547ca","type":"ha-sensor","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"指纹匹配","entityConfig":"92c0cf676ef1f1f5","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":980,"y":520,"wires":[[]]},{"id":"a3dbd2c42d49c3db","type":"ha-sensor","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"开门者","entityConfig":"2e73ada4824bb0be","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":970,"y":340,"wires":[[]]},{"id":"dd680dedfe9fd7cb","type":"switch","z":"f12b4ad3531eeb96","g":"9e51144e2cf3d254","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"65535","vt":"str"},{"t":"neq","v":"65535","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":340,"wires":[[],["4f11ebbd969080bf"]]},{"id":"9b9f41a8.34d99","type":"server","name":"我的家","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":false},{"id":"b791e085e6f5d6d6","type":"ha-entity-config","server":"9b9f41a8.34d99","deviceConfig":"10998214830e27e5","name":"入户门","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"入户门"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"1c7c5106340f29d3","type":"ha-entity-config","server":"9b9f41a8.34d99","deviceConfig":"10998214830e27e5","name":"入户锁","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"入户锁"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"92c0cf676ef1f1f5","type":"ha-entity-config","server":"9b9f41a8.34d99","deviceConfig":"10998214830e27e5","name":"指纹匹配","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"指纹匹配"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"2e73ada4824bb0be","type":"ha-entity-config","server":"9b9f41a8.34d99","deviceConfig":"10998214830e27e5","name":"开门者","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"开门者"},{"property":"icon","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"10998214830e27e5","type":"ha-device-config","name":"智能门锁","hwVersion":"","manufacturer":"Xiaomi","model":"小米智能门锁","swVersion":"3.6.9"}]
注释:

回复

使用道具 举报

0

主题

44

帖子

1615

积分

金牌会员

Rank: 6Rank: 6

积分
1615
金钱
1571
HASS币
0
发表于 2023-3-15 11:09:34 | 显示全部楼层
很强,正好需要门锁状态在node red做自动化。
回复

使用道具 举报

2

主题

35

帖子

728

积分

高级会员

Rank: 4

积分
728
金钱
693
HASS币
0
发表于 2023-3-15 15:48:26 | 显示全部楼层
好用,感谢!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-28 03:48 , Processed in 0.238402 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表