求问如何如何将多个布尔输入值用“且”将他们合成1个输出
如题,nodered中我有3个输入的布尔值,我想当3个都是true(不一定是真的布尔,就是比如数值>某个值)的时候激活实体,请问我该怎么实现呢?没用过NR。 HA里面可以用template sensor产生你各种运算得出来的传感器。
template:
- binary_sensor:
- name: "Downstairs Heating Required"
state: >
{{ ((states.climate.kitchen.attributes.temperature >
states.climate.kitchen.attributes.current_temperature )and
(states.climate.kitchen.state != 'off') ) or
((states.climate.living_room.attributes.temperature >
states.climate.living_room.attributes.current_temperature )and
(states.climate.living_room.state != 'off') ) or
((states.climate.ground_toilet.attributes.temperature >
states.climate.ground_toilet.attributes.current_temperature )and
(states.climate.ground_toilet.state != 'off') ) or
((states.climate.corridor.attributes.temperature >
states.climate.corridor.attributes.current_temperature )and
(states.climate.corridor.state != 'off') )
}}
NR我不会用函数,所以用的最土的最简单的办法,串联。 1.用&&将三个判断条件都串起来,只有当都是true的时候才返回true,否则返回false
2.关于a>b是不是能认为为true,这个我也不太清楚,但是,最简单的方法,可以判断完返回true或false,然后再去&& 梅林听风 发表于 2023-1-19 09:08
1.用&&将三个判断条件都串起来,只有当都是true的时候才返回true,否则返回false
2.关于a>b是不是能认为为t ...
您的意思是在function里面用js吗? nodered中目前想到两种方式:1.并联输入,三个条件同时输入到一个function节点,任何一个条件触发,就在funcdtion里面对三个条件做判断,同时都为真,就向下输出
2.循环计时器delay节点,在一定时间内循环,然后串联三个判断条件,这样都为真时流程向下传送. damonwe 发表于 2023-1-19 22:07
您的意思是在function里面用js吗?
页:
[1]