Simulated Contact piston design - examples


#1

EDIT: after the below exchange, I found that I did not quite have it all figured out.
But now I do… and have changed the thread title accordingly. Getting virtual contact sensors/locks to report correctly without changing overall functionality, while being immune to accidental change, is a more detailed endeavor than I imagined. Not complex, but you have to test and account for every permutation.

Examples to follow in below posts 5 and 6.


I have a few simulated contacts in my system now. One instance is called ‘allwindows’. If the actual physical contact sensors on all my windows are closed, then allwindows shows as closed. If any one physical sensor is not closed, then allwindows shows as open.

The problem is that by accidentally tapping the ‘allwindows’ icon in the mobile app, I override that information. I no longer have any way to really know if those windows are closed.

So I’m imagining a variable reference process. Instead of the current piston setting the simulated ‘allwindows’ contact, it simply sets a variable: perhaps status=closed.

A second piston handles the actual simulated contact sensor.
Upon any change in the status variable, the piston sets the simulated sensor accordingly.
AND… any time the allwindows sensor is changed, the piston goes and compares it to the variable. If they are in sync, no action. If they are out of sync, the piston sets allwindows to the state contained in the variable.

I’d hope that could work without endless looping.


#2

Assuming your piston that sets the closed open is similar to the following:
If any of contact 1, contact 2, contact N… etc’s contact are open
Then
Set allContact to open
Else
Set allContact to closed
End if

I think you should be able to just add another IF statement below the one above

If allContact changes to closed and any of contacts are open
Then set allContact to open
Else if allContact changes to open and all of contacts are closed
Then set allContact to closed
End if

#3

Thanks, much obliged.

Turns out that you don’t even need the ‘else’ part of you do this:

If allwindows changes away from closed
And all contacts are closed
Then with allwindows do close

Tested with both open and closed simulated contacts, works correctly for both


#4

Glad you got it figured out


#5

In this example, ‘frontdoor’ is the simulated lock.

//
/* Frontdoor Virtual lock */
/
/

execute
if
Front Door Lock’s lock is locked
and
Front Door Iris Sensor’s contact is closed
then
with
Frontdoor
do
Lock;
end with;
else
with
Frontdoor
do
Unlock;
end with;
end if;

if
(
Front Door Lock’s lock is locked
and
Front Door Iris Sensor’s contact is closed
)
and
Frontdoor’s lock changes to any of unknown, unlocked, or unlocked with timeout
then
with
Frontdoor
do
Lock;
end with;
end if;

if
(
Front Door Lock’s lock changes away from locked
)
or
Front Door Iris Sensor’s contact changes away from closed
then
with
Frontdoor
do
Unlock;
end with;
end if;

if
(
Front Door Lock’s lock is any of unknown, unlocked, or unlocked with timeout
or
Front Door Iris Sensor’s contact is open
)
and
Frontdoor’s lock changes to locked
then
with
Frontdoor
do
Lock;
end with;
end if;
end execute;


#6

In this example, “Windows Office” is the simulated sensor.

//
/* Office Windows virtual contact */
/
/

execute
if
All of Office Back Window’s and Office Side Window’s contact are closed
then
with
Windows Office
do
Close;
end with;
end if;

if
Any of Office Back Window’s or Office Side Window’s contact is open
or
Any of Office Back Window’s or Office Side Window’s contact changes to open
then
with
Windows Office
do
Open;
end with;
end if;

if
Windows Office’s contact changes away from closed
and
All of Office Back Window’s and Office Side Window’s contact are closed
then
with
Windows Office
do
Close;
end with;
end if;

if
Windows Office’s contact changes away from open
and
Any of Office Back Window’s or Office Side Window’s contact is open
then
with
Windows Office
do
Open;
end with;
end if;
end execute;


#7

Feel free to create a new post in the examples section. Instead of copying the piston text and pasting that click the green camera button and upload that. People will be able to then import these pistons.


#8

Thanks… I tried that (green camera), and for some reason could not get it to work on my iPad.


#9

click the buttons twice when on ipad.