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

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +46/-0
    • toggledbits.com
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-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: March 07, 2018, 10:33:46 am by rigpapa »
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Online jeubanks

  • Full Member
  • ***
  • Posts: 109
  • Karma: +2/-0
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?

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +46/-0
    • toggledbits.com
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 Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Online jeubanks

  • Full Member
  • ***
  • Posts: 109
  • Karma: +2/-0
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.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +46/-0
    • toggledbits.com
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 Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Online jeubanks

  • Full Member
  • ***
  • Posts: 109
  • Karma: +2/-0
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.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +46/-0
    • toggledbits.com
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 Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Online jeubanks

  • Full Member
  • ***
  • Posts: 109
  • Karma: +2/-0
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: 24
  • 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 »

Online jeubanks

  • Full Member
  • ***
  • Posts: 109
  • Karma: +2/-0
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.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +46/-0
    • toggledbits.com
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 Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline rafale77

  • Hero Member
  • *****
  • Posts: 861
  • Karma: +42/-20
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 (52 devices, 82 scenes, 16 apps) controlling HomeAss + VeraPlus with 130 zwave nodes, 8 Zigbee nodes, 5 apps, 233 devices, 84 scenes + VeraEdge (0 node, 26 devices, 6 App, 0 scene); Bridged to Homekit and Alexa.

Offline rigpapa

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