Visualisation time and date Question

Discussion in 'C-Bus Automation Controllers' started by TheBigShac, Apr 10, 2019.

  1. TheBigShac

    TheBigShac

    Joined:
    Apr 10, 2019
    Messages:
    1
    Likes Received:
    0
    So probably a very basic question. i have done the 1 day basic nac and shac programming course so i have a basic understanding. One thing that i guess was not covered that i am struggling to find any information on was a time and date timestamp that i could have on a theme to display on the header of every page. I believe it must be coded as i have tried creating an object "user Parameter/TimeDate" but this is just static text. I have seen some images with time and date stamps on some Clipsal themes here.
    http://www.cleverhome.com.au/automa...0SHAC-C-Bus-Network-Automation-Controller.pdf

    thanks.
     
    TheBigShac, Apr 10, 2019
    #1
    1. Advertisements

  2. TheBigShac

    dic

    Joined:
    Sep 17, 2008
    Messages:
    7
    Likes Received:
    0
    To show the time and date, we have done this;

    1. Create three string User Parameters(i.e. named Viz_Time, Viz_Date, Viz_AMPM)
    upload_2019-4-18_10-51-51.png
    upload_2019-4-18_10-54-27.png

    2. Create Resident script with 60 second interval
    upload_2019-4-18_10-52-54.png

    3. With script contents of this;
    SetUserParam('Local', 'Viz_Time', os.date("%I:%M"))
    SetUserParam('Local', 'Viz_AMPM', os.date("%p"))
    SetUserParam('Local', 'Viz_Date', os.date("%A, %B %d, %Y"))

    4. We also put this line into the Startup script to make sure the date is updated on NAC power up;
    SetUserParam('Local', 'Viz_Date', os.date("%A, %B %d, %Y"))

    5. Then in the Visualisation add objects to show the values of the new User Parameters
     
    dic, Apr 18, 2019
    #2
    1. Advertisements

  3. TheBigShac

    AntDwyer3875

    Joined:
    Jul 14, 2019
    Messages:
    2
    Likes Received:
    0
    I'm sorry, I'm very new to all of this....Has anyone been able to get this script to work?
    Questions:
    1. In Step 3 is this one script or one script for each of the parameters?
    2. In Step 3 is this script correct? When I paste it into the contents of the script I get the following error. The script cannot be saved "Lua syntax error at line 1: unfinished string near '"%I:%M'"
    3. Also in Step 4 where do, I put the startup script?
     
    AntDwyer3875, Jul 14, 2019
    #3
  4. TheBigShac

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    960
    Likes Received:
    70
    Location:
    Adelaide, Australia
    Step 3 is one script. Select Scripting, then Resident Scripts. Add all three lines in.
    The forum screws up quoted strings. It should read:

    Code:
    SetUserParam('Local', 'Viz_Time', os.date("%I:%M"))
    
    SetUserParam('Local', 'Viz_AMPM', os.date("%p"))
    
    SetUserParam('Local', 'Viz_Date', os.date("%A%d, %Y"))
    
    Under scripting, select Start UP (Init) Script.

    If anyone reads this and is pasting scripts. Please use the CODE formatting option :)
     
    Ashley, Jul 14, 2019
    #4
  5. TheBigShac

    AntDwyer3875

    Joined:
    Jul 14, 2019
    Messages:
    2
    Likes Received:
    0
    Thanks for your update I was able to get through that step.
    I have also added this script to the start-up and run it.
    The final part adding the Visualisation is not giving me the current date and time, do you have any idea why this would be?
     
    AntDwyer3875, Aug 10, 2019
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.