Author Topic: Everspring ST814 how do I write a get current temperature call?  (Read 195 times)

Offline kalel3000

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
I just need to know the proper form in lua to retrieve the current temperature reading from a Everspring ST814.

I have a ductless air conditioner that I control via an rf sender unit. The internal thermostat is way off, so I'm trying to control it via the reading on a Everspring ST814. I have the everspring working all right, but I need to setup temperature ranges for when my rf sender activates.

For instance if its hotter than 74 but less than 78, I would want medium air levels, but 78 and above I would want max air settings. So the scene triggers would be when temperature reaches above a certain degree, but would only run for each scene if the current temperature is within the correct range. Also they wont be run unless in home mode, which is triggered when I get home, at which point if it were for instance 80 degrees , all the scenes would run because the 80 is higher than all the triggers.

Regardless, I am able to do all of the code, I previously mentioned. I just need to know how to get the current temperature from the everspring. Thank you!

Offline jswim788

  • Hero Member
  • *****
  • Posts: 538
  • Karma: +29/-2
Re: Everspring ST814 how do I write a get current temperature call?
« Reply #1 on: July 24, 2017, 01:55:42 pm »
See this post for an example: http://forum.micasaverde.com/index.php?topic=18679.15

In particular, this is the call you need:
Code: [Select]
local tCurrent = tonumber((luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",dID)))
Replace the 'dID' above with the device ID for your particular sensor.  luup.variable_get returns a string which is why it is wrapped with tonumber().

Offline akbooer

  • Master Member
  • *******
  • Posts: 5234
  • Karma: +226/-67
  • "Less is more"
Re: Everspring ST814 how do I write a get current temperature call?
« Reply #2 on: July 24, 2017, 01:59:57 pm »
The call shown by @jswim788 is quite correct, but do make sure you copy it exactly (aside from the device number)... the double parentheses are essential as explained here:

http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_variable_get
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P.
Razberry, MySensors Arduino, HomeWave, AltUI, DataYours, openLuup, ZWay, ZeroBrane Studio.

Offline kalel3000

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: Everspring ST814 how do I write a get current temperature call?
« Reply #3 on: July 25, 2017, 05:53:46 pm »
Thank you very much! I will use this exactly as written, replacing only the device ID!