We have moved at community.getvera.com

Author Topic: Code wanted for pool pump On/off  (Read 457 times)

Offline BerrytH

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Code wanted for pool pump On/off
« on: February 09, 2019, 11:15:17 am »
I am A newbee and I?ve read a LUA code somewhere but can?t find it anymore, so please help!

I have a Vera plus, Fibaro door sensor and Fibaro temp sensor.
I need a code that switches my pool pump on/off depending on the pool temp.
Example:
1. When the pool temp is <18C then the pump should be on at 8 till 10Am and 10 till 11 PM
2. When the pool temp is between 18C and 24C the pump should be on at 8 till 10Am, 2 till 4 PM and 10 till 11 PM
3. When the pool temp is >24C the pump should be on at 8 till 11 AM , 2 till 5 PM and 10 till 12 PM

Any help or ideas will be highly appreciated! Thanks!

Offline Buxton

  • Full Member
  • ***
  • Posts: 209
  • Karma: +12/-0
Re: Code wanted for pool pump On/off
« Reply #1 on: February 09, 2019, 01:38:33 pm »
You can do this easily using the reactor plugin.
« Last Edit: February 09, 2019, 07:10:45 pm by Buxton »

Offline BerrytH

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Re: Code wanted for pool pump On/off
« Reply #2 on: February 09, 2019, 06:37:49 pm »
Buxton, pls tell....I. Am a newbee, ftp://

Offline Buxton

  • Full Member
  • ***
  • Posts: 209
  • Karma: +12/-0
Re: Code wanted for pool pump On/off
« Reply #3 on: February 09, 2019, 07:11:14 pm »
Here's the link to the plugin FAQ.  This will get you going.  http://forum.micasaverde.com/index.php/board,93.0.html

Offline markoe

  • Full Member
  • ***
  • Posts: 137
  • Karma: +4/-3
Re: Code wanted for pool pump On/off
« Reply #4 on: February 10, 2019, 03:41:20 am »
I am A newbee and I?ve read a LUA code somewhere but can?t find it anymore, so please help!

I have a Vera plus, Fibaro door sensor and Fibaro temp sensor.
I need a code that switches my pool pump on/off depending on the pool temp.
Example:
1. When the pool temp is <18C then the pump should be on at 8 till 10Am and 10 till 11 PM
2. When the pool temp is between 18C and 24C the pump should be on at 8 till 10Am, 2 till 4 PM and 10 till 11 PM
3. When the pool temp is >24C the pump should be on at 8 till 11 AM , 2 till 5 PM and 10 till 12 PM

Any help or ideas will be highly appreciated! Thanks!

Keep it short and simple ;D

scene 1 turn pump on 8 AM
Scene 2 turn pump off 10 AM if temp < 24
Scene 3 turn pump off 11 AM
Scene 4 turn pump on 2 PM if temp > 18
Scene 5 turn pump off 4 PM if temp > 18 and < 24
Scene 6 turn pump off 5 PM
Scene 7 turn pump on 10 PM
Scene 8 turn pump off 11 PM if temp < 24
Scene 9 turn pump off 12 PM

Offline BerrytH

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Re: Code wanted for pool pump On/off
« Reply #5 on: February 17, 2019, 06:24:46 pm »
I am A newbee and I?ve read a LUA code somewhere but can?t find it anymore, so please help!

I have a Vera plus, Fibaro door sensor and Fibaro temp sensor.
I need a code that switches my pool pump on/off depending on the pool temp.
Example:
1. When the pool temp is <18C then the pump should be on at 8 till 10Am and 10 till 11 PM
2. When the pool temp is between 18C and 24C the pump should be on at 8 till 10Am, 2 till 4 PM and 10 till 11 PM
3. When the pool temp is >24C the pump should be on at 8 till 11 AM , 2 till 5 PM and 10 till 12 PM

Any help or ideas will be highly appreciated! Thanks!

Keep it short and simple ;D

scene 1 turn pump on 8 AM
Scene 2 turn pump off 10 AM if temp < 24
Scene 3 turn pump off 11 AM
Scene 4 turn pump on 2 PM if temp > 18
Scene 5 turn pump off 4 PM if temp > 18 and < 24
Scene 6 turn pump off 5 PM
Scene 7 turn pump on 10 PM
Scene 8 turn pump off 11 PM if temp < 24
Scene 9 turn pump off 12 PM


 Thanks Markoe,

Looks quite simple but how is it possible to put 2 or more triggers in one scene?
Therefore I think a Lua code is necessary....but I?m probably wrong, right?
Please help,
Thanks!

Offline markoe

  • Full Member
  • ***
  • Posts: 137
  • Karma: +4/-3
Re: Code wanted for pool pump On/off
« Reply #6 on: February 18, 2019, 02:06:48 am »
Yes you are probably right. You can add multible trickers but there is OR tricker between  >:(. I have been using the lua only so long that I forgot the VERA UI limitations.

You need to add something like this to lua section for scene 2, And similar way the scenes 4,5,8


local WE_DEV = 20 --add your temp device id here
local WE_SID = "urn:upnp-org:serviceId:TemperatureSensor1"
local Temp1 = luup.variable_get(WE_SID,"CurrentTemperature",WE_DEV)
if (Temp1  > 24 ) then
  return false -- this will stop the scene
end


You can find the device ID from advanced tab of you device (Device # XX).
Hope you manage to get your pool pump automation working.  :)
« Last Edit: February 18, 2019, 02:12:39 am by markoe »