Author Topic: PLUGIN: Virtual Sensor  (Read 1286 times)

Online rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
PLUGIN: Virtual Sensor
« on: February 25, 2018, 10:41:54 am »
This is a development tool that I've used to assist in the development and testing of other plugins. I decided to package and release it, on the chance that others may find it useful. It has utility not just for developers, but for any Vera user testing their work with scene triggers, PLEG, etc.

VirtualSensor can emulate a security sensor (tripped/not tripped, e.g. motion, door, etc.), temperature sensor, humidity sensor, light sensor, or generic sensor. It uses a simple sinusoidal function with user-settable parameters to produce output data. To other devices, it appears and operates as any sensor would. It also can emulate battery drain and replacement behavior. While there are other virtual sensors out there, many are old (pre-UI7) and not consistently maintained, the landscape is fragmented (many plugins to do the work of one), and didn't give me the kind of control I wanted for my testing purposes.

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


UPDATE HISTORY
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.
« Last Edit: July 31, 2018, 09:17:37 am by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jeubanks

  • Full Member
  • ***
  • Posts: 215
  • Karma: +10/-4
Re: PLUGIN: Virtual Sensor
« Reply #1 on: March 01, 2018, 12:12:45 pm »
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?

Online rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: PLUGIN: Virtual Sensor
« Reply #2 on: March 01, 2018, 02:58:37 pm »
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?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jeubanks

  • Full Member
  • ***
  • Posts: 215
  • Karma: +10/-4
Re: PLUGIN: Virtual Sensor
« Reply #3 on: March 01, 2018, 06:09:29 pm »
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 :) 

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

Online rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: PLUGIN: Virtual Sensor
« Reply #4 on: March 01, 2018, 06:53:14 pm »
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.
« Last Edit: March 01, 2018, 07:50:30 pm by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jeubanks

  • Full Member
  • ***
  • Posts: 215
  • Karma: +10/-4
Re: PLUGIN: Virtual Sensor
« Reply #5 on: March 01, 2018, 07:39:09 pm »
Ok cool.  No rush on it.  Just toying with my system and trying to integrate left over pieces.

Online rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: PLUGIN: Virtual Sensor
« Reply #6 on: March 07, 2018, 10:34:55 am »
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).
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jeubanks

  • Full Member
  • ***
  • Posts: 215
  • Karma: +10/-4
Re: PLUGIN: Virtual Sensor
« Reply #7 on: March 08, 2018, 08:52:04 pm »
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).

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

Offline Drex

  • Sr. Newbie
  • *
  • Posts: 27
  • Karma: +0/-0
Re: PLUGIN: Virtual Sensor
« Reply #8 on: March 11, 2018, 10:30:51 pm »
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).

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!
« Last Edit: March 12, 2018, 06:18:51 am by Drex »

Offline jeubanks

  • Full Member
  • ***
  • Posts: 215
  • Karma: +10/-4
Re: PLUGIN: Virtual Sensor
« Reply #9 on: March 12, 2018, 12:47:03 am »
Hoping to get to this still.  I think I want to use this with my Life360 integration.

Online rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: PLUGIN: Virtual Sensor
« Reply #10 on: March 12, 2018, 07:43:18 am »
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.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1247
  • Karma: +62/-23
Re: PLUGIN: Virtual Sensor
« Reply #11 on: April 12, 2018, 04:53:13 am »
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.
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!

Online rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: PLUGIN: Virtual Sensor
« Reply #12 on: April 12, 2018, 10:33:21 am »
Done!
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline cozmokramer

  • Sr. Newbie
  • *
  • Posts: 39
  • Karma: +0/-0
Re: PLUGIN: Virtual Sensor
« Reply #13 on: May 07, 2018, 05:24:12 pm »
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?

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1326
  • Karma: +35/-32
Re: PLUGIN: Virtual Sensor
« Reply #14 on: May 07, 2018, 09:29:41 pm »
Here is a screen shot:
Vera 3, 1.7.1030, CT101, Everspring motion sensor, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb, Hue, Alexa