Announcement

Collapse
No announcement yet.

.asp page to display all devices

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

  • jon00
    replied
    I don't know, however the Scheduler.Classes.DeviceClass is not supported either so even if you do get the references, you are still in trouble.

    Leave a comment:


  • jwshome2
    replied
    Thanks. One last try to be able to do this in HS4 "natively", so to speak - there are references in the forum and in some HS4 documentation to a function called 'GetAllRefs' - is that working?

    Regards.

    Leave a comment:


  • jon00
    replied
    Correct for both points...the hs4 scripting documentation is not finished. The hs3 documentation is valid in HS4.

    Leave a comment:


  • jwshome2
    replied
    Jon,

    Thanks for the quick reply. I assume hs.runscriptfunc allows an asp page to call a vb.net script and take the output in a similar fashion to a function returning values? If that is correct, could you point me towards the documentation in HS4 for how to use this function? Of course, given the state of HS4 documentation I can't find that - would I just use the HS3 documentation?

    Thanks.

    Leave a comment:


  • jon00
    replied
    I think the issue is that Scheduler.Classes.clsDeviceEnumeration is not referenced correctly in VBScript within HS4.

    I very much doubt there will support changes for this as vbs/asp is dead in the water and has never worked on Linux either.

    You could define this code in a vb.net script and use the hs.runscriptfunc in your asp page to return the result.

    Leave a comment:


  • jwshome2
    replied
    Jon, using the .aspx code you posted (which works in an .aspx page) is causing some other problems for me - basically, I need to convert a very long and complex script to aspx from asp, and I'd rather not go through that if I don't have to. Isn't there a way to enumerate and get access to all devices on an .asp page? It seems odd that this is not possible.

    Thanks in advance for any help you or others can provide.

    Leave a comment:


  • George
    replied
    Yup, Jon's DeviceListViewer is really invaluable for not just finding the odd device but also all the info needed if you are writing any scripts or immediate commands.

    Leave a comment:


  • jwshome2
    replied
    Excellent, that worked for me - thanks so much. Is there a list somewhere of what functionality works on an .asp page and what requires .aspx? Just curious ...

    Leave a comment:


  • mikee123
    replied
    Originally posted by jon00 View Post
    Ok I'll grab that. Strange that I've never noticed it before

    Leave a comment:


  • jon00
    replied
    Originally posted by mikee123 View Post
    Yes thats working now. Interesting. I can imagine it be be useful having the device ref, room and device type with every device. Thats something I would have liked to have sometimes, especially on a bigger system.
    That is what this was for: https://forums.homeseer.com/forum/3r...eer-3?t=178217

    Leave a comment:


  • mikee123
    replied
    Yes thats working now. Interesting. I can imagine it be be useful having the device ref, room and device type with every device. Thats something I would have liked to have sometimes, especially on a bigger system.

    Leave a comment:


  • jon00
    replied
    Put this at the very bottom of the page after the 'End Sub'

    Code:
    </script>

    Leave a comment:


  • mikee123
    replied
    Originally posted by jon00 View Post
    No, you would save it in the html directory and call it something like devicelist.aspx

    You would then call devicelist.aspx from your Homeseer web server as a web page.
    I saved it as Devicelist.aspx in the html directory. I then typed MyIP:Port/Devicelist.aspx in the address bar. I got a error page

    Server Error in '/' Application.
    Parser Error
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Unexpected end of file looking for </script> tag.

    Source Error:


    Line 1: <%@ Page Language="VB" %>
    Line 2: <script runat="server">
    Line 3: Public hs As Scheduler.hsapplication
    Line 4: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    Source File: /Devicelist.aspx Line: 2

    Leave a comment:


  • jon00
    replied
    No, you would save it in the html directory and call it something like devicelist.aspx

    You would then call devicelist.aspx from your Homeseer web server as a web page.

    Leave a comment:


  • mikee123
    replied
    Originally posted by jon00 View Post
    GetDeviceEnumerator works fine...just not an asp web page.

    This works using an .aspx page:

    Code:
    <%@ Page Language="VB" %>
    <script runat="server">
    Public hs As Scheduler.hsapplication
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    hs = Context.Items("Content")
    
    Dim EN As Scheduler.Classes.clsDeviceEnumeration
    Dim dv As Scheduler.Classes.DeviceClass
    
    EN = hs.GetDeviceEnumerator
    
    If EN Is Nothing Then
    response.write ("Error getting Enumerator")
    response.end()
    End If
    
    do
    dv = EN.GetNext
    If dv Is Nothing Then exit Do
    response.write (dv.name(Nothing) & "<br>")
    
    loop
    
    response.write ("Finished")
    
    End Sub
    This sounds interesting. I copied the code and saved it as a script. I did run it but nothing happened. I guess this is to run as a part of something else ?

    Leave a comment:

Working...
X