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

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3224
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #30 on: July 06, 2012, 07:14:48 am »
requires a separate power supply.

Indeed, in my house it's about fifty-fifty whether it's easier to run a power supply to the spot where the thermostat is, or use a nearby existing 5 V line and connect an Arduino and a DS1820 temperature sensor and an optoisolator for a relay.  Probably it'll be summer before I do anything about it, at which point I will be whinging about the aforementioned evaporative cooling.  But I digress.

Offline Brientim

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2491
  • Karma: +77/-7
Re: Combination Virtual switch plugin (UI5)
« Reply #31 on: July 06, 2012, 07:26:21 am »
requires a separate power supply.

Indeed, in my house it's about fifty-fifty whether it's easier to run a power supply to the spot where the thermostat is, or use a nearby existing 5 V line and connect an Arduino and a DS1820 temperature sensor and an optoisolator for a relay.  Probably it'll be summer before I do anything about it, at which point I will be whinging about the aforementioned evaporative cooling.  But I digress.

And other than the odd occasions we do not have the extremes of the northern... But on those days like when hit 49 c here, an automated system on an evaporative cooler would not have worked anyway. Hence the combo switch could be used.
And I am old enough to know how to use my fingers to turn things on, off, up or down.
« Last Edit: July 06, 2012, 07:28:01 am by Brientim »

Offline kiwi

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Issues with version 6.0
« Reply #32 on: July 07, 2012, 06:18:50 am »
Hi there,

I wanted to use Combination Virtual Switch plugin on my Vera 3 (1.5.408) with conditions :

- Power is at maximum 20W
- Power switch is on

All of above conditions are true (this is AND condition).

Plugins seems to work well, but when I want to use this as a trigger to switch off the plug that I monitor, it doesn't seems to work. Worse doesn't seems to notify anything.

Is there any issue / bug ?

I saw that version 7.0 seems to be in MCV process. Do you have ETA when it will be publised?

Kind regards
--
Vera3 UI5 1.5.408 -

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3224
  • Karma: +180/-8
Combination Virtual switch plugin (UI5)
« Reply #33 on: July 07, 2012, 08:42:27 am »
Plugins seems to work well, but when I want to use this as a trigger to switch off the plug that I monitor, it doesn't seems to work. Worse doesn't seems to notify anything.

Have a look at the light icon on the Combination Switch. Does it ever change from lit to unlit, or vice versa? If not, then you have inadvertently created a set of conditions that is always true, or always false.

Events occur only when the Combination Switch moves from lit to unlit, or from unlit to lit. For example, if your device is off, then it is changed to on but with power more than 20 watts, there will be no event because never were both conditions simultaneously true.

If you can describe in English what you want to do, I can see if what you have programmed the Combination Switch to do matches this. At the moment it is not at all clear to me what you are expecting.

Edit: I made a combination switch with two conditions: switch power is on, power consumption is from (blank) to 20 W, threshold = 2. It lights up as expected when I vary that device's wattage (it was a dimmer, so easy to adjust its power consumption). The combination switch icon lights up mostly as expected. More on this shortly.

Then I made a scene, triggered by Combination Switch > virtual switch status changes > switch turns on, and made it turn the light off completely. This fired as expected.

(Conjecture: you are using the events "Triggered when ..." "Poked when ...". Don't use these. Use the event "virtual switch status changes".)

So, I can confirm that events do fire, and that it's possible that your scene trigger is testing for the wrong event.

That said, I think that you need to tweak the conditions that you are using. Using the conditions in my test, I found that turning the device (the dimmed light) on from cold also caused the Combination Switch event to fire, turning it right back off again, because the Watts were less than 20. My advice is to take out the Switch Power Status check, and rely only on the power. This way the event will be caused only by the power consumption transitioning from over 20 W to under 20 W, which I assume is only going to happen while the switch is turned on anyway.

Try that and see how you go.

Quote
I saw that version 7.0 seems to be in MCV process. Do you have ETA when it will be publised?

It's out of my hands. MCV are the gatekeepers. Outside weekends, updates tend to take 0 to 48 hours. Edit: Version 7 is published.
« Last Edit: June 22, 2013, 08:39:08 pm by futzle »

Offline Brientim

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2491
  • Karma: +77/-7
Combination Virtual switch plugin (UI5)
« Reply #34 on: July 08, 2012, 04:57:07 am »
I have been in hospital for the last few days. My wife and children just visited and my wife said ref automation stuff, the kids were playing with the toaster... I'd like this to automatically turn off power after x.

This is not a problem but it got me thinking about this... I can write the script or use this. This is simple as 1. 2 3.  So I will walk my wife through this and no doubt she'll discover more and more uses as time goes on.

But the extension of this thought crossed my mind is re-education or education on best use of these setup. So now I am considering try to map the bad practices around the home that become vampires on my pocket, put the condition in to correct them eg turn tv off    when no ones is present after predetermined time then notify my family by either email or SMS where there have failed to correct the conditions specified. Tie this app in with countdown timer (I need to reserve that for the sake of education as time elapsed in their face scenario), variable container and dataMine and there are the very great and useful tools to do this with.

Thanks.
My point here is this is easy I need not do it myself and my wife is very intelligent and all I need to do is get out of her way.
« Last Edit: July 08, 2012, 05:41:54 am by Brientim »

Offline kiwi

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #35 on: July 08, 2012, 03:29:31 pm »
(...)
Try that and see how you go.

Seems after reworking all my stuff from scratch and this is working good... Thanks for your kind module !

--
Vera3 UI5 1.5.408 -

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3224
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #36 on: July 10, 2012, 06:43:48 am »
Another day, another plugin. Version 8 can test the Google Weather plugin from apps.mios.com and match the current weather condition.

Normally you will want to select a range of weather conditions (as in the screenshot here), with a threshold of 1.  To combine that with another condition ("rain or showers or storms, and also less than 10º"), use two combination switches: remember that combination switches can test other combination switches.

Offline garrettwp

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6376
  • Karma: +226/-128
  • Vera 3, Lite, ISY994
Re: Combination Virtual switch plugin (UI5)
« Reply #37 on: July 10, 2012, 06:54:22 am »
futzle,

You are on a roll!

- Garrett

Offline big517

  • Hero Member
  • *****
  • Posts: 576
  • Karma: +1/-3
Re: Combination Virtual switch plugin (UI5)
« Reply #38 on: July 10, 2012, 09:30:56 am »
Loving it.

Offline akash1221

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #39 on: July 17, 2012, 02:15:27 am »
My mind is getting warped thinking about this! Typical newb problem I assume... 

:P

So here is what i am attempting to achieve:
I have a door that leads from the garage to the interior of the house. I have door sensor on it.

I want the lights to turn on (kitchen, hallway, living room) when the sensor is triggered and its night time. I don't care if the door is armed or bypassed, just triggered. However I don't want it to turn the lights on when someone is already home.

The way I'm thinking about how to achieve the home presence is to turn on a virtual switch when the door is opened. I have a remote button that will turn off all the lights and the virtual switch when I leave home.

So here is how it should all work:
I leave home turn off all the light (this turns off the virtual switch as well).
I come home, open the door, the virtual switch gets turned on and the lights get turned on.
Go about my business, my wife opens the door to go to the garage, nothing happens because the virtual switch is on.

Is that correct? And then the magic question, how do I achieve that with the combination switch or luup code?

I would greatly appreciate any insights you could provide.

Thank you,
Akash

Offline davidd1205

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #40 on: July 20, 2012, 09:38:40 am »
hello

I have some code that does not work well since I put the combination switch

local partielactif = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Armed",46)
local mode = luup.variable_get("urn:utz-com:serviceId:GCal1","gcalval", 70)
local controle = luup.variable_get("urn:upnp-org:serviceId::SwitchPower1","Status",74)
if (partielactif == "0") and (mode == "alarmpartielle")  then
return true
else
return false
end


this code is good but this

local partielactif = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Armed",46)
local mode = luup.variable_get("urn:utz-com:serviceId:GCal1","gcalval", 70)
local controle = luup.variable_get("urn:upnp-org:serviceId::SwitchPower1","Status",74)
if (partielactif == "0") and (mode == "alarmpartielle")   and (controle == "1")then
return true
else
return false
end



have you a idea ?
« Last Edit: July 20, 2012, 09:40:12 am by davidd1205 »

Offline davidd1205

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Re: Combination Virtual switch plugin (UI5)
« Reply #41 on: July 20, 2012, 09:43:13 am »
another question

i have a sensor security in a combination swith but i would like if my sensor is not triggered for 20 minutes (a time) activate a scéne

thanks David

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3224
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #42 on: July 20, 2012, 08:39:34 pm »
Code: [Select]
local controle = luup.variable_get("urn:upnp-org:serviceId::SwitchPower1","Status",74)

There is a double colon there that looks suspiciously wrong.

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3224
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #43 on: July 20, 2012, 08:43:56 pm »
i have a sensor security in a combination swith but i would like if my sensor is not triggered for 20 minutes (a time) activate a scéne

I recommend that you use the Countdown Timer plugin for this.  Whenever the Security sensor trips, have it Restart the timer, and when the timer completes, have it activate the scene.

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3224
  • Karma: +180/-8
Re: Combination Virtual switch plugin (UI5)
« Reply #44 on: July 20, 2012, 09:14:30 pm »
I want the lights to turn on (kitchen, hallway, living room) when the sensor is triggered and its night time. I don't care if the door is armed or bypassed, just triggered. However I don't want it to turn the lights on when someone is already home.

Hi Akash,

Sorry for not replying sooner; I was on holiday and didn't have a big screen and keyboard to make a detailed reply.

This should be doable with some virtual switches and a Combination Switch.  (Also you could do it with Luup.)

I'll restate what I think your requirements are. Hopefully this matches your real requirements...

During day time, when the door opens, no lights turn on.  It doesn't matter if you are "at home" or not "at home" during the day time, the lights stay as they were (probably off).
During night time, nothing happens it you are "at home".  It doesn't matter if the door opens when you are "at home", nothing happens.
During night time AND when you are not "at home", opening the door turns on the lights.
At any time, opening the door resets the "at home" virtual switch to "on".  This is needed in case you arrive home during the daytime, and then open the door later that night. In this case you don't want any lights to come on for that second door opening.
Closing the door has no effect. It is up to you to turn off the lights manually.

  • Create a Virtual Switch, call it At Home.
  • Create a scene, call it Leaving Home. Make this scene turn the At Home virtual switch off, and all your lights off. Make your remote button activate this scene.
  • Create a Virtual Switch, call it Day time.
  • Create a scene, call it Dawn. Make this scene turn the Day time virtual switch on. Assign a schedule that happens whenever you consider day time to start (it may be a fixed time of day, or it might be sunrise, whatever you want).
  • Create a scene, call it Dusk. Make this scene turn the Day time virtual switch off. Assign a schedule that happens whenever you consider day time to stop (it may be a fixed time of day, or it might be sunset, whatever you want).
  • Create a Combination Switch, call it Away and Night. Configure the switch with two conditions: At Home is off, Day time is off. Set the threshold to 2.
  • Create a scene, call it Door opened. Make this scene turn the At Home virtual switch on, and make it press the Trigger Poke button on the Away and Night Combination Switch. Add a trigger from the door sensor: A sensor is tripped.
  • Create a scene, call it Coming Home. Make this scene turn all your lights on. Add a trigger from the Away and Night Combination Switch: Triggered Poked while virtual switch is on.
« Last Edit: June 22, 2013, 08:39:58 pm by futzle »