Author Topic: Virtual temperature sensor  (Read 638 times)

Offline backkri

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +1/-0
Virtual temperature sensor
« on: January 22, 2018, 03:02:51 pm »
Dear all,

I have a problem with all my battery operated devices.  Once they run out of battery, I have to exclude / include them to get them working.  My question is indirectly linked to this:

I have an outside temperature measurement (battery operated sensor).  This measurement is used in a lot of PLEG / LUA / scenes etc.  Each time it runs out of battery, I have to go through the program of my 2 Vera Plus controllers to find out where it is used (no cross references available) and replace it.  To avoid this, I would like to copy the value to a virtual device, and use that one in all of my logic.  If battery is replaced, I only have to change 1 link instead of a lot.

I looked into averaging temperature apps which could do the trick, but they do not seem to work in UI7.

All ideas are welcome.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 798
  • Karma: +58/-2
Re: Virtual temperature sensor
« Reply #1 on: January 22, 2018, 04:08:47 pm »
Seems crazy that you need to exclude/include to get them to work again.  But I think you might be able to use @futzle's virtual temperature sensor here: http://forum.micasaverde.com/index.php/topic,7549.msg48644.html#msg48644  It's pretty old so you may need to update it.  That sensor is trying to get the value from an http link (as far as I recall), but you could easily modify it to pull from a Zwave device.

Online wilme2

  • Hero Member
  • *****
  • Posts: 1234
  • Karma: +29/-13
Re: Virtual temperature sensor
« Reply #2 on: January 22, 2018, 04:37:51 pm »
There used to be a plug-in called Variable Container which allowed you to store variables.  I see it is no longer supported however...

How about using an exported PLEG Condition to store it?  That would let you abstract it away from the actual device, and each time you would just have to update the Condition's expression.  Other PLEGs and LUA could read that condition...
Long Live UI5!  (OK finally made the switch to UI7 in January 2018, and am pretty happy....)

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1379
  • Karma: +36/-35
Re: Virtual temperature sensor
« Reply #3 on: January 22, 2018, 08:50:23 pm »
The variable container app I use now is Multistring.
Vera 3, 1.7.1030, CT101, Everspring motion sensor, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb, Hue, Alexa

Offline kartcon

  • Full Member
  • ***
  • Posts: 158
  • Karma: +7/-0
Re: Virtual temperature sensor
« Reply #4 on: January 22, 2018, 09:10:27 pm »
Ditto what Don Phillips said. MultiString is a gem. You can define variables and textual names for up to 5 variables, plus you can add more instances if you need more variables. In addition to that you can also do this:
Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:VContainer1","VariableName4","Delay:Step:Loop",190)
luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable4",varDelayPeriod/60 .. " min : " .. varDimStep.. "% : " .. varLoopCnt,190)
produces this:

Delay:Step:Loop = 10.85 min : 3% : 12

3 variables from the same function rolled into one line. Cool stuff.

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 1379
  • Karma: +36/-35
Re: Virtual temperature sensor
« Reply #5 on: January 23, 2018, 09:26:16 am »
My example is to track the hours my blower has run since the last filter change, and how many times my 2 battery door sensors were triggered open. This is updated within PLEG:
Vera 3, 1.7.1030, CT101, Everspring motion sensor, GE/Jasco switch, Leviton outlet, AeonLabs sensor, NuTone garage door, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual/Multi Switch, Weatherunderground, LB60Z-1 bulb, Hue, Alexa