Plugin: Virtual Sensor

One challenge here is identifying what is a number and what is a date.

A simple heuristic, which works well most of the time, is to assume that very large numbers are dates. The threshold I use in openLuup is 1234567890. Then, of course, you have the issue of what format to use to display it…

@pradi, I’ve tested the following expression in SiteSensor (another Patrick Rigney plug-in I highly recommend), and it works fine:

strftime("%m/%d/%Y","1587338168")

Because it’s in LuaXP (also created by @rigpapa), I’d imagine it could find use in Virtual Sensor. I know it works in Reactor (also his creation) just fine, and returns the value:

4/19/2020

You could modify this code to consume actual timestamps from your setup, as well as display other Unix time formats if you prefer.

Is it possible to attach a unit of measure to a virtual generic sensor?
Watt for example.

1 Like

I have a node-red flow reading some external temperatures I would like to show up in Vera. It looks like Virtual Sensor could do that but for some reason it does not seem to work. Ik can set any device value from a flow. Is there a way that Virtual Sensor can be used to just be set to a value from outside Vera and if yes how?

Edited: I believe I found the option for the source to be No Device so will experiment with that now.

That’s right. Then you use the variableset request from afar to set the sensor’s value. Each different type of sensor has a slightly different variable name and service ID, so you need to be careful that you get the right one. For a temperature sensor, the request would be like this:

http://vera-local-ip/port_3480/data_request?id=variableset&DeviceNum=NNN&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=TTT
1 Like

@rigpapa I will try to use your suggested varableset request since the Mios node I use does not seem to work for the Virtual Sensor… I tried that like it should be used with room:unit:variable without luck.

I can confirm node-red mios node only works for Switches. It does not do sensors or scenes.

Well I can confirm the mios node also works for dimmer lights

And using the variableset command worked like a charm too! Thanks @rigpapa and all other helpers, I have got my Daikin Heatpump monitored and under control!

1 Like

Hello. I created virtual sensors for humidity, temperature, and lighting. And I set the values as you said humidity for example
http://vera-local-ip/port_3480/data_request?id=variableset&DeviceNum=44&serviceId=urn:upnp-org:serviceId:HumiditySensor1&Variable=CurrentLevel&Value=18 (is this command correct?)
but only the temperature works. Humidity, lighting does not work

The service ID is incorrect.

For humidity: urn:micasaverde-com:serviceId:HumiditySensor1

For light: urn:micasaverde-com:serviceId:LightSensor1

everything works. thank you very much!

Dear Patrick, please answer one more question: there is a plug-in “virtual sensor” and a sensor “illumination”, why can’t I change the light level with the command from Node red “currentLevel”. Node red Writes the error " TypeError: node.info is not a function"
Although the readings are being read.

How to create virtual door sensor in virtual sensor app to use in to reactor

@rigpapa hey i know this thread’s been quiet for a bit but I’d really appreciate some help please!

I’ve created a virtual door/security sensor that shows Tripped = 1 (and the icon is highlighted red). But it doesn’t change the ‘armed’ / ‘disarmed’ state. How can I automatically get to set the device to ‘armed’ when it’s ‘tripped’?

Thanks