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

 找回密码
 立即注册
查看: 1038|回复: 0

[流程系列] 请教如何将多个传感器集成为一个设备或服务

[复制链接]

8

主题

66

帖子

907

积分

高级会员

Rank: 4

积分
907
金钱
841
HASS币
0
发表于 2022-7-24 01:58:56 | 显示全部楼层 |阅读模式
本帖最后由 xiongmx 于 2022-7-24 01:58 编辑

根据论坛里兄弟发的nr流,做了一些小修改,现在只实现了能直接在ha里添加实体。请教大神能否做成一个设备或者服务内直接包含这几个传感器,便于批量管理。
下载 (1).png 下载.png


[{"id":"07a33cd600b79e02","type":"tab","label":"油价","disabled":false,"info":""},{"id":"6af49f6f16213e15","type":"http request","z":"07a33cd600b79e02","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://www.qiyoujiage.com/sichuan.shtml","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"headers":[],"x":360,"y":340,"wires":[["66f0d39ed880936d","8c881ab0c92ed3b7","2eef6a5039befed7"]]},{"id":"ee2298956fa4bdde","type":"inject","z":"07a33cd600b79e02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"14400","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":340,"wires":[["6af49f6f16213e15"]]},{"id":"66f0d39ed880936d","type":"html","z":"07a33cd600b79e02","name":"","property":"payload","outproperty":"payload","tag":"#youjia > dl","ret":"text","as":"single","x":570,"y":340,"wires":[["f00af6f29d2b825c"]]},{"id":"f00af6f29d2b825c","type":"split","z":"07a33cd600b79e02","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":730,"y":340,"wires":[["64fc01b51ddf4a16"]]},{"id":"64fc01b51ddf4a16","type":"switch","z":"07a33cd600b79e02","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"92#","vt":"str"},{"t":"cont","v":"95#","vt":"str"},{"t":"cont","v":"98#","vt":"str"},{"t":"cont","v":"0#","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":910,"y":340,"wires":[["5ab282238b732cc3"],["d2fe7348882485c5"],["4e2f3a09d477dbf1"],["59e89adfa891d85d"]]},{"id":"5ab282238b732cc3","type":"split","z":"07a33cd600b79e02","name":"","splt":"\\n","spltType":"str","arraySplt":"4","arraySpltType":"len","stream":true,"addname":"topic","x":1090,"y":280,"wires":[["b9a195ccabcb9b26"]]},{"id":"b9a195ccabcb9b26","type":"switch","z":"07a33cd600b79e02","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^\\d+(\\.\\d+)?$","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":1250,"y":280,"wires":[["205378a1cfb31ac6"]]},{"id":"205378a1cfb31ac6","type":"change","z":"07a33cd600b79e02","name":"","rules":[{"t":"set","p":"92#","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":280,"wires":[["d70b897df9a128c6"]]},{"id":"d2fe7348882485c5","type":"split","z":"07a33cd600b79e02","name":"","splt":"\\n","spltType":"str","arraySplt":"4","arraySpltType":"len","stream":true,"addname":"topic","x":1090,"y":320,"wires":[["8ba71cfd7c9e1d44"]]},{"id":"8ba71cfd7c9e1d44","type":"switch","z":"07a33cd600b79e02","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^\\d+(\\.\\d+)?$","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":1250,"y":320,"wires":[["532019ac530a867d"]]},{"id":"532019ac530a867d","type":"change","z":"07a33cd600b79e02","name":"","rules":[{"t":"set","p":"95#","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":320,"wires":[["7018c99dc02f272a"]]},{"id":"4e2f3a09d477dbf1","type":"split","z":"07a33cd600b79e02","name":"","splt":"\\n","spltType":"str","arraySplt":"4","arraySpltType":"len","stream":true,"addname":"topic","x":1090,"y":360,"wires":[["3b0d072ea2a3c9c9"]]},{"id":"3b0d072ea2a3c9c9","type":"switch","z":"07a33cd600b79e02","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^\\d+(\\.\\d+)?$","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":1250,"y":360,"wires":[["a8725bcab6c0d571"]]},{"id":"a8725bcab6c0d571","type":"change","z":"07a33cd600b79e02","name":"","rules":[{"t":"set","p":"98#","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":360,"wires":[["fb739edd9fbc1693"]]},{"id":"59e89adfa891d85d","type":"split","z":"07a33cd600b79e02","name":"","splt":"\\n","spltType":"str","arraySplt":"4","arraySpltType":"len","stream":true,"addname":"topic","x":1090,"y":400,"wires":[["6c125b96edd191ea"]]},{"id":"6c125b96edd191ea","type":"switch","z":"07a33cd600b79e02","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^\\d+(\\.\\d+)?$","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":1250,"y":400,"wires":[["9aec44ec23bebe14"]]},{"id":"9aec44ec23bebe14","type":"change","z":"07a33cd600b79e02","name":"","rules":[{"t":"set","p":"0#","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":400,"wires":[[]]},{"id":"8c881ab0c92ed3b7","type":"html","z":"07a33cd600b79e02","name":"","property":"payload","outproperty":"payload","tag":"#youjiaCont > div","ret":"text","as":"single","x":590,"y":540,"wires":[["ad32e359c40f8d83"]]},{"id":"ad32e359c40f8d83","type":"change","z":"07a33cd600b79e02","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[1]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":540,"wires":[["3acab583718d1167"]]},{"id":"3acab583718d1167","type":"split","z":"07a33cd600b79e02","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1050,"y":540,"wires":[["9211569ea5c6a4f5"]]},{"id":"9211569ea5c6a4f5","type":"join","z":"07a33cd600b79e02","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1250,"y":540,"wires":[["1cb51f7d32215267"]]},{"id":"1cb51f7d32215267","type":"change","z":"07a33cd600b79e02","name":"","rules":[{"t":"set","p":"tips","pt":"global","to":"payload[2]","tot":"msg"},{"t":"set","p":"state","pt":"global","to":"payload[1]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1460,"y":540,"wires":[["f0bd652308811ced","393a5a693e28f160"]]},{"id":"1c56c1235bdfa3b6","type":"inject","z":"07a33cd600b79e02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"01 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":420,"wires":[["6af49f6f16213e15"]]},{"id":"d70b897df9a128c6","type":"ha-entity","z":"07a33cd600b79e02","name":"92","server":"dcb30a06.79df08","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"92#"},{"property":"device_class","value":"youjia"},{"property":"icon","value":"mdi:gas-station"},{"property":"unit_of_measurement","value":"元"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"92#","stateType":"global","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? "on": "off"","outputPayloadType":"jsonata","x":1670,"y":280,"wires":[[]]},{"id":"393a5a693e28f160","type":"ha-entity","z":"07a33cd600b79e02","name":"预估","server":"dcb30a06.79df08","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"预估"},{"property":"device_class","value":"youjia"},{"property":"icon","value":"mdi:barrel"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"tips","stateType":"global","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? "on": "off"","outputPayloadType":"jsonata","x":1670,"y":540,"wires":[[]]},{"id":"f0bd652308811ced","type":"ha-entity","z":"07a33cd600b79e02","name":"下次调整时间","server":"dcb30a06.79df08","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"下次调整时间"},{"property":"device_class","value":"youjia"},{"property":"icon","value":"mdi:calendar"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"state","stateType":"global","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? "on": "off"","outputPayloadType":"jsonata","x":1640,"y":460,"wires":[[]]},{"id":"7018c99dc02f272a","type":"ha-entity","z":"07a33cd600b79e02","name":"95","server":"dcb30a06.79df08","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"95#"},{"property":"device_class","value":"youjia"},{"property":"icon","value":"mdi:gas-station"},{"property":"unit_of_measurement","value":"元"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"95#","stateType":"global","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? "on": "off"","outputPayloadType":"jsonata","x":1670,"y":320,"wires":[[]]},{"id":"fb739edd9fbc1693","type":"ha-entity","z":"07a33cd600b79e02","name":"98","server":"dcb30a06.79df08","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"98#"},{"property":"device_class","value":"youjia"},{"property":"icon","value":"mdi:gas-station"},{"property":"unit_of_measurement","value":"元"},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"98#","stateType":"global","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? "on": "off"","outputPayloadType":"jsonata","x":1670,"y":360,"wires":[[]]},{"id":"198e8dbaebe867cc","type":"ha-entity","z":"07a33cd600b79e02","name":"最后更新日期","server":"dcb30a06.79df08","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"最后更新日期"},{"property":"device_class","value":"youjia"},{"property":"icon","value":"mdi:calendar-sync-outline"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"myymd","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? "on": "off"","outputPayloadType":"jsonata","x":1640,"y":220,"wires":[[]]},{"id":"2eef6a5039befed7","type":"simpletime","z":"07a33cd600b79e02","name":"","mydate":true,"myymd":true,"myyear":true,"mymonth":true,"mymonthn":true,"mydom":true,"mydoy":true,"myday":true,"myhourpm":true,"myhour":true,"mytime":true,"mytimes":true,"myminute":true,"myminutes":true,"mysecond":true,"mymillis":true,"myepoch":true,"myrawdate":true,"mypm":true,"x":570,"y":220,"wires":[["198e8dbaebe867cc"]]},{"id":"dcb30a06.79df08","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]




回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 11:22 , Processed in 1.097533 second(s), 26 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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