Plugin: Virtual Sensor

Virtual Sensor manages a set of virtual sensors, which can be set to clone a value from another device. It is useful for extracting data from devices and turning them into scene triggers or other event drivers when they otherwise would not be.

VirtualSensor also functions as a test tool, providing an internal function generator that can generate values using a sinusoidal function. I original used this for testing thermostat plugins, but it has many uses.

Documentation and the latest “edgy” code for project can be found in its GitHub repository.


UPDATE HISTORY

2019-07-07: Version 1.10 allows a virtual binary sensor to be directly driven by matching a string from another device’s value; improvements in responsiveness to config changes (i.e. changes take effect without Luup reload); additional sensor types on Vera Luup; reporting of previous and current value with timestamp on control panel.

2019-06-08: Version 1.9 allows changing of sensor name by clicking on the name in the Virtual Sensors tab; and removes the need for a Luup reload to begin copying data after setting/changing the source state variable.

2019-05-29: Version 1.8 includes various small updates and optimizations; clears the sensor values when the simulator is not running.

2019-04-07: Version 1.7 fixes a bug causing duplicate watches to be placed on device state variables already watched.

2019-03-31: Version 1.6 fixes some small bugs in the UI introduced in 1.5.

2019-03-17: Version 1.5 provides a UI for the management of virtual sensors.

2019-01-20: Version 1.4 submitted to Vera Plugin Marketplace for approval; immediately available in AltAppStore. This version allows the user to create any number of sensors (temp, humidity, light, generic, or security), where the sensor’s well-known value is simply copied from any state variable in any other device.

2018-07-29: Version 1.3 released. Just a fix to follow Vera semantics for ArmedTripped and LastTrip more closely, by allowing both Vera and openLuup to manage them (VirtualSensor no longer touches them).

2018-03-05: Version 1.2 released, available in Vera plugin marketplace. Allows the external control of trip and reset by actions (service urn:toggledbits.com:serviceId:VirtualSensor1 actions Trip and Reset, no parameters), or through UI on control panel.

2018-02-26: Version 1.1 is now available in the Vera plugin marketplace. Add battery emulation, improved UI controls, and a number of code cleanups.

2018-01-19: Version 1.0 released.

I’m wondering if this virtual sensor is what I’m looking for. I want a virtual motion sensor that I can trigger through a http call. How would I configure the sensor parameters for a simple motion scenario of on/off detection being toggled through a web call?

OK, so to be clear, you want to make an HTTP request TO VERA from somewhere outside (or heck, even from the Vera itself), and have it set, reset, or toggle the Tripped state of a VirtualSensor?

Yup…

Doing that already with Virtual Switches to integrate with Life360 :slight_smile:

I want to integrate with my camera system to use Virtual Sensor for motion events.

OK. It doesn’t do this at the moment, but it’s good timing. It’s easy to do, and I can get it into Vera’s plugin approval cycle for Monday. And you can hand-install the modified files if you wish. I can have those for you tomorrow.

Ok cool. No rush on it. Just toying with my system and trying to integrate left over pieces.

It’s in. Version 1.2 in the Vera plugin marketplace. There is control panel UI to trip and reset the sensor manually. Scenes, PLEG, and Lua can also use the Trip and Reset actions (service urn: toggledbits-com:serviceId:VirtualSensor1).

It’s in. Version 1.2 in the Vera plugin marketplace. There is control panel UI to trip and reset the sensor manually. Scenes, PLEG, and Lua can also use the Trip and Reset actions (service urn: toggledbits-com:serviceId:VirtualSensor1).[/quote]

Very cool. I’ll take a look at it soon. Busy with doing some home stuff.

It’s in. Version 1.2 in the Vera plugin marketplace. There is control panel UI to trip and reset the sensor manually. Scenes, PLEG, and Lua can also use the Trip and Reset actions (service urn: toggledbits-com:serviceId:VirtualSensor1).[/quote]

I’m looking for a virtual alarm contact to parallel alarm settings called by HTTP requests that functions like a native alarm contact in Vera.

I loaded the plug in and understand how to trip on and off with a url. My only question: how do you shut it off from autogenerating values of the switch per the sine algorithm (ie disable all the sinusodal features?)?

Thanks!

Hoping to get to this still. I think I want to use this with my Life360 integration.

Sorry, I missed your follow-up. Disabling the function is just a matter of setting the plugin to disabled on its UI. That stops the function generator. Everything else continues to work.

Would you release 1.2 to the AltAppstore? I guess I can always get it from GitHub… but would be nice to have it updated.

Done!

Came across this plugin in my search for Vera virtual sensors.

Installed it from app store, went ok.

It shows up in the device list - all well.
But I need like 5 virtual sensors of this type. How do I instatiate more like the one created by install?

Here is a screen shot:

Excellent. I figured it out another way too, just a little new to this Vera thiny :slight_smile:

Spot on. Go to your installed plugins list, click on VittualSensor, and you’ll find that “Create Another” button.

Hello,

Woke up this morning with three virtual devices that showed the “can’t connect to device” error. When i checked the Virtual sensor plugin, it now shows that the plugin needs to be “enabled” for the virtual sensors to work. I am almost sure that this was not necessary before as this also enables the simulator which i don’t use at the moment.

Is the above a result of the new version (1.5) ?? Or am i missing something?

The copy-to-child-virtual-sensor functionality was hastily added, you may recall. So I’m now working at cleaning that up, and ultimately making that the central interface of the plugin, with the function generator secondary (but I’m not there yet). One of the other requests was that there be a way to stop the copy action, so the enabled/disabled state now does that. For the moment, if you don’t want to use the function generator, just set a large period and interval; this will minimize the CPU effort there, which is already miniscule, anyway.

Makes perfect sense! Was just wondering, my Vera has been so unstable lately that the three “not connected” devices almost gave me a heart attack :wink: 8)

Thanks again for the great work on your plugins!