We have moved at community.getvera.com

Author Topic: location and editing scenes in ssh  (Read 2007 times)

guest13242

  • Guest
location and editing scenes in ssh
« on: August 10, 2011, 10:16:13 am »
Hi everybody, I'm sorry for silly question. but I can't find anywhere in the forum that  I can edit scenes when I'm SSH to micasaverde. I would like to look to coding scenes and editing it. Which file should I look? I don't want to do it from GUI. for an example I want to change delay 1 second to turn off the light switch, but the scenes GUI only allowed 5 second delay.

Thank you for all advices you can give.

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0

guest13242

  • Guest
Re: location and editing scenes in ssh
« Reply #2 on: August 11, 2011, 10:00:42 am »
can you please help me to write a simple code luup. Device #21 turn on for 1 second and turn off. Thank you so much

Offline mcvflorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1755
  • Karma: +11/-3
Re: location and editing scenes in ssh
« Reply #3 on: August 11, 2011, 11:06:23 am »
Add this Lua code to the scene:
Code: [Select]
local DEVICE = 21
local SECONDS = 1

function turnOffDevice()
    luup.call_action ("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, DEVICE)
end

luup.call_action ("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, DEVICE)
luup.call_delay ("turnOffDevice", SECONDS, "")

This turns on your DEVICE and after SECONDS seconds turns it off.