Optimising A Piston For Repeatability


#1

1) Give a description of the problem
Hi there.

I’m looking for some advice on how I can better design a piston for portability between properties and so on please.

I have a number of AirBNBs that I am trying to add some automation to. In a property I might have 6 internal doors as well as the external door. I have one ST routine per lock that runs when a door is unlocked and another when a door is locked.

In this case I want to be able to control switches and heating when a door unlocks or locks and have mocked up the piston with just two rooms. This has the potential of being quite a long piston with a lot of duplication and I am wondering whether there is some cleverness which I am missing which could allow me to streamline?

**4) Post a Green Snapshot of the piston![image|45x37]


#2

I would imagine that with varying properties global variables would not work for you so sticking to these local variables seems best. In and off itself it appears you have done a neat job to begin with through the use of variables. Not sure there is much more you can condense.

My only point of concern is everything from line 57 on. None of that is included in either of the two previous IF triggers so as far as I know there is nothing to trigger those functions to run.


#3

Hi there SergL

Many thanks for your reply. I think this is about as well optimised as I can make it, although with half a dozen rooms I’ll end up with a lot of variables. It’s a coin toss between that and having lots of pistons.

The reason for the successive IF THEN END statements is to set the variables only and then to have a standard set of operations for each class of device.

The main things that I am going to do:

  • Set the heating in the room which is being unlocked to 20C but only when I am renting individual rooms (when I rent the house then the heating is on the central heating control)

  • Turning some lights on in the room

  • Performing some overrides - I have a situation where, when the house is rented as a whole guests lock internal doors and are unaware of how to unlock them (RTFM issue) so I want to be able to override lock commands (sadly my locks don’t have a keypad disable option)


#4

I think the safer approach is to have more pistons because you could group each properties pistons together as well as add more instances of WebCore as needed to reduce load. It would prevent you from having to rewrite every piston and give you room to grow.

Understood about the variables but still hazy about the rest. The way that I understand your piston to work is that it will set the variables based on the two Line 34 and 46 triggers. But it will only set variables and not perform from line 57 on since there are no triggers for it. Still learning myself so if you have tested this in real life, thats great, but personally mine haven’t in this setup.


#5

Yes, I think that you are right. I had mis-designed this one as I had assumed that the If - then - end would trigger and then it would sequnetially follow steps to the end of the piston