Virtual Device


#1

I’m new to setting up a home automation environment and did little with my smartthings device before coming to Hubitat. Can someone point me in the right direction on how to setup a virtual device like a switch or other virtual
Devices? I’m not sure what values to use in the fields when creating a. New virtual device. Thank you.


#2

Devices: Add Virtual Device

There's only 3 mandatory fields, marked with *

Two of them are the same as for real devices. The Name you're calling it and the driver to use.

The unique one is the Device Network Id and it's a unique ID, anything you don't already have or maybe have in the future.

ZWave uses numbers, so a pure number would be a bad choice, for example. You can use anything else, and all of us have our own naming convention/pattern. For Presence virtual devices, for example, I use "presence-" and some number. It's not like there's going to be a hundred presence sensors here so I'm likely to remember which one I created first, etc.

For the most part, I just use an abbreviated form of the Name I'm giving it.


#3

Thank you!


#4

I like to incorporate the date + 24 time as well.. something like DENSW1810150643


#5

brand new and first of many stupid questions. what is the add virtual device for?


#6

The virtual device you are most likely to use is a virtual switch. A little hard to explain, but it allows you to create a switch that has no physical device attached to it.
It may be better to use examples:

I have a virtual switch for each room's motion lighting. The switch itself is attached to /controls nothing. But then, in my motion lighting apps in rule machine, I have it set that if that switch is on the motion lighting app should be disabled. So now I can change the virtual switch to on and it stops my lights from automatically turning on and off. I can also call that virtual switch from google home or alexa, and it can be shown in a dashboard.

Another example - I need to send a http command to my blue iris server to trigger the security cameras to record. I have a virtual switch that when turned on triggers a rule machine rule to send the http command.

The idea behind other virtual devices is the same.

Hope that helps!


#7

hmm. i think i get it. jut kinda like toggles for extra control


#8

Exactly. But they can also be much more.

For another example (and honestly this was implemented in smartthings not hubitat - but the concept is the same), I have a window AC unit in a bedroom that I plugged into a zigbee outlet and a motion sensor that tells me the living room temperature.

I created a virtual thermostat and used some rules to set the virtual thermostat's current room temp to equal the living room motion sensor temperature. Then a rule that when the current temp was higher than the thermostat's cooling setpoint, it should turn on the zigbee outlet (which turns on the AC), and the opposite turns off the outlet.

I then linked the virtual thermostat to google home. It gave me voice control of the AC like I had central air and a smart thermostat. By voice (or also a dashboard) I could set the virtual thermostat to a desired temp, and the rules behind the thermostat would turn on the AC unit until the room temp matched the desired temp.


#9

Allow me to describe an even more intricate example....

Presence Sensor.
My presence sensor is my iPhone. I can't connect my iPhone to Hubitat. It's connected to HomeKit. HomeKit sees my one device called Homebrige. HomeKit has automations that update a device -- either present or not. I have to somehow get a device, a switch, that can be turned on/off from HomeKit's automation.

Virtual Switch to the rescue!! :slight_smile:
I create a Virtual Switch in Hubitat, name it "my presence" or something equally brilliant and add it to the Homebridge app so that HomeKit sees it. Now I have an automation that works. A bit Rube Goldberg, but not too much. :slight_smile:

I arrive home (or depart) and my iPhone detects the geofence, informs Homekit, which runs the automation and turns on (or off) the switch. Homebrige informs Hubitat, and I can now run Rules based on that event and the state of the switch.


#10

Another example. I have a space heater in my home office. I created virtual switch and set it to auto turn off after 1 second. I have a rule that watches that switch and turns on the heater, that rule also turns off the heater on false with a 15 minute delay. So even if I get distracted and leave my office I know it will go off after 15 minutes.

Because it's a switch, even a virtual one I can also call it from Alexa, use it with my button controllers, and also use it in other rules without having to redo the logic and programming of the 15 minute run rule.


#11

Do you use a motion switch to detect when there is no movement to trigger the delayed off? If not, how does it work when you leave?