Join Patrick Stuart once again, where he will be live coding SmartApps and DeviceTypes in the IDE using SmartThings. This episode will be broadcast from the new Stuarttech Studios. Special Guests may join throughout the session. Use the comments section on the Youtube page to ask any questions.
If you would like to be part of the broadcast, please send me a private message. We may try to put in a hangouts session into our new livestream studio, or try the remote interview feature (requires chrome browser only, using RTC)
This week, we will tackle improving an existing deviceType and maybe some other topics.
If you want me to code something specific, please don’t hesitate to ask.
@jodyalbritton I think I’ll try to set up github integration by following the documentation. I think a good git demo is in order.
Maybe we can push up the code for the group of switches but only one switch can be on at any time SmartApp and DeviceType.
This might be a bit trickier then it appears.
I don’t believe most of the physical zwave and zigbee switches can be separated from the load, so if a switch is on, the load will be carried to the bulb or outlet.
Easy to do with virtual switches, but the best I could do is that if one switch is on, then any attempt to turn on another switch would then turn it off, or the others off?
Maybe @Keo can expand on how he wants this to work a bit to see if it is possible.
I would like to have only one switch on at a time. So in a set of 3 switches:
Switch 1: on, Switch 2: off, Switch 3: off
If Switch 2 turns on:
Switch 1: off, Switch 2: on, Switch 3: off
if Switch 3 turns on:
Switch 1: off, Switch 2: off, Switch 3: on
Initial state: I guess all off is fine, However, if there are switches on and the app is reloaded is there anyway to maintain the current state?
A singularity? I had the same question. A more likely possibility is two people hitting a switch at the same time. I think you might want to build a certain amount of delay into the mechanism. This would allow for checks on each switch. And you could randomize the delay a bit to keep switches from stepping on each other. Whatever switch is pressed needs to pause and check the other two switches, then turn the one that is on - off.
Simple pseudo code.
if all the switches that are not me are off
turn me on
else
random delay
which switch is on
turn that switch off
turn me on
end
I’m not sure what you mean here. If you mean you preserve the state when the app is reloaded, yes, it should use the app logic.
I see what you’re saying here. I’d be entirely fine with having one switch be a priority switch. This way if multiple switches were turned on at the same time, the priority switch would take precedence over all of the others. Does that make sense?
Define a priority switch, this will be switch one.
Define other switches 1-X
On start or update of smartApp, if any switches are on, keep them on.
On state change of any subscribed to switch.on, turn all other switches off.
Bonus points if we check for all subscribed switches against priority switch. If priority switch was turned on and another switch was turned on since last event, keep priority switch on and turn others off.
Does that solve the issues?
Now we just need a name for this SmartApp… I’m thinking something like, “No Light for You.”
How about Aether - I believe he’s the Greek god of atmosphere and light. Lol
One last thing. Can we postpone this one until next week? My wife is going out and I’ll be watching a 9 week old and a 4 year old. Chances are I won’t be able to focus on the call.
Unfortunately, I have work tomorrow and will not be in attendance .
Here’s an idea for a future project, not sure if possible:
Merge the device type of a motion detector and a presence sensor. If motion is detected, it will emulate a presence sensor. Essentially a room presence detector.