Announcement

Collapse
No announcement yet.

Enable ASP in HS WebServer

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

    Enable ASP in HS WebServer

    Can the HS webserver process ASP? It doesnt seem to. I then installed IIS onto the XP box to see if it just needed the engine installed, but it still doesnt work. How does one get HS to both process HS commands and do ASP at the same time? It seems that all the pages in the HS website are virtualized with simple header/footers. I'd also like to know how i could do a POST with forms or a GET with query strings to have it execute and return as if it was a local running script. This is so i can tie together my Asterisk PBX system with my HomeSeer box instead of using the limited HS Phone system.

    I'm sure i'm overlooking something..

    #2
    The HS webserver supports at least a subset of ASP. Just about all of my interface is ASP pages that I've written. I don't use the HS-provided pages but I do use the HS server. I don't know what might be missing since I've never written ASP for anything else.

    If you can post some examples, there are plenty of people around here who should be able to help.

    Comment


      #3
      Test.asp has:
      PHP Code:
      <%
      response.write "hello"
      html here
       
       
      %>
      response.write "hello"
      html here

      <%
      response.write "hello"
      html here
       
       


      %> 

      but when loaded via browser it says:


      Script error:

      html here

      Something's not right here... Obviously i put the asp tags, but i can't paste it into this post.
      Last edited by Rupp; April 12, 2005, 08:29 PM.

      Comment


        #4
        Ozy,
        You need to use php tags to wrap asp code. I modified the post but make sure that's what you meant to post.
        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

        Comment


          #5
          Originally posted by Rupp
          Ozy,
          You need to use php tags to wrap asp code. I modified the post but make sure that's what you meant to post.
          for bb? ok, well i use the % in the code and it errors.

          Comment


            #6
            Ozy,
            I was talking about this BB. It requires PHP tags to display any "active" code.
            💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

            Comment


              #7
              Ozy,
              If your original post is portraing what you desired then I can explain what the problem is.

              All asp code must be wrapped in the asp tags < % and %> The HTML goes out side the asp tags. One of the parcularities of the HS web server is it will not allow code in two sets of asp tags to "talk" to one another. IIS has no problems with code like the following but HS will not work with this:
              PHP Code:
              <%if 2 then%>
              <
              img src="g.gif">
              <%
              end if%>

              in the HS web server it has to be like:
              <%
               if 
              r=2 then
              response
              .write "<img src=""g.gif"">"
              end if
              %> 
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                Originally posted by Rupp
                Ozy,
                If your original post is portraing what you desired then I can explain what the problem is.

                All asp code must be wrapped in the asp tags < % and %> The HTML goes out side the asp tags. One of the parcularities of the HS web server is it will not allow code in two sets of asp tags to "talk" to one another. IIS has no problems with code like the following but HS will not work with this:
                PHP Code:
                 
                [img]http://board.homeseer.com/g.gif[/img]
                 
                 
                in the HS web server it has to be like
                Ok ya moving the html outside the tag worked, so are you saying that variables are localized between ASP tags? Wow, that is frustrating... that means the homeseer help file under "Controlling Homeseer using ASP" has a bad code sample. That is where i pulled this example i pasted. It has the html inside the tag.

                Comment


                  #9
                  Ok ya moving the html outside the tag worked, so are you saying that variables are localized between ASP tags? Wow, that is frustrating...
                  No the variables are not localized between tags. They are available anywhere on the page.
                  💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                  Comment


                    #10
                    Originally posted by Rupp
                    No the variables are not localized between tags. They are available anywhere on the page.
                    ok cool, so just if / then , for / next, do / while, etc are localized then huh?

                    Also, whats the diff between response.send and response.write.

                    Thx

                    Comment


                      #11
                      Asp tags

                      The HS Board is very funny, sometimes the code tag is best, sometimes the PHP wrap is best. It can get frustrating.

                      As for the "localized" asp code, it can be very frustrating. You can create a variable anywhere and recall it anywhere with no problem. But you cant start a For Next statement, close the tag, write some html and then reopen the tag for Next.

                      The workaround is to convert the html into asp when you need to do it in a loop.

                      This would NOT work:
                      PHP Code:
                      <% for Count 1 to 10 %>
                      <
                      BR>
                       
                      this is line <% Response.Write Count %>
                      <% 
                      next %> 

                      This however would work:
                      PHP Code:
                      <%
                      for 
                      Count 1 to 10
                      Response
                      .Write "<br>
                       this is line  " 
                      &  Count
                      next
                       
                      %> 
                      I GIVE UP!!!!!!!!!!! I have spent 40 minutes trying to get the code on this msg board!!!!!!!! It keeps changing the code no matter what I try! No matter if I use the CODE or PHP wrap tags, you can not show a "Line Break" and the rest of the code is mutilated. I cant beleive the people that wrote this BB software, say there is not a problem with posting codE!!!!!!!!!!!!

                      Here is a screen cap of what I was TRYING to post. This screen cap contains the EXACT code I was trying to post above.
                      Attached Files
                      Last edited by johnwpb; April 13, 2005, 03:12 AM.
                      Visit My Home Seer Site at:
                      www.JohnWPB.com
                      Created with LCARS

                      Comment


                        #12
                        Not sure if anyone really cares but i figured i'd post why i'm doing this. I have a very functional PBX ( http://www.asterisk.org ) at my house for my LLC ( http://www.carandmodel.com ). It handles two inbound landlines and a VOIP inbound / outbound line thru voicepulse. Since this setup is so powerful, i knew i'd never utilize the HS Phone system. I wanted to make it so i could call my pbx and have logic on it query against the HS server for actions & status. I wrote this ASP file and put it on the HS server.



                        PHP Code:
                        dim statipdevicedev_counthcdccommandtempdimval
                        hc 
                        Request.QueryString("hc")
                        dc Request.QueryString("dc")
                        command Request.QueryString("command")
                        dimval Request.QueryString("dimval")
                        dev_count hs.devicecount
                        for 1 to dev_count
                         set device 
                        hs.getdevice(i)
                         if 
                        device.hc hc and device.dc dc then
                          select 
                        case command
                           
                        case "status"
                           
                        stat hs.devicestatus(hc+dc)
                           
                        select case stat
                            
                        case 2
                             temp 
                        "On"
                            
                        case 3
                             temp 
                        "Off"
                            
                        case 4
                             temp 
                        "Dimmed"
                           
                        end select
                           response
                        .write "The "+device.location+" "+device.name+" is "+temp
                           
                        case "on"
                            
                        hs.execX10 hc+dc"on"0,0
                            response
                        .write "I have turned on the "+device.location+" "+device.name+"."
                           
                        case "off"
                            
                        hs.execX10 hc+dc"off"0,0
                            response
                        .write "I have turned off the "+device.location+" "+device.name+"."
                           
                        case "ddim"
                            
                        hs.execX10 hc+dc"ddim"dimval
                            response
                        .write "I have dimmed the "+device.location+" "+device.name+" to "+cstr(dimval)+"%."
                          
                        end select  
                         end 
                        if
                        next 
                        Last edited by Ozy; April 13, 2005, 04:11 AM.

                        Comment


                          #13
                          This allows me to simply send gets to the server over my internal network via an url such as http://10.10.10.15/doit.asp?hc=P&dc=1&command=status . I will have the server reply with text that I wanted repeated to me on the phone.

                          On my pbx, i can easily create menu logic, and for text to speech, i use a unix util called "text2wave". I then put together a perl script (my strength is in perl / php) that my pbx calls when i pick various trigger menus

                          PHP Code:
                          #!/usr/bin/perl
                          use Asterisk::AGI;
                          use 
                          File::Basename;
                          require 
                          Data::UUID;
                          $AGI = new Asterisk::AGI;
                          my $ug = new Data::UUID;
                          my $timestamp gmtime;
                          my %input $AGI->ReadParse();
                          my ($command)=@ARGV;
                          my $text=`lynx -dump 'http://10.10.10.15/doit.asp?$command'`;
                          my $hash $ug->create_str;
                          my $sounddir "/var/lib/asterisk/sounds/tts";
                          my $wavefile "$sounddir/"."tts-$hash.wav";
                          my $t2wp"/usr/bin/";
                          unless (-f $wavefile) {
                                  
                          open(fileOUT">$sounddir"."/say-text-$hash.txt");
                                  print 
                          fileOUT "$text";
                                  
                          close(fileOUT);
                                  
                          my $execf=$t2wp."text2wave $sounddir/say-text-$hash.txt -F 8000 -o $wavefile";
                                  
                          system($execf);
                                  
                          unlink($sounddir."/say-text-$hash.txt");
                          }
                          $AGI->stream_file('tts/'.basename($wavefile,".wav")); 
                          I'll attach a wav file shortly so everyone can here how it sounds.

                          Comment


                            #14
                            A clip from my Asterisk extension file:

                            PHP Code:
                            [custom-homeseer]
                            exten => s,1,Answer
                            exten 
                            => s,2,AGI(festival-script.pl|Please wait while I contact the homeseer server.)
                            exten => s,3,AGI(homeseer.pl|hc=P&dc=1&command=status)
                            exten => s,4,Hangup 
                            To test quality i had it say:

                            Hallway Kicklights. Entry Entry Way. Outside Entry Door. Outside
                            Courtyard. Hallway South Hallway. Hallway North Hallway. Garage Garage
                            Lights. Entry Foyer Recessed Lights. Kitchen Recessed Lights. Kitchen
                            Breakfast Light. Kitchen Motion Sensor. Hallway Bathroom Motion
                            Sensor. Hallway South Motion Sensor. Hallway North Motion Sensor.
                            Hallway Bathroom Recessed Lights. Garage Motion Sensor. DooMotion
                            Plugin Status. DooMotion Plugin Last Motion. DooMotion Plugin House
                            Occupancy Sensor. Kitchen DD Motion Sensor. Garage DD Motion Sensor.
                            Hallway Bathroom DD Motion Sensor. Outside Motion Sensor 1. Kitchen
                            Welcome Chime. Kitchen Alert Chime. Family Room Right Fan Light.
                            Family Room Left Fan Light. Media Player Status. Media Player Title.
                            Media Player Album. Media Player Artist. Media Player Genre. Media
                            Player Length. Media Player Loop Mode. Media Player Shuffle Mode.
                            Media Player Mute. Media Player Display Controls. Media Player Quick
                            Genre. Media Player Quick Artist. Media Player Quick PlayList. Media
                            Player Quick Album. Garage Right Door. Outside Front Gate. Garage Left
                            Door. Garage Left Door Trigger. Garage Right Door Trigger. Family Room
                            Recessed Lights. Outside Front Camera. SmartHome IRLinc 1623 IRLinc
                            Probe Status. Garage Garage Status. Master Bathroom Recessed Lights.
                            Master Bathroom Chris's Sink. Master Bathroom Motion Sensor. Master
                            Bathroom DD Motion Sensor. Outside Side Gate. Outside Courtyard
                            Status.

                            I attached the wav's in a zip file.

                            http://www.f20c.com/stuff/homeseer-asterisktest.zip

                            Comment

                            Working...
                            X