Jump to content

Addition of "Control Switched Any"


tjkintz

Recommended Posts

Posted

As background, refer to https://forum.universal-devices.com/topic/23461-do-something-if-device-is-on-for-x-minutes/

and optionally https://forum.universal-devices.com/topic/23461-do-something-if-device-is-on-for-x-minutes/.

 

Issue:

Conceptually the pseudo program

If control switched On

Then

do something

else

do something else

 

would execute the else clause if a key/paddle press occurred other than an On. However that is not the case. This program will run if and only if the On key/paddle is pressed because that is all that is being tested for. Since it will not even run for any other key press, the else clause will never run. To get it to run one would have to add 8 Or statements to catch all the possibilities of control

 

Suggestion:

Add a Control Switched Any. This would enable the program to run if "the paddle or key is touched".

 

The program would then become:

If Control Switched Any

And control switched On

then

do something

else

do something else

 

This would result in the program running for all key press and the else clause would execute based on the program logic. After all, if the program won't run, it doesn't matter what the logic is. 

 

Advantages:

1) No existing program would be effected because they do not test for control switched any.

2) There would be no additional system overhead which would be the case if, as an alternative, any program testing specific controls was invoked for other key presses too. Not to mention the side effects of running those programs unexpectedly.

3) Programs would be simpler to write and more intuitive. I am an experienced programmer and it has taken me a fair amount of time to realize the first example would not work as expected and why it wouldn't. Also there is no easy way to copy the nine lines of code currently needed to catch all the possibilities of control to other programs. I have enough devices that that could be about 50 programs. That is a lot of lines of code to manually enter.

 

My request to UDI is threefold:

1) On a scale of 0 to 10, with 0 being trivial and 10 being extremely difficult, how difficult would it be to add Control Any?

2) If added, would my second example actually execute as expected?

3) If easy to do and it accomplishes my goal, what are the chances it will be done and when?

 

Posted

Hi tjkintz

Issue:

Conceptually the pseudo program

If control switched On

Then

do something

else

do something else

 

would execute the else clause if a key/paddle press occurred other than an On.

This is NOT true. The ELSE will never run in the program you listed.

 

With kind regards,

Michel

Posted

As background, refer to https://forum.universal-devices.com/topic/23461-do-something-if-device-is-on-for-x-minutes/

and optionally https://forum.universal-devices.com/topic/23461-do-something-if-device-is-on-for-x-minutes/.

 

Issue:

Conceptually the pseudo program

If control switched On

Then

do something

else

do something else

 

would execute the else clause if a key/paddle press occurred other than an On. However that is not the case. This program will run if and only if the On key/paddle is pressed because that is all that is being tested for. Since it will not even run for any other key press, the else clause will never run. To get it to run one would have to add 8 Or statements to catch all the possibilities of control

 

Suggestion:

Add a Control Switched Any. This would enable the program to run if "the paddle or key is touched".

 

The program would then become:

If Control Switched Any

And control switched On

then

do something

else

do something else

 

This would result in the program running for all key press and the else clause would execute based on the program logic. After all, if the program won't run, it doesn't matter what the logic is. 

 

Advantages:

1) No existing program would be effected because they do not test for control switched any.

2) There would be no additional system overhead which would be the case if, as an alternative, any program testing specific controls was invoked for other key presses too. Not to mention the side effects of running those programs unexpectedly.

3) Programs would be simpler to write and more intuitive. I am an experienced programmer and it has taken me a fair amount of time to realize the first example would not work as expected and why it wouldn't. Also there is no easy way to copy the nine lines of code currently needed to catch all the possibilities of control to other programs. I have enough devices that that could be about 50 programs. That is a lot of lines of code to manually enter.

 

My request to UDI is threefold:

1) On a scale of 0 to 10, with 0 being trivial and 10 being extremely difficult, how difficult would it be to add Control Any?

2) If added, would my second example actually execute as expected?

3) If easy to do and it accomplishes my goal, what are the chances it will be done and when?

Not going to work.

 

You cannot have two logic trigger conditions in one If section ever become true at the same time.

 

When 'Switched Any' calls the ISY logic engine to evaluate Swicthed On is never true and vice versa.

 

Else would always run from 'any' and On events. This is classic behaviour from event based programming languages, not just ISY. I have worked with a few,

 

 

The 'any' idea sounds good but what would it include from the three different mechanical sources?

  • All commands only from the upper On pushbutton,
  • All command from both On and Off pushbuttons, or
  • All commands from the On, Off pushbuttons, and the dimmer status electronics?

 

'Any' is easy enough to duplicate with Boolean logic by most programmers for only three/six different possibilities.

  • If
  • ....Control XXX is Switched 'On'
  •  
  • ....OR
  • ....Control XXX is Switched 'On'
  • ....OR
  • ....Control XXX is Switched' Fast On'
  • ....OR
  • ....Control XXX is Switched 'Brighten'
  •  
  • Then

 

To sense states of the dimmer it only take ones line

  • If
  • ....Status of XXX >= 0 %

 

but that would not be a human created event.

Posted

Hi tjkintz

This is NOT true. The ELSE will never run in the program you listed.

 

With kind regards,

Michel

 

I don't think you appreciated what he was saying.

 

 

The program would then become:

If Control Switched Any

And control switched On

then

do something

else

do something else

 

 

 

The point here is to have a 'control switched any' option.  So that any physical action on the switch is a trigger.  Then that can be "and'ed" to whatever you are interested in.

 

Currently we have to go through the tedious process of

 

(control switched on

or

control switched off

or

control switched fast on

or

control switched fast off

or

control switched fade up

or

control switched fade down)

and

whatever else

 

 

Conceptually:

The switch was touched

And

something else

Then

do this

Else

do that

 

 

PS: what the heck is difference between fade up and brighten/fade down and dim?  And I assume fade stop is just something that is always preceded by a fade up/down?

Posted

larryllix

 

 

You cannot have two logic trigger conditions in one If section ever become true at the same time.

 

 

Wouldn't the following work? It seems to have two logical triggers in one section. (No,  it isn't anything anyone would likely do)
 
If control switched fade up
and status is 15%
Then
set switch off
else
set switch 100%
 
Besides, aren't all the or conditions you or apostolakisl listed multiple logical triggers?
 
Yes,  Any can be duplicated with a bunch of Or's but that does not meet my definition of easy, not to mention doing that in about 50 programs. That was why I was suggesting Any; to avoid all those Or's. 
 
I think apostolakisl understands what I am suggesting and why. The intent is that Any would get the programming running for any physical key press; top of paddle or bottom of paddle regardless of press duration. Currently a program will only run for the key presses explicitly tested for and if there is a clause to handle any other type of key press, it will never get executed. Any is intended to address that without coding all those Or's.
 
I don't see that Any has anything to do with the electronics; it isn't intended to. I understand that the electronics would be handled by testing status. 
 
I have no idea how ISY works internally and maybe Any wouldn't work but that was I asked for an estimate of the difficulty.
Posted

The issue might be

 

That "any" includes all "control" possibilies (hidden but still there)

 

If you "and" that to . .. say. .  control not switched on   . . .perhaps that is an issue.  Both the any statement and the control not switched on would be simultaneous triggers.

Posted

TEST

New Program - [ID 014A][Parent 0093]

If
        (
             'Kitchen / Kitchen-Over Sink L' is switched On
          Or 'Kitchen / Kitchen-Over Sink L' is switched Off
          Or 'Kitchen / Kitchen-Over Sink L' is switched Fast On
          Or 'Kitchen / Kitchen-Over Sink L' is switched Fast Off
          Or 'Kitchen / Kitchen-Over Sink L' is switched Fade Up
          Or 'Kitchen / Kitchen-Over Sink L' is switched Fade Down
        )
    And 'Kitchen / Kitchen-Over Sink L' is not switched Off
 
Then
        $true += 1
 
Else
        $false += 1
 


This program works as exptected.

 

So I see no reason that you can't have a "shortcut" 'control switched any' statement that autmatically puts all those options in.

 

They all run true except switching off, which runs false as you would expect.

Posted

I would think this would work for 'Control Any' triggering:

 

aaaaaaaTest - [ID 02B7][Parent 0001]

If
        Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off
     Or Control 'Main / Kitchen / Dinette (near Vestibule)' is switched Off
 
Then
        Resource 'Pushover - M - TEST - True'

But for me it's only triggering on paddle off. Not fast-off, on, fast-on or dimming...

Posted

I tried to explain this in my previous posts but I will try a different angle maybe..

 

 

Consider these ANDed triggered logic statements

 

If

....Control XXX is switched 'On'

AND

...Control YYY is switched 'On'

 

When ISY receives a signal 'On' from device XXX it will evaluate the logic statements.

It will find the XXX logic line true, and the YYY logic line False. Net result True and False = False

 

When ISY receives a signal 'On' from device YYY it will evaluate the logic statements.

It will find the YYY logic line true, and the XXX logic line False. Net result False and True = False

 

Since only one even can be processed at any one point in time the net logic result will always be False, always running Else.

 

If only one trigger is a combination trigger/status logic element it can work. Control / Switched are only event triggered elements and can never be simultaneous.

 

 

Making any more sense? :)

 

This stuff drives experienced linear programmers crazy. VB used event driven logic but object events were could never clash like this by natural language style so it went unnoticed..

 

 
Posted

I would think this would work for 'Control Any' triggering:

 

aaaaaaaTest - [ID 02B7][Parent 0001]

If
        Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off
     Or Control 'Main / Kitchen / Dinette (near Vestibule)' is switched Off
 
Then
        Resource 'Pushover - M - TEST - True'

But for me it's only triggering on paddle off. Not fast-off, on, fast-on or dimming...

This tries to run Then and Else from the same trigger event.

 

Any smoke come out of the back of your ISY? 

  • "Computer! Calculate Pi to infinite places! :)
Posted

I keep thinking that ‘if Control switchx’ is the trigger, and then ‘is switched on’ is a test (resulting in a then or else). I keep forgetting that it only triggers at all on being switched on - resulting in this threads feature request... and that triggering ‘Else’ is not possible unless there is another condition to trigger on ‘off’ but evaluate to false “is not switched off”.

Posted

I would think this would work for 'Control Any' triggering:

 

aaaaaaaTest - [ID 02B7][Parent 0001]

If
        Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off
     Or Control 'Main / Kitchen / Dinette (near Vestibule)' is switched Off
 
Then
        Resource 'Pushover - M - TEST - True'

But for me it's only triggering on paddle off. Not fast-off, on, fast-on or dimming...

 

The behavior you see is correct.  It should not trigger on anything but switched off.

Posted

 

This tries to run Then and Else from the same trigger event.

 

Any smoke come out of the back of your ISY? 

  • "Computer! Calculate Pi to infinite places! :)

 

Nothing can be true and false.

 

Any line connected to another line by an "and" requires all lines be true or the whole thing is false.

 

If multiple lines are connected by "or", then only one line needs to be true and the whole thing is true.

 

The entire "if" only comes to one conclusion after it is evaluated in its entirety.  

Posted

Nothing can be true and false.

 

Any line connected to another line by an "and" requires all lines be true or the whole thing is false.

 

If multiple lines are connected by "or", then only one line needs to be true and the whole thing is true.

 

The entire "if" only comes to one conclusion after it is evaluated in its entirety.  

Yes but this line

  • Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off

is an ISY logic stretch. It can only evaluate to False and never be True.

The usual boolean logic rules do not apply, in some cases, to running Then and Else with the real-time trigger aspect.

 

 

 

In standard boolean logic

  • Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off

would be triggering the Then section any time the paddle was not being pushed down. The Then section would be triggering constantly in a tight loop that would cause ISY to permanently hang.

Posted

 

 

 

 

In standard boolean logic

  • Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off

would be triggering the Then section any time the paddle was not being pushed down. The Then section would be triggering constantly in a tight loop that would cause ISY to permanently hang.

 

Here is your mistake.  It is not triggering any time the paddle-off IS NOT pushed.  It is triggering ONLY when the paddle-off IS pushed.  The "not" only changes the outcome of the evaluation from true to false (for that single line).

 

The only concern I had with ISY and the presence of two identical control triggers is if ISY would trigger the if clause twice.  It does not.  Therefore, once triggered, the standard line by line evaluation occurs and comes to a single conclusing.

Posted

Here is your mistake.  It is not triggering any time the paddle-off IS NOT pushed.  It is triggering ONLY when the paddle-off IS pushed.  The "not" only changes the outcome of the evaluation from true to false (for that single line).

 

The only concern I had with ISY and the presence of two identical control triggers is if ISY would trigger the if clause twice.  It does not.  Therefore, once triggered, the standard line by line evaluation occurs and comes to a single conclusing.

There is no mistake.. 

 

With other logic

  • If  A =/= 5

Any time A changes value to anything other than 5,  the statement is True  If A's value becomes 5 then the  statement is False

 

 

In ISY event basic boolean logic with 

  • If Control XXX is Not switched On

the statement is 99.999% of the time True but does NOT  run Then, as I stated  above.

 

Same logic presentations. Different logic rules.

Posted

Larryllix,

 

I don't think apostolakisl is disagreeing with this.  He seemed only to be questioning your statement about "triggering the Then section any time the paddle was not being pushed down" (with emphasis on the TRIGGER).   It was only a question about the trigger event, not about the Boolean logic results of the condition.  This whole discussion, in my mind, seems to be based on the trigger event, not the logical conclusions once triggered.

Posted

There is no mistake.. 

 

With other logic

  • If  A =/= 5

Any time A changes value to anything other than 5,  the statement is True  If A's value becomes 5 then the  statement is False

 

 

In ISY event basic boolean logic with 

  • If Control XXX is Not switched On

the statement is 99.999% of the time True but does NOT  run Then, as I stated  above.

 

Same logic presentations. Different logic rules.

The mistake is the word "trigger".  You are conflating status with trigger.

Larryllix,

 

I don't think apostolakisl is disagreeing with this.  He seemed only to be questioning your statement about "triggering the Then section any time the paddle was not being pushed down" (with emphasis on the TRIGGER).   It was only a question about the trigger event, not about the Boolean logic results of the condition.  This whole discussion, in my mind, seems to be based on the trigger event, not the logical conclusions once triggered.

Yeah.  Sorry replied before reading your response.

Posted

Here let me repeat with emphasis.

 

"In standard boolean logic

  • Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off

would be triggering the Then section any time the paddle was not being pushed down. The Then section would be triggering constantly in a tight loop that would cause ISY to permanently hang."

Posted

Here let me repeat with emphasis.

 

"In standard boolean logic

  • Control 'Main / Kitchen / Dinette (near Vestibule)' is not switched Off

would be triggering the Then section any time the paddle was not being pushed down. The Then section would be triggering constantly in a tight loop that would cause ISY to permanently hang."

OK, but I don't know why we would want to confuse the discussion with non-ISY logic.

 

In ISY, the trigger you speak of does not exist.  That is why ISY also offers the terminology

 

If status is not off.

 

The deal is that Insteon sends a specific message when a paddle is pressed.  That specific message is accessible in ISY programs as "control" and is loosely related to the status.

 

EDIT:  Perhaps ISY should name it different?

is switched on  ==>> paddle up single click

is not switched on  ====>> paddle up single click runs false

Posted

OK, but I don't know why we would want to confuse the discussion with non-ISY logic.

 

In ISY, the trigger you speak of does not exist.  That is why ISY also offers the terminology

 

If status is not off.

 

The deal is that Insteon sends a specific message when a paddle is pressed.  That specific message is accessible in ISY programs as "control" and is loosely related to the status.

 

EDIT:  Perhaps ISY should name it different?

is switched on  ==>> paddle up single click

is not switched on  ====>> paddle up single click runs false

In post #14 you posted statements that apply to regular Boolean logic, but not to ISY event triggered logic. This may have been confusing the thread.

 

I was attempting to demonstrate the differences so that some could understand why things work the way they do in ISY logic.

 

The OP was about an Switched ANY triggers   ANDed with a .Switched On trigger  which becomes useless logic in ISY programming logic.

 

The ANY request may be a valid (and good) one but the demonstrated usage was not a valid application.

 

This is a constant source of confusion and with some newbies history repeats itself.  :)

Posted

In post #14 you posted statements that apply to regular Boolean logic, but not to ISY event triggered logic. This may have been confusing the thread.

 

I was attempting to demonstrate the differences so that some could understand why things work the way they do in ISY logic.

 

The OP was about an Switched ANY triggers   ANDed with a .Switched On trigger  which becomes useless logic in ISY programming logic.

 

The ANY request may be a valid (and good) one but the demonstrated usage was not a valid application.

 

This is a constant source of confusion and with some newbies history repeats itself.   :)

ISY logic is Boolean.  I shouldn't have used the word "logic"

 

The issue here is that ISY is event based.  The whole trigger thing.  That is where conventional programmers get confused when using an ISY.

Posted

ANYWAY!!!!!

 

To get back to the requested new feature

 

CONTROL SWITCHED ANY

 

Please add it :-P

 

The logic works and it would "unclog" programs and save a lot of tedious programming repetition.  And I kind of feel like it would not be that much of a change to the firmware.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...