Announcement

Collapse
No announcement yet.

DeviceString(ByName) oddity?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    DeviceString(ByName) oddity?

    When I use a statement such as:
    <%= hs.DeviceStringByName("Network Laptop")%>

    I find that the status displays fine if the status was set via a script but does not display any status at all if HS sets the status line on the device.

    Same thing happens if I use DeviceString.

    How can I display the device status on my web page no matter how it was set?

    #2
    The string is blank by default unless you put something there. That's how it's supposed to work.

    What you really want is a function that uses the string if it's there, and if not, builds some kind of default string, perhaps based on the status of the device. That's a pretty easy function to write. You just have to decide what you want it to return if the string is blank.

    Nucleus Home Automation
    News, support, and updates for Rover, Network Monitor, TimeIcons, and more

    Comment


      #3
      do you have an example on how to detect this?

      Comment


        #4
        How about something like this:
        Skibum
        Skibumsplace
        ______________________________
        Skibumsplace - Locate Me

        Comment


          #5
          Then just substitute DeviceStatusString("A1") for hs.DeviceString("A1") whereever you were going to use the latter. Customize the inner part of the code to change what gets displayed when there's no string.

          Nucleus Home Automation
          News, support, and updates for Rover, Network Monitor, TimeIcons, and more

          Comment


            #6
            I used Hunter's and it worked perfectly!

            Comment

            Working...
            X