Montag, 31. März 2014

Vision Security ZP 3102 EU

This is a nice a very reliable PIR sensor which even offers a temperature monitor. But in Vera Lite UI5 there is no device added to use this as temperature probe.

Workaround:

Procedure :
o App/Develop App/Create device
o Enter "D_TemperatureSensor1.xml" in the field "Upnp device filename"
o Enter whatever you want in the field "Description" -> it will be the virtual sensor name...
o Choose a room if applicable
o Click 'Create Device'
o Open the newly created device, go to 'advanced' tab.
o Enter "urn:upnp-org:serviceId:TemperatureSensor1" in the field 'New service'
o Enter "CurrentTemperature" in the field 'New Variable'
o Enter "0" in the field 'new value', click 'Add'

=> Then you must create a scene that runs every x minutes (like 5 minutes).
o In the scene luup code, enter :
 local my_temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",motion_id)   
 luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", my_temp, virtual_id)  
 return true  


replace 'motion_id' by the ZP3102 device ID, replace 'virtual_id' by the virtual sensor device ID

o Save the code, finish the scene (name, room etc), save

=> Now, when clicking 'Run scene', the virtual sensor temperature should update with the one of the ZP3102...


If you want to use more than one ZP3102, just make sure to create a scene which updates the temp for each device. One scene for every device. Adjust the device and virtual IDs!

edit: Today I had a look again at it and there is a easier way if you have more than one device. You can all put it in ONE scene which runs every 5 minutes. All you need to to is rename there variable for every sensor.

 local my_temp1 = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",21)  
 luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", my_temp1,38)  
 local my_temp2 = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",31)  
 luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", my_temp2,37)  
 return true  

The first variable is called my_temp1, the second my_temp2. Make sure you set the corresponding IDs of the sensor and the virtual probe correctly. The code above is illustrating my setup with two sensors (ID 21 and ID 31) and the two virtual probes ( ID 37 and ID 38).