Announcement

Collapse
No announcement yet.

Ultraview Custom Icons Problems

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

    Ultraview Custom Icons Problems

    I generated my floor plan and got ultraview working with the default "light bulb" icon for all my devices.

    I'm trying to customize the icons displayed for my devices in my ultraview floorplan. I am using Homeseer 1.6.0 and the latest ultraview download.

    I am trying to do this by customizing the "ultra_view2_xml.inc" file in the "include" directory.

    I made a custom device type for "Window" and downloaded an open.gif and closed.gif icons that I would like to use for these devices.

    I also downloaded a motion_down.gif, and custom.gif icons for the "Motion Sensor" devices. All icons are located under Homeseer's html root.

    The device status shows up as "OFF" and "ON" in my device viewer in Homeseer.

    Here is a snippet of what I modified below:

    ' Start Mods for Icons Here:
    select case strDeviceType
    case "Window"
    if strDeviceString = "On" then
    strDeviceString = "On"
    strDeviceIcon = "open.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    if strDeviceString = "Off" then
    strDeviceString = "Off"
    strDeviceIcon = "closed.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    case "Motion Sensor"
    if strDeviceString = "On" then
    strDeviceString = "On"
    strDeviceIcon = "motion_down.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    if strDeviceString = "Off" then
    strDeviceString = "Off"
    strDeviceIcon = "custom.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    ‘End of Modifications for Icons

    case "Temperature Probe"
    if strDeviceString = "" then
    strDeviceString = "Unknown"
    strDeviceIcon = "unknown.gif"
    else
    'Convert degree character to HTML degree
    strDeviceString = replace(strDeviceString, "°", "°")
    if Instr(strDeviceString, ".") then
    strDeviceIcon = Left(strDeviceString, (Instr(strDeviceString, ".") -1))
    else
    strDeviceIcon = Left(strDeviceString, (Instr(strDeviceString, "°") -1))
    end if
    strDeviceIcon = BuildIcon(strDeviceIcon)
    end if

    case else
    'Ensure images are identical to how HomeSeer Web Control works
    select case cLng(iDeviceStatus)

    case 2 'Device status is ON
    if strDeviceString = "" then strDeviceString = "On" strDeviceIcon = "on.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    case 3 'Device status is OFF
    if strDeviceString = "" then strDeviceString = "Off"
    strDeviceIcon = "off.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    case 4 'Deviced status is Dimmed
    if strDeviceString = "" then
    strDeviceString = "Dimmed to " & FormatPercent(iDeviceValue/100, 0)
    strDeviceIcon = "dim.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if

    case else 'Device status is Unknown
    if strDeviceString = "" then
    strDeviceString = "Unknown"
    strDeviceIcon = "unknown.gif"
    else
    strDeviceIcon = BuildIcon(strDeviceString)
    end if
    end select
    end select

    The icons for the motion sensors and the windows show up as red X's and the device's on/off state shows up as "".

    I was hoping this would be the easiest way to modify icons for my ultraview floor plan.

    What am I doing wrong?

    Thanks,

    BSR
    --------------------------------------------------
    **** Do You "Cocoon"? ****

    #2
    Have you checked the log to see what image it is trying to load? Are your images in the html directory or the images directory, because you'd need to set a path for the image directory.

    It looks to me like your code is conflicting with itself. For example, if your motion sensor is "On", first it sets your icon to:

    strDeviceIcon = "motion_down.gif"

    However, the very next IF for that case, it fails the IF test and therefore sets the icon to:

    strDeviceIcon = BuildIcon(strDeviceString)


    If you are going to set it based on strDeviceString, then you should probably right it as:


    <pre class="ip-ubbcode-code-pre">case "Motion Sensor"
    select case strDeviceString
    case "On"
    strDeviceIcon = "motion_down.gif"
    case "off"
    strDeviceIcon = "custom.gif"
    case else
    strDeviceIcon = "unknown.gif"
    end select
    </pre>

    If an image is in the images directory, add the path "Images/" in front of the image name.

    Comment


      #3
      Also, make sure you have the spelling and cases correct in your case comparisons, because although I'm not sure, they may be case sensitive.

      Comment


        #4
        nolesrule:

        Thanks very much for your time in replying to my problem! I did your code recommendations above and now I get the "unknown" condition for the icons.

        The device's value (On/Off) doesn't seem to be getting to the strDeviceString variable. I've tried all combinations of cases (upper/lower). The device's values show up properly in the "Devices" Homeseer page (as OFF and ON).

        This has me very confused.
        --------------------------------------------------
        **** Do You "Cocoon"? ****

        Comment


          #5
          I use the following script that automatially adjusts the DeviceString in real time based on a device changing status. See http://ubb.homeseer.com/eve/ubb.x?a=...3&m=6932940293

          The results are compatible with both Ultra View2, Ultra View2 Status and the HomeSeer status page.

          Regards,
          Ultrajones
          Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

          Comment


            #6
            BSR, you've got a problem in how your code is written. Using two if-then-else statements in sequence with the comparisons you are using will always result in the LAST if-then-else in each case statement to be executed. So if the device string isn't "Off", then it defaults to the normal HS status code which is done in the BuildIcon() function.

            So, try something like this code and see how it works:

            <pre class="ip-ubbcode-code-pre">
            select case strDeviceType
            case "Window"
            if strDeviceString = "" then
            strDeviceString = "Unknown"
            strDeviceIcon = "unknown.gif"
            else
            if strDeviceString = "on" then
            strDeviceIcon = "open.gif"
            else
            strDeviceIcon = "closed.gif"
            endif
            endif
            ' more case statements here...
            end select
            </pre>

            Now, this code assumes that anything other than "" or "on" means the window is closed, as that is the drop-thru logic.

            Actually, a better way to do this would be:

            <pre class="ip-ubbcode-code-pre">
            select case strDeviceType
            case "Window"
            select strDeviceString
            case "On"
            strDeviceString = "open"
            strDeviceIcon = "open.gif"
            case "Off"
            strDeviceString = "closed"
            strDeviceIcon = "closed.gif"
            case "xyz"
            strDeviceString = "xyz"
            strDeviceIcon = "xyz.gif"
            'add more case statements here to cover any other
            'possible Device Strings in use by the Windows
            'devices
            case else
            strDeviceString = "Unknown"
            strDeviceIcon = "unknown.gif"
            end select

            ' more case statements here...
            end select
            </pre>


            or something similar - you get the idea. You can also add stuff like LastDeviceChange and other things - whatever you want. You can also use something other than the device string for comparisons, like what HS uses - check the BuildIcon function for more ideas.

            FWIW, I combined the use of a text-to-image converter program that Dan-E has used and plugged it into Ultraview to display temps from my TEMP05 device. It took some more work with UV2 files, but it works well.
            |
            | - Gordon

            "I'm a Man, but I can change, if I have to, I guess." - Man's Prayer, Possum Lodge, The Red Green Show
            HiddenGemStudio.com - MaineMusicians.org - CunninghamCreativeMaine.website

            Comment

            Working...
            X