Announcement

Collapse
No announcement yet.

Get HS device string and/or value

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get HS device string and/or value

    Using the marquee or the postit script, how would you get the device string/value/status to display as the message?

    Thanx
    Tim
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

    #2
    Marquee script:

    Change the function Main() with this one:

    Code:
    void Main( object param )
    {
        MarqueeForm marqueeForm = new MarqueeForm( hs.DeviceString("A1") );
        Application.Run( marqueeForm );
    }
    Post-It script:

    Change the function main() with this one:

    Code:
    void Main( object param )
    {
        PostItForm postItForm = new PostItForm( hs.DeviceString("A1") );
        Application.Run( postItForm );
    }
    Just change A1 to your device code.

    Alternatively, you can also use the script parameter as the device, like this:

    Code:
    void Main( object param )
    {
        PostItForm postItForm = new PostItForm( hs.DeviceString( param.ToString() ) );
        Application.Run( postItForm );
    }
    TEST --> hsscript remote_postit2.cs A3

    Shows a postit with A3's device string.

    Notes:

    - DeviceString is not the same as device status. A device showing ON / OFF or DIM has an empty deviceString.

    - DeviceValue is again different. If you want to show device value you can use the following:

    PostItForm postItForm = new PostItForm( "A1 device value=" + hs.DeviceValue("A1").ToString() );


    Does this answer your question ?
    --
    stipus

    Comment


      #3
      This works nicely as is, but I'd like the marquee to scroll the live device string as it changes.
      I'm not at all proficient with C... This may be a good opportunity to get my feet wet.
      Is there a means to continually loop through the function to accomplish this or alternatively (albeit less clean), a means to kill the marquee from the HS computer then re-run the associated event as necessary (when the string actually changes)?

      Thanks in advance
      Real courage is not securing your Wi-Fi network.

      Comment


        #4
        No?
        Real courage is not securing your Wi-Fi network.

        Comment


          #5
          Yes it's possible to do this.

          You have to save the MarqueeForm object instance within the Script Client using the function sh.SetContext. Many sample scripts do this like the MediaPlayer Control scripts if you want to have a look how it's done.

          Then use a device string changed HomeSeer trigger to run the script again.

          Then in the script main function, get the current MarqueeScript object using sh.GetContext(). If it doesn't exist, create it, and change the string.
          --
          stipus

          Comment

          Working...
          X