Webserver

Questions and comments specific to a particular plugin should go here.
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Webserver

Post by Pako » Thu Feb 18, 2016 7:57 am

I do not know where the problem is.
For me, it works as expected.

Note:
This can be a problem when there are identically named variables (persistent and temporary).

Pako
You know flattr ? You can Image

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Webserver

Post by yokel22 » Fri Feb 19, 2016 7:34 am

That is likely what it is. I'm using the same #id's for setting temp & persistent variables. I'll try a different tag selector & see what happens. Thanks.

wysocki
Experienced User
Posts: 72
Joined: Mon Nov 23, 2015 9:23 pm
Location: Los Angeles area

Re: Webserver

Post by wysocki » Fri Feb 19, 2016 11:46 pm

Think I found a bug in the Periodic broadcast. If you run the Periodically Broadcast Data several times consecutively, then do a Stop Periodic Tasks, it doesn't stop them all. Try this example, run the first macro a few times then run the second once. Webserver still broadcasts regularly until you run the second macro again. There's not a one for one relationship (I ran the first macro 10 times then had to run the second macro 4 times to stop all broadcasts).
Capture.JPG
Capture.JPG (19.96 KiB) Viewed 7925 times

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Webserver

Post by Pako » Sat Feb 20, 2016 8:12 am

Yes, it looks like a bug. I try to make it more stupid-resistant.
What's the point of run one the same task "Periodically Broadcast" multiple times?

Pako
You know flattr ? You can Image

wysocki
Experienced User
Posts: 72
Joined: Mon Nov 23, 2015 9:23 pm
Location: Los Angeles area

Re: Webserver

Post by wysocki » Mon Feb 22, 2016 4:41 pm

I created a mailbox monitor. I put a magnetic sensor switch on the mailbox door, and when the mailman (or someone else) opens the door, it was wired to an X10 module which runs a macro broadcasting the event every 5 minutes until someone resets it. Sometimes the door gets opened a couple times before it gets reset. One STOP command did not silence all the events.

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Webserver

Post by Pako » Mon Feb 22, 2016 5:29 pm

It is not desirable to unnecessarily start tasks running in the background.
This can be solved in different ways. For example:

Solution 1:
You can introduce (temporary) variable "Running". This variable can be boolean. Before you want to start periodic broadcasting, first you will test the value of the variable. If Running == True, you will not re-run the same task. If Running == False, you can normally start your task and change the value to True.
Once you stop task, you change the state of variable Running to False.

Solution 2:
Before start of each periodic tasks, you can preemptively stop tasks that were perhaps previously running (it can be a hindrance in some cases).

Note:
Appropriate actions to test the state of variables not yet exist.
For example you can use the method as shown in attached picture.

Pako
Attachments
VariableTest.png
VariableTest.png (5.41 KiB) Viewed 7894 times
You know flattr ? You can Image

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Webserver

Post by yokel22 » Tue Mar 08, 2016 9:23 pm

Pako, i was wondering if you'd consider adding a delete persistent/temporary variable action to the plugin? FYI: your advise on the persisent/temp variables a few posts back was spot on.

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Webserver

Post by Pako » Fri Mar 18, 2016 9:53 am

yokel22 wrote:Pako, i was wondering if you'd consider adding a delete persistent/temporary variable action to the plugin?
I'll think about it.

Pako
You know flattr ? You can Image

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Webserver

Post by V_J » Sat Apr 30, 2016 3:12 pm

Im trying to send an event to another webserver and get the message "the authentication line is badly formed"

The webserver is on a Loxone Miniserver (some home automation thing), and I want to send an http command that looks like this:
-
http://user:password@ipaddress/dev/sps/ ... able/value
-
This works in a browser. The value field should be an eg value from the payload. In the send event to another webserver, I set the following:
-
event: value
utl: http://ipaddress/dev/sps/io/variable/
username: user
password: password
-
But I get the message "the authentication line is badly formed.

Any thoughts?

Thanks,


Jorg

User avatar
Sem;colon
Plugin Developer
Posts: 887
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Webserver

Post by Sem;colon » Sun May 01, 2016 9:12 am

Try to not fill event, username and password in the action and use the url you used on the browser
If you like my work, Image me a drink :wink:

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Webserver

Post by V_J » Mon May 02, 2016 8:12 am

I tried that, but it gave a different error. I will be able to post it in a few days.

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Webserver

Post by V_J » Mon May 02, 2016 5:21 pm

If I do not put an event, username or password, and put the url as in the previous post, I get the following errors:
-
Error in Action: "Webserver: Send event to another webserver: "
Traceback (most recent call last) (1700):
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
return self(*args)
File "C:\Program Files (x86)\EventGhost\plugins\Webserver\__init__.py", line 3530, in __call__
handle = urlopen(req)
File "urllib2.pyc", line 126, in urlopen
File "urllib2.pyc", line 391, in open
File "urllib2.pyc", line 409, in _open
File "urllib2.pyc", line 369, in _call_chain
File "urllib2.pyc", line 1161, in http_open
File "urllib2.pyc", line 1107, in do_open
File "httplib.pyc", line 657, in __init__
File "httplib.pyc", line 682, in _set_hostport
InvalidURL: nonnumeric port: 'admin@192.168.2.3'
-
In the url, I used admin for both username and password (temporary change).

User avatar
Sem;colon
Plugin Developer
Posts: 887
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Webserver

Post by Sem;colon » Mon May 02, 2016 9:23 pm

I'm sorry, you're right...
You Need to use the Username and Password field.
But leave the Event blank.
Like: http://ipaddress:80/dev/sps/io/variable/value

For testing you could also deactivate the Password on your Loxone Server.
If you like my work, Image me a drink :wink:

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Webserver

Post by V_J » Fri May 06, 2016 8:15 am

If I do not put an event, but just the website, and a username (I removed the password on the server), I get
-
Webserver: Send event to another webserver:
The authentication line is badly formed.
-
Not sure if it is related, but it is the same error message I get when I put a non-existing username.

Jörg

V_J
Experienced User
Posts: 237
Joined: Tue Mar 04, 2014 9:00 am

Re: Webserver

Post by V_J » Fri May 06, 2016 4:59 pm

Ok, I made a mistake... I had '/' in the url in stead of '\'... However, it does not work with '\' either; it gives the following:
-
Webserver: Send event to another webserver:
This page isn't protected by authentication.
But we failed for another reason.
Error in Action: "Webserver: Send event to another webserver: "
Traceback (most recent call last) (1700):
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
return self(*args)
File "C:\Program Files (x86)\EventGhost\plugins\Webserver\__init__.py", line 3537, in __call__
print "ERROR "+str(e.code)
AttributeError: 'URLError' object has no attribute 'code'
-
I cannot disable authentication to the server to check, but the behaviour is the same with our without password (I can disable password).

Jörg

Post Reply