• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pending] IF ... THEN ... ELSE
#1
Hi Folks,

it seems, that  ELSE is not implemented?

From my Point of view this would make some Configs much simpilier, e.g.:

Code:
"IF device1.state IS connected THEN switch DEVICE device2 TO on ELSE switch DEVICE device2 TO off"
Code:
"IF device1.state IS connected THEN label DEVICE label0 TO abc ELSE label DEVICE label0 TO def"

Thanks, Alex
 
Reply
#2
That would be helpfull

now i have almost duplicate rules

If device.state IS on THEN... turn on
and
if device.state IS off THEN... turn off

The else statement would be helpful.


Not sure if it is posible but it would be helpfull if there are multiple IF statements posible.

Code:
    "rule": "IF device.state IS on THEN(
IF Remote01C13.state IS ON THEN switch DEVICE Remote01C13 TO off")
ELSE
switch DEVICE Remote01C13 TO on,
 
Reply
#3
Hi,

is there some planning about this?

I have several rules like this:

Code:
"dev-tv-check-on": {
                        "rule": "IF sonne.sun == set AND Fernseher.state == connected THEN switch DEVICE Fernsehlicht TO on",
                        "active": 1
                },
                "dev-tv-check-off": {
                        "rule": "IF Fernseher.state == disconnected THEN switch DEVICE Fernsehlicht TO off AFTER 1 MINUTE",
                        "active": 1
                },

and like to avoid using two rules. Or is there another way to do dis?
 
Reply
#4
Not at this moment. Also, because rules most of the time fail. You don't want to execute an action in these cases everytime.
 
Reply
#5
The new eventing code that i will push gradually this week will incoporate this feature.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)