We have moved at community.getvera.com

Author Topic: somfy + vera edge + irule  (Read 1377 times)

Offline dari

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
somfy + vera edge + irule
« on: February 28, 2016, 01:52:47 pm »
I use next configuration
vera edge + rfxtrx433E operated by irule
I like to control blinds
I use the vera edge controller and the rfxtrx433E  for controlling blinds
I can just let the shutters 100 % up or completely down
Is there a possibility to add a button to stop the blinds somewhere between 1 and 100% ?
What code do I need to use to do this through irule and the rfx ?

D. V G

Offline Isablend

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-3
Re: somfy + vera edge + irule
« Reply #1 on: April 13, 2016, 10:36:43 am »
Setup a scene where you push the blind to a known position either up or down, then have the scene run the following code (where the numbers at the end are 113(id of the blind in vera), 11 (total seconds required to go up or down fully), 50 (percentage to be achieved);

function roller_shutter_close(dev_id)
  luup.log("manual positionning - roller shutter close")
  luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{ newLoadlevelTarget="0" }, tonumber(dev_id)) 
  return true

function roller_shutter_stop(dev_id)
  luup.log("manual positionning - roller shutter stop")
  luup.call_action("urn:upnp-org:serviceId:WindowCovering1","Stop","", tonumber(dev_id)) 
  return true

function roller_shutter_position(dev_id, calib_val, target)
  -- dev_id: device id of the roller shutter
  -- calib_val: calibration value (measured time to go from fully open to fully closed)
  -- target: opening percentage target
  luup.log("manual positionning - roller shutter")

  -- first step: fully open the roller shutter
  luup.call_action("urn:upnp-org:serviceId:Dimming1","SetLoadLevelTarget",{ newLoadlevelTarget="100" }, dev_id)
  --second step: close the roller shutter
  if target >= 95 then
  open_delay = calib_val * 1.5
  luup.log("manual positionning - roller shutter open_delay is "..open_delay)
  luup.call_delay("roller_shutter_close",open_delay, dev_id) 
  --third step: stop the roller shutter at target position
  if target <= 5 then
  stop_delay = calib_val - ((calib_val / 100.0) * target)
  luup.log("manual positionning - roller shutter stop_delay is "..stop_delay)
  stop_delay = stop_delay + open_delay
  luup.call_delay("roller_shutter_stop",stop_delay, dev_id)   

  return true

roller_shutter_position(113, 11, 50)