How to create a virtual temperature sensor?

Hi,
i’ve an Arduino that get temperature from my kitchen and receive outdoor temp from an Oregon Scientific sensor.

How can I create a virtual temperature sensor into UI5?

I can manage this with a custom HTTP get from arduino, but i can’t realize how to create them into Vera system.

See if this helps: http://forum.micasaverde.com/index.php/topic,7549.msg48644.html#msg48644

Thanks, I used D_TemperatureSensor1.xml template for creating a new virtual temperature device (App → Develop App → Create device). I see the new device into “device” section but if get its settings there insn’t any variable “CurrentTemperature” as specifed into xml file.

After i try to set it from HTTP get (http://ip_address:3480/data_request?id=variableset&…) is it compared into device settings. Is it normal?

Also if I try to use this virtual device into scene it signed with “no aviable to scene” (no entry icon).

What’s wrong?

What’s wrong?

antani, are you pushing the temperature from Arduino to Vera, or pulling the temperature to Vera from the Arduino? Who is doing the HTTP request? My example assumed pulling, so it may not be as useful to you.

If you are pushing, you have to get the variableset command just right. Share your exact command in full.

The no-entry on temperature sensors is normal. They have no controls that a scene can activate.

Now i’m doing test with simple get request from browser to Vera like this:

set:
https://fwd7.mios.com/user/pass/serial/data_request?id=variableset&DeviceNum=13&serviceId=urn:schemas-micasaverde-com:device:TemperatureSensor:1&Variable=CurrentTemperature&Value=25

Returns “OK”

get:
https://fwd7.mios.com/user/pass/serial/data_request?id=variableget&DeviceNum=13&serviceId=urn:schemas-micasaverde-com:device:TemperatureSensor:1&Variable=CurrentTemperature

Return “25”

Also with Vera mobile (iOS) i see temperature virtual device but it report “0” not “25” as set above.

Try using “urn:upnp-org:serviceId:TemperatureSensor1” as the service id. You are using the wrong service variable and string.

https://fwd7.mios.com/user/pass/serial/data_request?id=variableset&DeviceNum=13&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value=25

  • Garrett

:-[ :-[
I understood the difference reading definition file,
Thank you Garrett

Another question, Is there a simple way for understand when last temperature update done?
In my case i want to exclude to use (on vera) old temperature value if my arduino freeze o goes down.

Use the ha service id and the LastUpdate variable. Update that variable with the Unix time when the temperature updates. You can than compare it.

  • Garrett

For update LastUpdate variable when i pull the CurrentTemperature value i need to use a scene (with trigger and of course luup code) or is there a more simple method?

Are you pushing the data or pull it from the arduino? Just issue a variable set of urn:micasaverde-com:serviceId:HaDevice1 with LastUpdate as the variable and the unix time for the value when pushing or pulling the temperature.

  • Garrett

Garrett thanks for your patience

I’m send the data from arduino to vera, but i can done it in reverse mode (vera request data to arduino) if necessary.

I don’t understand urn:micasaverde-com:serviceId:HaDevice1 behavior, is there any manual or guide for this argument?
I do not want to bother you more

You are not bother me:

Do the same that you are doing to push the temperature value to the virtual temperature sensor:

https://fwd7.mios.com/user/pass/serial/data_request?id=variableset&DeviceNum=13&serviceId=urn:micasaverde-com:serviceId:HaDevice1&Variable= LastUpdate&Value=1369214563

Where Value=1369214563 is the unix timestamp. You can than retrieve this value to check when the last time the temperature was updated. Is your Arduino on the same network as your Vera or on separate networks? If on the same network, why not use:

http://vera_ip:3480/data_request?id=variableset&DeviceNum=13&serviceId=urn:micasaverde-com:serviceId:HaDevice1&Variable= LastUpdate&Value=1369214563

Where vera_ip is the ip address of vera. No need to go through MicasaVerde’s servers.

  • Garrett

Thanks again.

I didn’t find any giude or tutorial for LUUP or advance device use.
Before to set “LastUpdate” variable with HTTP i need to add a new device (urn:micasaverde-com:serviceId:HaDevice1) ??

Also, with Arduino is not simple to get unix timestamp. So, is more convenient to get temperature value from Vera directly to Arduino with HTTP? In this case is more simple to update LastUpdate var?

Thank you so much, again!