Author Topic: Combination Virtual switch plugin (UI5)  (Read 106803 times)

Offline davidd1205

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #15 on: June 28, 2012, 06:21:00 pm »
very very good job

my alarm work is charm with doorsensor
 :)
thanks very much ;)


Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3226
  • Karma: +180/-8
Scenario: Turn on a light when a door is opened, during certain hours
« Reply #16 on: June 29, 2012, 07:49:51 am »
In this scenario, imagine that you have a door sensor and a nearby light. When the door is opened during the evening, turn on the light. When the door is closed, turn off the light.
  • Create a Virtual Switch. Rename it Evening.
  • Create a scene. Rename it Evening start.  Add a schedule. Make the schedule Day of Week based, every day at sunset (or whenever you consider "evening" to begin). Add an action to the schedule to turn On the Evening virtual switch.
  • Create another scene. Rename it Evening end. Add a schedule. Make the schedule Day of Week based, every day at midnight (or whenever you consider "evening" to end). Add an action to the schedule to turn Off the Evening virtual switch.
  • Optional: add more schedules and triggers to these two scenes. You may have differing definitions of "evening" based on the day of the week, or you may want to add dawn times too.
  • Create a Combination Switch. Rename it Door open during evening. Go to the Configure tab
  • Add a condition to test Virtual Switch when the Evening device is On.
  • Add a condition to test Security Sensor the door sensor is Tripped while Armed.
  • Set the threshold count to 2.
  • Create a third scene. Rename it Door is opened during evening. Add a trigger on the Combination Door open during evening > Virtual Switch Status changes > Switch turns off. Add an action to the scene that turns on the light.
  • Create a fourth scene. Rename it Door is closed. Add a trigger on the door sensor device being An Armed Sensor is Tripped > Device Armed is not tripped. Add an action to the scene that turns off the light
Bypass the door sensor to stop it from controlling the light.

Tip: The asymmetry of the door-open and door-closed scenes is deliberate: the light is turned on by the combination switch, but turning off is governed by the door alone. This is to provide better behaviour if the door is still open at the end of the evening. The light stays on even after the end of the evening, until the door is finally closed.

Offline Dolphran

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +0/-0
Re: Scenario: Turn on a light when a door is opened, during certain hours
« Reply #17 on: June 29, 2012, 01:46:35 pm »
This is very cool @futzle.  I'm very glad to have Combintaion Switch in our toolbox.  I'll just point out, though, that the scenario 'Turn on a light when a door is opened, during certain hours', can be done with stock objects.  The arming/disarming of the door sensor could be done with scheduled scenes, and the light can just be triggered with the armed door sensor.

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3226
  • Karma: +180/-8
Combination Virtual switch plugin (UI5)
« Reply #18 on: June 29, 2012, 06:20:40 pm »
Haha, yes, if all you have is a hammer, everything starts to look like a nail.

It should be easy to alter the scenario so that it can't be done with stock scenes. I'll give it some thought.

For instance: you are already using the door's Armed/Bypassed status for something else in your house. Or you want to combine this with the Not-on-Vacation scenario, and test a second Virtual Switch.

Offline QNimbus

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #19 on: June 30, 2012, 06:47:13 am »
@futzle

First of all - thanks for the great and useful plugin!

I've got a feature request though ;)....

I'm using several modules around my home that have power metering capability and I would like to switch them off based on their power usage (e.g. standby killer). So far I haven't found a good and easy to configure way - I think that your combination switch might come in handy.

Is there any way you could add a parameter that checks current power usage from a device? Or is there perhaps another easy way to accomplish what I'm trying to do?

Again, thanks for the great work so far!

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3226
  • Karma: +180/-8
Combination Virtual switch plugin (UI5)
« Reply #20 on: June 30, 2012, 08:16:11 am »
QNimbus, power use is definitely on the to do list. Version 6 does this.
« Last Edit: July 05, 2012, 07:12:10 am by futzle »

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3226
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #21 on: July 05, 2012, 07:10:35 am »
Version 6 tests power consumption (watts). You can provide a range and the condition is true when the power consumption is inside that range. For open-ended tests (less than or equal; greater than or equal) leave a text box empty.

Give MCV a day or so to approve it; many of them are having a major holiday now.

QNimbus, if that's your four-star review on apps.mios.com, you'll need to edit it now. :)

Offline davidd1205

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #22 on: July 05, 2012, 11:45:33 am »
hello

have you a switch for a calendar with a event ? it's ideal no ?

thansk for your job

best regards

Offline garrettwp

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6376
  • Karma: +226/-128
  • Vera 3, Lite, ISY994
Re: Combination Virtual switch plugin (UI5)
« Reply #23 on: July 05, 2012, 11:47:13 am »
hello

have you a switch for a calendar with a event ? it's ideal no ?

thansk for your job

best regards

Why not use the google calendar switch app?

- Garrett

Offline davidd1205

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #24 on: July 05, 2012, 03:16:36 pm »
hello

have you a switch for a calendar with a event ? it's ideal no ?

thansk for your job

best regards

Why not use the google calendar switch app?

- Garrett

my scene has a event to ggogle calendar and 2 another switch and it's simplifiy with your plugin to control all the switch

Offline Dolphran

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +0/-0
Combination Switch for Toggle Function
« Reply #25 on: July 05, 2012, 03:29:35 pm »
Here's how I used the Combination switch as a toggle:
Lets say I want to toggle a light on and off on each press of a scene controller button.
Let's call the light LightToBeToggled
Let's call the scene controller button SCB
Create Two Combination Switches - IsOff and IsOn
IsOff is set to be ON when the LightToBeToggled is OFF
IsOn is set to be ON when the LightToBeToggled is ON
Create Two Scenes - LTBTOn and LBTBOff
LTBTOn Turns on LightToBeToggled and is Triggered by Combination Switch IsOff being On
LTBTOff Turns off LightToBeToggled and is Triggered by Combination Switch IsOn being On
Now create a scene called ToggleLight
ToggleLight activates the Trigger button of BOTH IsOn and IsOff
ToggleLight is Triggered by SCB being pressed.

Now every press of SCB toggles the light. 

I actually added another virtual switch EnableToggle, which is an AND condition in both IsOn and IsOff,  This allows me to disable the toggle behavior.

Note that there is a race condition here which means that another possible outcome of this logic is the light continually blinking on and off.  Since this doesn't happen I assume that all triggers are evaluated before any scenes are activated.  This could change in a future rev of Vera, and this setup would stop working.  (I'm using UI5 1.5.408)

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3226
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #26 on: July 05, 2012, 05:34:05 pm »
Hi Dolphran,

Thanks for posting that example.  It's exactly the kind of thing that I'm trying to do with the Combination Switch.  I'll stick a link to your post from the index (third) post of this thread.

Users might find they are able to get away with only one Combination Switch in this scenario, using the "Triggered while switch is off" event, if they don't want to copy the Enable Toggle feature.

Edit: second paragraph.
« Last Edit: July 05, 2012, 05:39:27 pm by futzle »

Offline gbeeton

  • Sr. Newbie
  • *
  • Posts: 30
  • Karma: +1/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #27 on: July 06, 2012, 02:07:15 am »
Thanks for the great plugin!  It has enabled me to do something I've been wanting to do for some time.  I have numerous schedules set up for numerous devices (mostly lights and shades) to make the house look lived in when we are away.  But when we're home those schedules can be a bit annoying so they get turned off.  It can be a bit tedious enabling/disabling a few tens of schedules every time we go away/return.

Your plugin has enabled me to create one "Vacation Mode" virtual switch that turns all of the vacation schedules on or off with one click.  (I borrowed the idea from your example scenario to turn on a light on when a door is opened during certain hours - so thanks for that too.)  I have set my system up so that each scheduled event activates a virtual switch for that event.  Then I set up combination virtual switches which look for each scheduled virtual switch and the master "Vacation Mode" virtual switch to both be on.  That then is used as triggers for the scenes to activate the lights/shades.  Works slick.

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3226
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #28 on: July 06, 2012, 05:43:13 am »
Version 7 can do conditions that depend on temperature sensors, even fractional and (you'll have to test this for me) negative values.  I imagine that it also works on the temperature field of the Google Weather plugin.

Now... a favour please. I know you Northerners like your thermostats.  What sorts of comparisons involving thermostats have you found yourselves needing to write Luup code for?  (Here there is a grand total of one Z-Wave thermostat on the market, and it's not compatible with most gas central heaters on sale here, mine included.)

Online Brientim

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2492
  • Karma: +77/-7
Re: Combination Virtual switch plugin (UI5)
« Reply #29 on: July 06, 2012, 06:10:27 am »
(Here there is a grand total of one Z-Wave thermostat on the market, and it's not compatible with most gas central heaters on sale here, mine included.)
@futzle, I thank you for this device and believe all the requests display how useful and dynamic this is. By the way, the one thermostat you are more than likely referring too is actually compatible with most our central gas heaters, but requires a separate power supply. This is the same for several wifi models. However, none are compatible with evaporative cooler and therefore, no good during summer. I believe this will explain http://forum.micasaverde.com/index.php?topic=786.0
« Last Edit: July 06, 2012, 06:31:25 am by Brientim »