Dynamic Webserver (variable processing)

Questions and comments specific to a particular plugin should go here.

Re: Dynamic Webserver (variable processing)

Postby sjolof » Tue May 26, 2009 4:44 pm

Pako wrote:You can try this great (and free) editor:
http://www.pspad.com/en/
Excuse me, if I am writing nonsense. I did not follow the whole topic.

Pako



Hey!
That was a great piece of software!

Thanks! :D
sjolof
 
Posts: 27
Joined: Tue Aug 21, 2007 11:22 am

Re: Dynamic Webserver (variable processing)

Postby Livin » Fri May 29, 2009 1:23 am

Bitmonster,
No comments on my idea?


Livin wrote:Bit,
Interested to hear your thoughts on this idea.

Create a set of properties for each Macro and Action, then have the web code auto-generate the web pages based on the properties.

Example...

Macro 'Media Center - on'
Type: trigger
States: <last triggered date/time>
Web Visible: yes
Web Page: 'Main'
Tab Order: 1
Label: "Media Center"
Images: TriggerOn.gif/TriggerOff.gif

Device 'Kitchen Lights'
Type: slider
States: off/10/20/30/40/50/60/70/80/90/100
Web Visible: yes
Web Page: 'Main'
Tab Order: 2
Label: "Kitchen Lights"
Image base: SliderVertible.jpg
Image movable: SliderThumbVerticle.jpg

Device 'Ceiling Fan'
Type: toggle
States: on/off
Web Visible: yes
Web Page: 'Master Bedroom'
Tab Order: 2
Label: "Ceiling Fan"
Image on: ToggleHighOn.gif/ToggleLowOn.gif
Image off ToggleHighOff.gif/ToggleLowOff.gif
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Dynamic Webserver (variable processing)

Postby kingtd » Mon Jun 15, 2009 11:32 pm

Thanks Bitmonster. This actually works really well, and I've converted my pages over to use this version of the webserver.

It does have one bug though. In most AJAX scenarios, if you want to update an image to get around the image caching of the browser, you add a fake parameter to the image.

Example: http://home/albumart.jpg?bogus=12481428

Unfortunately this doesn't work with your code. There are two lines that need to be added to the translate_path function in order to fix this:
path = path.split('?',1)[0]
path = path.split('#',1)[0]

Otherwise the parameters get included in the filepath and eventghost fails to serve up the file. I'd also recommend including .XML in the list of parsed code, or allow the list to be edited as a configuration parameter on the plug-in.

~K

Code: Select all
    def translate_path(self, path):
        """Translate a /-separated PATH to the local filename syntax.

        Components that mean special things to the local file system
        (e.g. drive or directory names) are ignored.  (XXX They should
        probably be diagnosed.)

        """
        # stolen from SimpleHTTPServer.SimpleHTTPRequestHandler
        # but changed to handle files from a defined basepath instead
        # of os.getcwd()
        path = path.split('?',1)[0]
        path = path.split('#',1)[0]
        path = posixpath.normpath(unquote(path))
        words = [word for word in path.split('/') if word]
        path = self.server.basepath
        for word in words:
            drive, word = os.path.splitdrive(word)
            head, word = os.path.split(word)
            if word in (os.curdir, os.pardir):
                continue
            path = os.path.join(path, word)
        return path
kingtd
Plugin Developer
 
Posts: 78
Joined: Fri Jul 13, 2007 7:39 am

Re: Dynamic Webserver (variable processing)

Postby Fiasco » Mon Aug 03, 2009 3:10 am

How do I?

I've got a Onkyo receiver. When it changes frequency it initiates a TUN event. However, the frequency tuned to is not the payload event but actually part of the event.

ie,

OnkyoSerial.TUN.09110

How do I pick that last part off to assign it to my eg.globals.tunerfrequency variable?

How do I cause any event that starts with OnkyoSerial.TUN to trigger this macro that makes the variable assignment? (event on OnkyoSerial.TUN.*)?
User avatar
Fiasco
Plugin Developer
 
Posts: 215
Joined: Fri Jul 24, 2009 5:32 am
Location: St. Louis MO

Re: Dynamic Webserver (variable processing)

Postby Fiasco » Mon Aug 03, 2009 4:38 pm

Figured it out. I'm assigning eg.event.suffix
User avatar
Fiasco
Plugin Developer
 
Posts: 215
Joined: Fri Jul 24, 2009 5:32 am
Location: St. Louis MO

Re: Dynamic Webserver (variable processing)

Postby miljbee » Wed Jan 27, 2010 12:13 pm

Hello,

the "new" webserver is still not included in the latest build ? or am I missing something ?
miljbee
Experienced User
 
Posts: 137
Joined: Fri Mar 27, 2009 1:29 pm

Re: Dynamic Webserver (variable processing)

Postby paseant » Thu Feb 25, 2010 6:10 pm

Hi. I am trying the dynamic webserver plugin and have found that directory listings do not work, showing only a white page. Is it a known problem?

Other problem that I has really tried to solve but couldn't is the use of non ascii characters. I have read that
Templates must be stored in UTF-8 if they use non-ASCII characters. So set you editor accordingly.
I am using Notepad++ and tried utf-8 with and without BOM with no luck. I have read http://boodebr.org/main/python/all-about-python-and-unicode and http://www.joelonsoftware.com/articles/Unicode.html trying to understand the whole thing. My intended use is getting a template file called through ajax where the variables get replaced with strings with non ascii characters, but to put it in more simpler terms, how can I include a non ascii character in the light.html example and make it work?

I have managed to make eventghost write directly a text file with non ascii characters in the variables I am interested in and calling it from the web page works without problem. The same file (changing .txt to .html) doesn't work when processed with the dynamic webserver.

Thanks for any help.

Now using Eg 0.3.7.r1366, Windows Vista 6.0.6002-SP2.
paseant
 
Posts: 19
Joined: Sat Jan 26, 2008 1:06 am

Re: Dynamic Webserver (variable processing)

Postby rgoolsby » Tue Mar 02, 2010 4:22 pm

I am attempting to get the dynamic webserver plugin working with VMC Controller on Windows 7.

I tried to following along to prior posts.. but was having some difficulty as my setup is slightly different using Win7.

This release works in Windows 7 (says it includes everything but EPG):
http://vmccontroller.codeplex.com/releases/view/34386

When I enable to VMC Controller plugin installed and when I first load VMC I see several items in the log showing VMC.volumelevel, VMC.mute="false" etc and when I navigate through VMC I see VMC.Keypress ="##" but that's all that shows up.

I don't see any artist or track information no matter what is played. When I telnet to the default port I see the same information as I do in the log... so I have a feeling that its with the VMC Controller and not with the EG plugin but I thought I would ask if anyone has this working on Windows 7 yet.


(I dont have VMC in front of me so I could be wrong about the exact terms for the VMC.XXXX showing the log...)

Thanks in advance.
rgoolsby
 
Posts: 6
Joined: Tue Feb 23, 2010 2:38 am

Re: Dynamic Webserver (variable processing)

Postby Diabl0570 » Sun Apr 25, 2010 3:02 pm

hi all,

is it possible to send a GET of POST variable to eventghost?
or is there any other method to send variable to eventghost via the dynamic webserver?

thanks in advanced!
Diabl0570
 
Posts: 30
Joined: Sun Feb 28, 2010 6:05 pm

Re: Dynamic Webserver (variable processing)

Postby e-michi » Tue Jun 15, 2010 12:39 pm

Hi,
i had 2 questions to the variables:
- Can i use the variables in Macromedia Flash (swf file)? (go to a picture in Timeline)
- Can i set a variable to a value from 1-100 or to a word?
e-michi
 
Posts: 7
Joined: Sun Jun 06, 2010 9:57 am

Re: Dynamic Webserver (variable processing)

Postby mcdanne82 » Thu Jul 22, 2010 5:50 am

I want to control some things through a webpage.
The units has several different values so I want the EG to take two input variables from a webpage request and put it as”command line options” when I execute a external program.

http://localhost/?LightDim?2?20
On this way I get the values 2 and 20 into EG.
But how is the smartest solution to extract these two variables from the requestline and to execute a commandfile?
I have tried a phyton script with the split command but I didn’t get all the way.

I have this as test webpage that will control and show the values.

eg.globals.exampleA = {{eg.globals.exampleA}}
eg.globals.exampleB = {{eg.globals.exampleB}}
eg.globals.exampleC = {{eg.globals.exampleC}}

<a href="?LightDim?20?3">Dimma 20%</a>
<a href="?LightDim?50?4">Dimma 50%</a>
<a href="?LightDim?70?5">Dimma 70%</a>
mcdanne82
 
Posts: 5
Joined: Sun Jul 18, 2010 4:50 pm

Re: Dynamic Webserver (variable processing)

Postby tohenrik » Fri Aug 06, 2010 10:04 pm

first i want to say that this plugin is very nice, just finished the first step on my web page, and it works great!

Maybe this will help someone:
I got a lot of this error message in eventghost
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 1053: ordinal not in range(128)

this was becouse i used a lot of ØÆÅ in my text on the page(common in the norwegian, swedish, danish language), I solved this by using UTF-8 kodes in my html file

&aring; for å
&aelig; for æ
&oslash; for ø

I know a lot of the folks from sweden use ö:
&ouml; for ö

this will not work example1 (results in a blank page, and a error in eventghost):
Code: Select all
alt av eller på (vil lyse hvis en enhet er på) {{"<a href='?allOFF'><img src='on.png' width='30' height='50' border='0' /></a>" if kjokkenState or gangstate or stuestare else "<a href='?allON'><img src='off.png' width='30' height='50' border='0' /></a>"}}
*"alt av eller på (vil lyse hvis en enhet er på)" = everything off or on (will light if one unit is on)

this will work example1:
Code: Select all
alt av eller p&aring; (vil lyse hvis en enhet er p&aring) {{"<a href='?allOFF'><img src='on.png' width='30' height='50' border='0' /></a>" if kjokkenState or gangstate or stuestare else "<a href='?allON'><img src='off.png' width='30' height='50' border='0' /></a>"}}


this will not work example2 (results in a blank page, and a error in eventghost):
Code: Select all
<title>strømstyring</title>


this will work example2:
Code: Select all
<title>str&oslash;mstyring</title>
tohenrik
 
Posts: 2
Joined: Fri Aug 06, 2010 9:39 pm

Re: Dynamic Webserver (variable processing)

Postby regi24 » Sat Oct 23, 2010 6:58 pm

Is there any way to refresh the variables using AJAX so the whole page doesn't have to be refreshed??
regi24
 
Posts: 3
Joined: Thu Sep 09, 2010 5:44 pm

Re: Dynamic Webserver (variable processing)

Postby Livin » Sat Dec 18, 2010 12:51 am

kingtd
Did you finish your UI?
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Dynamic Webserver (variable processing)

Postby jodygr » Fri Jan 14, 2011 9:54 pm

what's a good program to create dynamic webpages
jodygr
 
Posts: 1
Joined: Fri Oct 02, 2009 5:09 pm

PreviousNext

Return to Plugin Support

Who is online

Users browsing this forum: Google Adsense [Bot] and 5 guests