Nothing terribly exciting but suppose I wanted to build the list programmatically? Any suggestions for a sample to look at?
The next step is if I add field to each row. The inputs could be named with the mode (eg: awayText, homeText, etc.). Would this data persist the next time I opened the app? After a reboot?
This is a pretty simplistic example. If I can understand this bit I can make what I need. I would just jump in but a power outage took out my computers and I’m stuck on an iPad. Not the best programming environment. It also looks like work has locked down our access so I can’t reach the hubs from that laptop. —sigh—
That little sequence does just what your example above does. The point is to show you some of things you can do, and there are many ways to go about this.
Supposed you want "awayText":
that could be in the above iteration as
myModes[i].toLowerCase() + "Text"
etc etc.... Look at our public repo for example apps, and Google is good at giving Groovy examples as well.
Say that I create several text inputs like myInput1, myInput2, etc. If I do something like
Log (myInput1)
I’ll get the value of the field. What if I wanted to get that value programmatically?
Log (myInput”i”)
I know that is really bad pseudo code but I hope it gets the point across. I’m pretty sure I’ve done it before but I’m pulling up nothing at the moment.
Thank you everybody. My old lighting controller was turning into spaghetti code. Now the code is very simple and everything is controlled by the child rooms. The children look like a hot mess but I can change the behavior for each room right in the child instead of adding custom code to the app.
It looks crazy but I can have completely different looks for every room based on mode. The images above say “Garage Entry” but this is closer to what the living room will look like. I’m just testing in a way that won’t break my last controller.
Right now I can assign any color or white light to any mode and there isn’t a lick of custom code for any room.
I still have a few things to finish up. Switches aren’t implemented but that should take about five minutes. Right now the only switched light is in the pantry. I also need to implement cooldown. My motion zone controller has an extra mode. When the zone is still active but the motion sensor is inactive it goes into cooldown. Most of the time it won’t do anything, except for special modes like theater. For example, when in theater mode the kitchen will be lit in colors to match the theater. When somebody enters the kitchen it will go active and brighten up the lights. Then when they leave and the motion sensors go inactive it will switch back to the theater colors.
It may be overkill but it lets me change the looks on the fly without modifying any code. I can also add or remove a mode without editing the app. For example I plan on adding two modes: gallery and guest while possibly removing some of the day modes (morning, day, evening, and night). Right now they are all using the circadian controls that works independently of this app.
Any way, thanks again for listening and lending a hand.