I have read a lot of Virtual Devices (VD) but I don’t think I understand the basic things about VD.
What is it exactly used for? What does the virtual buttons do? I tried to read the GitHub-describtion, but I think I need the basic understanding of the usage.
If you can - please upload a picture of flows and a describtion.
You will be able to do a lot with virtual devices. A virtual device can be like an on/off switch.
I for example have a setting that If my oldest son is still at home an I would leave the house that normally everything would be turned of and the alarm would be activated. By settings this virtual switch on I set a variable X to on. When I leave the house the rule is that I would be away (automated by GPS) and all devices are turned off and house will be armed, but because I have a check on variable if X is on it will not be executed.
The same I do with school holidays so a variable school holiday is set to on so some flows are not automatically executed.
These were just some examples, way more is possible
Thank you for your answer!
At which point do you set the variable X to on? How does it know that your son is still in the house? Do you do anything manual in order to trigger, that the alarm should not be activated and lights off?
There would be several ways. For my situation I use the virtual on/switch in Homey app to turn this mode On/Off (Manual Action). What i basically do is that I have a flow that is triggered by the on/off of this switch. So when virtual switch is set to on set logic “X” to On and when set to OFF set “X” to Off. So when we both are away the flow AWAY would kick in, but the AND (condition) part of this Flow uses “X logic is Off” so it will not execute
The same I do with several actions using logics. Normally my window screen would open at lets say 08:00 Am but when I am on holiday this does not happen because the flow that opens the screen uses also AND away is false. This means that when I am away I have this as set as away so they will not open.
So in short:
Use virtual devices to for example manually set a logic value or initiate a flow
Set logic manually by using a virtual switch. You can also set conditions in many more ways like someone leaving, entering or even the weather conditions, use your imagination ) Use this conditions as rules in your flows. Like a motion sensor that turn on the light in the house. You might want this only to be turned on when there is motion, you are not away and the sun is gone. WHEN motion is being trigger, WHEN SUN up/down and AWAY yes/no , THEN turn on the light
I am very good at using my imagination - but to convert that to flows is a different thing
So, a Virtual Device can be used for “faking” conditions in order to “trick” the flows and what they originally was designed for?
For Logic you can use Logic or install the app “Better Logic”
FLOW1:
-WHEN Presence Person X is “left the house/area”
-THEN Logic “Home” set value to true
FLOW2:
-WHEN Presence Person X "Enters the house/area)
-THEN Logic “Home” set value to false
Flow for arming the house:
-WHEN Logic “Home” changes
-AND Logic Home is “false”
-THEN for example turn off the lights A,B,C and turn on your security system
Flow for disarming the house:
-WHEN Logic “Home” changes
-AND Logic Home is “true”
-THEN for example turn on the lights A,B,C and turn off your security system
So if you want to manipulate this when the baby sitter is watching your kids while you are away
Flow3: (You will have to create the virtual device for this) This will be an “on/off” switch in your homey app.
-When virtual device switch state changes
-AND Virtual switch is On
-THEN Logic “Babysit” = “ON”
Flow 4:
-When virtual device switch state changes
-AND Virtual switch is Off
-THEN Logic “Babysit” = “OFF”
Now you can use this by changing the flow for disarming to:
Flow for arming the house:
-WHEN Logic “Home” changes
-AND Logic Home is “false”
-AND Logic Babysit is "OFF"
-THEN for example turn off the lights A,B,C and turn on your security system
Flow for disarming the house: (this will stay the same)
-WHEN Logic “Home” changes
-AND Logic Home is “true”
-THEN for example turn on the lights A,B,C and turn off your security system
-THEN Logic “Babysit” = “OFF” (only needed if you would like to reset this when you get home automatically)
Another example: I have a virtual device called ‘on holiday’. When this is on, a lot of lflows wil behave differently. Some flows are turned off, others are activated and for the conditions are changed. Like I have less lights on at night, floor heating in the bathroom is turned off, overall heating is lowered, etc.
It also sets a sort of alarm on common devices like television sets, washing machine etc. When I’m on holiday and they are turned on, something’s wrong
I use a virtual device to represent my tv. My Philips tv only has a IR app at the moment, which I don’t prefer. So I measure energy usage (wall plug) to measure if the tv is on or off. When the power is above a certain lever, the VD is turned on. And when I ask Google to turn the tv on, it activates the VD. This in turn triggers my Sonos Beam to turn the TV on via the HDMI-cable. It works perfectly!
This also allows me to check whether the tv is on, just by checking the VD.
I use virtual devices (VD) to get google home (GH) to start a flow. Because GH (and Siri/HomeKit) “understand” VD.
So I have it set up like this
If VD is turned on (“ok google, cinema on”)
Then activate flow
When this flow is activated
Then turn the lights off, turn my projector on, lower my projector screen, and everything else you want happening at that time.
You can use a VD device as a single device to turn on or off a whole group of lights. So I have one favorite VD device which turns on my evening lights in the living room and garden. But also turning off the device turns all of them off.
One thing to add:
A flow can be triggered with the default trigger-cards ‘mode on|off’ or the custom trigger cards: ‘mode is on|off’. They work similar, but the big difference is that the custom trigger cards are not triggered when the mode is set in another flow with the action-cards ‘Set mode on|off, no trigger’.
Apparently, there was a bug initially, but now it seems to work as intended: