Announcement

Collapse
No announcement yet.

Poll Devices Button vs. Polling Script: What's the Problem?

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

    Poll Devices Button vs. Polling Script: What's the Problem?

    Ok... I got my replacement PowerLinc 2414U.

    Why does the Pole Devices button in the GUI correctly get the status, but this srcipt doesn't work? What is the Poll Devices code doing differently?

    For example, the script logged this light as being On, although it is Off. If I use the Poll Devices button in the GUI, the status is correctly reported.

    Script output:

    12/29/2005 12:38:41 PM poll.txt Finished polling device: Family Room Light Switch (West). Status is 17. Value is 100.

    I checked the PLC, and that switch is listed as Master and Slave in it's table.

    Thanks for any help.

    Eric

    ______________________


    sub main()


    dim en


    dim dv

    set en=hs.getdeviceenumerator

    if isobject(en) then




    else
    hs.writelog"poll.txt","The device enumerator is invalid."




    end if




    do while not en.finished


    if en.countchanged then
    hs.writelog"poll.txt","The device count has changed."




    end if




    set dv=en.getnext




    if not dv is nothing then




    if dv.status_support then




    'poll the device


    hs.polldevice dv.hc & dv.dc
    hs.writelog "poll.txt","Finished polling device: " & dv.location & " " & dv.name & ". Status is " & hs.devicestatus(dv.hc & dv.dc) & ". Value is " & hs.devicevalue (dv.hc & dv.dc) & "."


    end if




    end if




    loop



    hs.writelog "poll.txt","Finished."


    end sub
Working...
X