Robust Architecture for entire house?


#1

1) Give a description of the problem
The quick summary of the problem is that I am not a software programmer… Give me hardware and I’ll figure it out, but I am starting to run into software issues for whole house control. Any given Piston makes sense to me after studying it for some time.

I have several ranging from the stupidly easy “turn on with a trigger, off after a condition is met for X time” to starting to use more and more variables, JSON requests, counters/timers, while loops, etc. So, I don’t have a specific PISTON question as much as an ARCHITECTURE question. What are the better coders doing with everything? How are you controlling devices that have several Pistons controlling them? How do you avoid race conditions and the such?

The way I see it, there are several methods of controlling a device. But this also means that there are several ways to override a device’s settings form a different piston. I’ll give an example in case my question is coming off difficult to understand.

Simple control: turn light on with motion, off after no motion for 5 minutes

Less simple: turn light on with motion, set to Color Temperature/Level that adjusts throughout the day - I have solved this with a global variable that is set in a piston that changes to CT/Level throughout the day.

Even less simple: turn on during certain Modes, Fade to CT/Level over a variable amount of time, turn back off only if some condition is met - This is where I start losing traction and spinning my wheels. I haven’t crashed yet, but I’m swerving.

Where I get lost: Take the “Even less simple” example, but now set off the Alarm in the house, which also calls the same lights and turns them, say, RED to 100%. My Alarm Piston is a completely different Piston, but do you pause the light/motion piston? Do you save the state before the Alarm? When the Alarm turns off, how do you call back the original piston or set the light to the right CT?

Are you guys using global variables for everything? Are you calling Pistons that don’t subscribe to anything as “subroutines”? Are you pausing/resuming pistons until they are needed? Are you using counters of counter=counter+1 in while loops that also override other pistons? Do you have individual pistons per function (ie light per motion) or individual pistons for devices (living room lights, that would be controlled w/ motion, notifications, alarm flashing, etc).

Sorry for the vagueness of this, but I just can’t wrap my head around how a good/robust block diagram for the house would look like. I have started having enough things that AREN’T properly in order from different pistons that I would love some advice.

Thanks!


#2

I have something kind of similar that might apply; I’ve created a “Simulated Switch” in the IDE called “Disable Circadian Lighting”. When the switch is off, my lights will automatically adjust based off a circadian lighting pattern. Certain pistons will need to override the circadian lighting, so they’ll turn “Disable Circadian Lighting” switch on, then do their thing (lights turn Red, dim, bright, whatever), then you can either have those pistons turn “Disable Circadian Lighting” back off after they’ve finished, or you can make other pistons/events turn the switch off. I’ve found it to be a pretty simple solution for me.

Hope this helps!


#3

I would love to hear more answer to this question. I’m attempting to build a whole house system, and I’m wondering what everyone else is doing.