Plugin: Virtual Sensor

I am so sorry! I know exactly how that feels. More good stuff coming. I’ll warn you first. :slight_smile:

Hi RigPapa,

While searching for an answer to my problem, I came across your thread and plug-in :slight_smile:
I wish I had found you earlier as I have been looking for the functionality of a Virtual Switch but with an extra Arm/Disarm toggle for ages.

I thought that I had found my ideal answer when I came across this thread;-
http://forum.micasaverde.com/index.php/topic,86502.0.html

I have made several Virtual Motion Sensors by uploading a new I_MotionSensor1.xml to my VERA and following their instructions to create the devices manually.
Everything works very well, with one exception.
For a few of the devices, I want to only trigger them and cannot easily send an untrigger.
I would like some of them to revert to untriggered by themselves - after a set period (30 seconds)

I have tried to install a new service using the instructions in this thread;-
http://forum.micasaverde.com/index.php/topic,102089.0.html
but the variable AutoUntrip is not created.

I don’t want to hijack your thread as I’ve not installed your plug-in (it seems a bit overkill for my needs) but you seem to be very knowledgeable about variables and possibly know what I should do?
.

You should just be able to create the AutoUntrip variable yourself in your sensor, and assign it a non-zero number of seconds for the time period. You can do that by going to the Advanced tab for your sensor, then go to the “New Service” sub-tab, and enter the following:

New service: urn:micasaverde-com:serviceId:SecuritySensor1
New variable: AutoUntrip
New value: (enter the number of seconds for the reset time)

The hit the “Add” button, and then the “Reload Engine” button. That should be all you need to do.

2 Likes

Version 1.9 is now released for all platforms/stores. This version allows simpler changing of a virtual sensor’s name by simply clicking on it and typing the new name. No reload is done for this (intentionally), so in some circumstances you may not see the updated name in certain other apps until a reload is done. This version also does a better job of self-reinitializing a virtual sensor when its configuration changes, making it fully operational in its new configuration without a Luup reload.

Version 1.10 is waiting for Vera App Marketplace approval and is immediately available in the AltAppStore. Changes for this version:

  • Allow match string for binary sensors–rather than simply copy value, compare to match string and set Tripped=0/1 according to match state.
  • Improve response to all config changes with Luup reload requirement.
  • Add motion and smoke sensor subtypes of binary sensor.
  • Allow empty source device selection, meaning sensor can be updated externally (e.g. Lua, Reactor, scenes, etc.) without interference from VirtualSensor (i.e. it’s managed outside VirtualSensor).
  • Track previous value and time last updated; display on Virtual Sensors tab.

Would it be possible to have option for temperature sensors to drop out decimals? I.e. when source gives 20.3 then virtual sensor gives 20. I have some temperature sources where decimal is jumping and anyways showing temperature that accurately seldom makes sense.

If I remember correctly, you’re also a Reactor user… take any ReactorSensor of yours, and add an expression variable to getstate() the temperature from the source device. Wrap that in round( tonumber( ... ) ), and mark the variable for export. Then make that variable in the ReactorSensor the source of the virtual sensor.

Yep, that works!

Hi Patrick,

Is there a way to force a humidity virtual sensor to refresh the value and therefore trigger an event even if there is no change in the source value at a specific interval?

Thanks.

That’s not currently a feature of Virtual Sensor. I can add it to the list for the next release, though.

EDIT: But wait a minute. Vera only triggers watches and events when the same value is written for certain special variables, not for all. I can re-test to make very sure, but I doubt this would work.

Is it possible then to use Reactor to change the value by a small amount, let say the RH is 45, and add 0.001 to the value and cause a trigger as a result?

Hi Patrick,
Is there any way to remove the word “level” from these generic virtual device displays (and even add W, kW or kWh instead)?

They’re set by Vera’s device files/definitions, unfortunately. It would be great if they derived that from a state variable on the device, but no such luck.

You may be able to make your own device UI file for the purpose, though. How would you rate your overall skill level at Vera?

Ummm. Long time copier and adjuster of smart developers code. :wink: So fairly low.

1 Like

Good enough!

Download the ZIP file attachment here, unzip it. In the Vera UI, go to Apps > Develop apps > Luup files. Turn OFF the “Reload” checkbox, then drag the unzipped JSON file to the “Upload” area and drop it there to upload it to your Vera.

Then, go into the device control panel for one of your devices that uses watts as the unit of measurement, and go to the Advanced > Params tab. There, find device_json and change it to D_GenericSensor1_Watts.json. Then go to Advanced > New service and hit the Reload Engine button. Then, hard-refresh your browser.

That should make that device display “Watts” instead of “Level”.

D_GenericSensor1_Watts.zip (1.2 KB)

Edit: Corrected case of filename–should be Watts with a capital W as zipped.

Thanks Patrick, I understood all of that OK.
The device I tested with is now not showing at all. It still shows as a virtual sensor (with Device ID #543) but is now missing from the Vera devices page - after a few reloads and browser hard refreshes and a restart.

I did just notice the file name was D_GenericSensor1_Watts.json but I pasted D_GenericSensor1_watts.json from your post. (Lower case watts) Could that be it? Do I fix #543 or create a new virtual sensor?

Edit: Fixed it. Just renamed the .json file to lowercase watts and uploaded again.
It displays perfectly in the iOS app but on a browser it prefixes the label. Is that expected?

What changes do I need to make to create a kWh version of this .json file?

Thanks again - and Merry Christmas.

Web

App

1 Like

PS - Does Vera support anything more graphical for viewing values like this (from my ‘Home Assistant’)?

Good job! You just leveled up, I’d say! Yes, that was my mistake, sorry. I’ll fix my instructions in the prior post in case anyone else finds them and tries. Thank you!

There are some graphing tools for Vera data, but this is not my area of expertise at all.

I am using Grafana with InfluxDB. There is an excellent plugin for it: VeraFlux

Works pretty good and is easy to set up.

1 Like

Out of the box not. But since it is programmable, it is possible. I experimented with simple plugin which creates svg graphics for device display. Here is one example:
dash_123

Creating round gauges and even short graphs can be done as well. Downside is that it is kind of hack for UI, if something changes on Veras side then plugin needs to be updated as well.

1 Like