Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

SpaceLynk Lua for 2 Step Dimming

SpaceLogic KNX Forum

Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • Light and Room Control
  • SpaceLogic KNX Forum
  • SpaceLynk Lua for 2 Step Dimming
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Thomas_Rohde
Sisko Thomas_Rohde Sisko
121
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
54
Heribert_Dölger
Lt. Commander Heribert_Dölger Lt. Commander
30
FZetina
Lt. Commander FZetina Lt. Commander
27
View All
Related Products
product field
SpaceLogic KNX - 4ʺ Touch Unit
product field
KNX Push Button Dynamic Labeling, universal
product field
Wiser for KNX : logic controller

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Back to SpaceLogic KNX Forum
Anonymous user
Not applicable

Posted: ‎2016-05-08 09:00 PM . Last Modified: ‎2024-07-14 11:55 PM

1 Like
4
507
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-05-08 09:00 PM

SpaceLynk Lua for 2 Step Dimming

Hi Guys,

I'm trying to include below flow diagram to SpaceLynk , but i have limited knowledge in Lua.

The function will be like this

While sensor trigger light on ->After 300sec if no movement dim down to 50% ,If got movement restart timer ->After another 300Sec no movement turn off light, if there is movement the light back to 100%.

Appreciate someone coach me for this.

Attach will be the flow diagram and here is the code

while 1
    if (value==true) then
        Timer1=300
        Timer2=300
        grp.write('1/1/1',255)
    else
        while value == false do
            if Timer1 > 0 then
                Timer1 = Timer1 - 1
            elseif Timer1 == 0 then
                grp.write('1/1/1',125)
                if Timer2 > 0 then
                    Timer2 = Timer2 -1
                elseif Timer2 == 0 then
                    grp.write('1/1/1',0)
                end
            end
            value = event.getvalue()
        end
    end
end

  • Thumbnail of SpaceLogic KNX - 4ʺ Touch Unit
    SpaceLogic KNX - 4ʺ Touch Unit
  • Thumbnail of KNX Push Button Dynamic Labeling, universal
    KNX Push Button Dynamic Labeling, universal
  • Thumbnail of Wiser for KNX : logic controller
    Wiser for KNX : logic controller
View products (3)
Attachments
Reply
  • All forum topics
  • Previous Topic
  • Next Topic
Replies 4
Thomas_Rohde
Sisko Thomas_Rohde Sisko
Sisko

Posted: ‎2016-05-11 10:56 PM

0 Likes
3
411
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-05-11 10:56 PM

Hi Lee,

by random I found a script on the HL of Erwin van der Zwaart. I guess it will meet your requirements.

-- ** Staircase logic with external time object and retriggering on input object Version 3.1 ** --

-- ****************************** Created by Erwin van der Zwart **************************** --

-- ************************************** SET PARAMETERS ************************************ --

-- Set input address

AddressInput = '6/0/0'

-- Set output address

AddressOutput = '6/0/1'

-- Set external time address (optional)

AddressExternalTime = '6/0/2'

-- Use time left indication

UseTimeLeft = true -- Set to false if no time left indication is used

-- Set feedback adress of time left indication (optional)

AddressTimeLeft = '6/0/3'

-- Set time delay (Used when external time is not available)

SetDelay = 10

-- Seconds or Minutes

SetSec = true -- Set to false for Minutes

-- Set factor delay (Multiplies Delay)

SetFac = 1

-- Set unique name for staircase timer (to avoid same storage name usage)

StaircaseName = 'Staircase_1'

-- Logic can be turned of by value 0

Off_by_Value_Zero = false

-- ************************************** END PARAMETERS ************************************ --

-- *************************** DON'T CHANGE ANYTHING UNDER THIS LINE ************************ --

inputvalue = event.getvalue

if Off_by_Value_Zero == false and (event.getvalue() == false or event.getvalue() == 0) then

  -- Exit script

  return

end

ValueInput = grp.getvalue(AddressInput)

ValueOutput = grp.getvalue(AddressOutput)

ValueExternalTime = grp.getvalue(AddressExternalTime)

if SetSec == true then

  SetSeconds = 1

else

  SetSeconds = 60

end

if ValueExternalTime == nil then

ValueExternalTime = 0

end

if ValueExternalTime > 0 then

  StairCaseTime = ValueExternalTime * SetSeconds * SetFac

else

  StairCaseTime = SetDelay * SetSeconds * SetFac

end

if ValueInput == true then

  --check for earlier started scrips

  --check storage for stpid value

  stpid = storage.get(StaircaseName) 

  --check if stpid has a value

  if stpid == nil then

          pid = os.getpid()

          storage.set(StaircaseName, pid)

  else

          -- kill earlier running script   

          os.kill(stpid, signal.SIGKILL)

        -- create new pid for next time to kill

          pid = os.getpid()  

          storage.set(StaircaseName, pid)

    end

  if ValueOutput == false then

    grp.write(AddressOutput, true)

    ValueOutput = true

  end

  -- Check time left indication is used

  if UseTimeLeft == true then

    if StairCaseTime > 0 then

        grp.update(AddressTimeLeft, StairCaseTime)

        repeat

          StairCaseTime = StairCaseTime - 1

          grp.update(AddressTimeLeft, StairCaseTime)

          os.sleep(1)

        until StairCaseTime == 0

    end   

  else

    os.sleep(StairCaseTime)

  end

  ValueOutput = grp.getvalue(AddressOutput)

  if ValueOutput == true then

    ValueInput = grp.getvalue(AddressInput)

    if ValueInput == true then

        grp.write(AddressInput, false)

      ValueInput = false

    end

    if Off_by_Value_Zero == false then

      if ValueOutput == true then

            grp.write(AddressOutput, false)

        ValueOutput = false

          end

    else

      -- Do nothing, this will trigger else condition below on next run

    end

  end 

else

  --check for earlier started scrips

  --check storage for stpid value

  stpid = storage.get(StaircaseName) 

  --check if stpid has a value

  if stpid == nil then

  else

      -- kill earlier running script   

      os.kill(stpid, signal.SIGKILL)

    grp.update(AddressTimeLeft, 0)

    pid = nil

    storage.set(StaircaseName, pid)

    end

  if ValueOutput == true then

    grp.write(AddressOutput, false)

  end

end

Kind regards
Thomas

Application Design Engineer
Reply
Anonymous user
Not applicable

Posted: ‎2016-05-11 11:05 PM

0 Likes
2
411
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-05-11 11:05 PM

Hi Thomas,

Many thanks I will test it whole back to home . Now meeting with customer

Sent from my iPhone

Reply
Thomas_Rohde
Sisko Thomas_Rohde Sisko
Sisko

Posted: ‎2016-08-05 12:20 AM

0 Likes
1
411
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-08-05 12:20 AM

Hello Lee,

in case this topic is answered please mark it accordingly so that we can get a better view on which kind of topics are really still open.

Thanks a lot for your understanding and support.

Kind regards

Thomas

Kind regards
Thomas

Application Design Engineer
Reply
Anonymous user
Not applicable

Posted: ‎2016-08-11 12:32 AM

0 Likes
0
411
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2016-08-11 12:32 AM

Hi Thomas,

I will update the latest one by tomorrow.

Reply
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of