HomeAssistant节点(2)
操作步骤
- 导入流程样例
current state
节点演示get entities
节点演示call service
节点演示- 其它节点
参考
节点 | 说明 | 输入 | 输出(payload) |
---|---|---|---|
current state |
查询当前状态 | 可输入payload.entity_id:实体名,也可在节点中配置 | 状态值 |
get entities |
查找实体 | 仅用于启动,查询条件在节点中配置 | 状态对象 |
call service |
调用服务 | 可输入服务与数据,也可在节点中配置 | 调用的服务与数据 |
fire event |
事件触发 | 可输入事件类型与数据,也可在节点中配置 | 事件类型与数据 |
get history |
查询历史状态值 | 输入时间范围与实体名,也可在节点中配置 | 数组,包含各个状态值 |
render template |
运行模板 | 模板内容,也可在节点中配置 | 模板运行(渲染)后的输出 |
trigger:state |
event:state 节点的高级版 |
开启和关闭触发 | 状态值 |
-
流程样例
json [{"id":"52beafd.0c9aa5","type":"tab","label":"current_state","disabled":false,"info":""},{"id":"ceae909.4c51c7","type":"tab","label":"get entities","disabled":false,"info":""},{"id":"d1231bc8.c7b848","type":"tab","label":"call service","disabled":false,"info":""},{"id":"69621d87.7af904","type":"server","z":"","name":"HAChina Example","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open"},{"id":"855bb2cb.9dbb3","type":"api-current-state","z":"52beafd.0c9aa5","name":"","server":"69621d87.7af904","halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"override_payload":true,"override_data":true,"entity_id":"","state_type":"str","outputs":1,"x":438.0001449584961,"y":295.0000219345093,"wires":[["876fbdb.19f994","7a48375e.420078"]]},{"id":"876fbdb.19f994","type":"debug","z":"52beafd.0c9aa5","name":"debug输出msg.data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"data","x":801.0000457763672,"y":361.0000219345093,"wires":[]},{"id":"dce082a3.be39c","type":"inject","z":"52beafd.0c9aa5","name":"inject注入entity_id","topic":"","payload":"{\"entity_id\":\"sensor.temperature_158d00019f8b1f\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":177,"y":231.00001049041748,"wires":[["855bb2cb.9dbb3"]]},{"id":"7a48375e.420078","type":"debug","z":"52beafd.0c9aa5","name":"debug输出payload","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":808.8945159912109,"y":188.67580699920654,"wires":[]},{"id":"aecae411.153a58","type":"inject","z":"52beafd.0c9aa5","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":152.89453125,"y":457.953125,"wires":[["855bb2cb.9dbb3"]]},{"id":"b9cd81.45ff628","type":"ha-get-entities","z":"ceae909.4c51c7","server":"69621d87.7af904","name":"查询条件为空,获得所有实体","rules":[],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":450,"y":280,"wires":[["6acf8f0d.366df"]]},{"id":"6acf8f0d.366df","type":"debug","z":"ceae909.4c51c7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":760,"y":260,"wires":[]},{"id":"76cc4a4.8ccecb4","type":"inject","z":"ceae909.4c51c7","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":240,"wires":[["b9cd81.45ff628"]]},{"id":"89697c65.0cc5e","type":"ha-get-entities","z":"ceae909.4c51c7","server":"69621d87.7af904","name":"查询所有属性battery_level小于40的实体","rules":[{"property":"attributes.battery_level","logic":"lt","value":"50","valueType":"num"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":420,"y":560,"wires":[["5c06f904.b526d8"]]},{"id":"b1a4bfd2.7c0f4","type":"inject","z":"ceae909.4c51c7","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":520,"wires":[["89697c65.0cc5e"]]},{"id":"5c06f904.b526d8","type":"debug","z":"ceae909.4c51c7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":460,"wires":[]},{"id":"ef1308d1.da90d8","type":"ha-get-entities","z":"ceae909.4c51c7","server":"69621d87.7af904","name":"","rules":[{"property":"entity_id","logic":"starts_with","value":"light.","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":380,"y":820,"wires":[["4f35600d.46849"]]},{"id":"ebc42a27.c1a788","type":"inject","z":"ceae909.4c51c7","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":780,"wires":[["ef1308d1.da90d8"]]},{"id":"3fef601f.367a1","type":"debug","z":"ceae909.4c51c7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":820,"wires":[]},{"id":"5d957599.66c26c","type":"api-call-service","z":"d1231bc8.c7b848","name":"调用persistent_notification.create服务","server":"69621d87.7af904","service_domain":"persistent_notification","service":"create","data":"{\"message\":\"来自Node-RED的问候!\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":720,"y":240,"wires":[[]]},{"id":"7e69a9e1.6b12b8","type":"inject","z":"d1231bc8.c7b848","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":240,"wires":[["5d957599.66c26c"]]},{"id":"862b9ad5.c37a58","type":"api-call-service","z":"d1231bc8.c7b848","name":"打开灯","server":"69621d87.7af904","service_domain":"light","service":"turn_on","data":"{\"entity_id\":\"light.gateway_light_f0b429aa0768\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":850,"y":380,"wires":[[]]},{"id":"8ec7ae87.1a6b7","type":"api-call-service","z":"d1231bc8.c7b848","name":"关闭灯","server":"69621d87.7af904","service_domain":"light","service":"turn_off","data":"{\"entity_id\":\"light.gateway_light_f0b429aa0768\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":770,"y":540,"wires":[[]]},{"id":"1278c04c.a1727","type":"server-state-changed","z":"d1231bc8.c7b848","name":"","server":"69621d87.7af904","entityidfilter":"sensor.temperature_158d00019f8b1f","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"30","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"x":330,"y":440,"wires":[["862b9ad5.c37a58"],["8ec7ae87.1a6b7"]]},{"id":"4f35600d.46849","type":"api-current-state","z":"ceae909.4c51c7","name":"","server":"69621d87.7af904","halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":true,"override_payload":true,"override_data":true,"entity_id":"","state_type":"str","outputs":1,"x":660,"y":700,"wires":[["3fef601f.367a1"]]}]