Page 7 of 23
Re: Webserver
Posted: Sun Nov 30, 2014 6:09 am
by Pako
Sem;colon wrote:Since version 3.0 the "Send event to another EventGhost" function is not working any more
You are right.
I do not use it and I forgot to test it.
In the attached version is the bug fixed.
Pako
Re: Webserver
Posted: Sat Dec 06, 2014 3:31 pm
by clabos
Hi
I am new here but I have been using EG for a couple of years. Now I would like to show some information I get from my Micasaverde Vera3 Lite (such if some doors are opened or closed) on a simple webpage. The problem is that I can't make the Webserver plugin (running v3.3 from this thread) substitute global variables - they just come out empty.
For instance I have this in my html page:
Code: Select all
Garage door is {{eg.globals.garage}}.
The variable "garage" has the value "opened" when I look at it in the Persistent Variable Manager. The value is set by different events and can be either "opened" or "closed".
When I request the webpage the result is:
Garage door is .
EG just filters out the {{eg.globals.garage}} and replaces it with an empty string.
I am sure there is something very simple I am missing, questions is what... I have only three plugins running: Webserver, Swithcking, Micasaverde Vera (in that order).
I haven't been able to find anyone asking this stupid question before so any ideas are very welcome.
Re: Webserver
Posted: Sat Dec 06, 2014 3:56 pm
by Pako
Re: Webserver
Posted: Sat Dec 06, 2014 4:49 pm
by clabos
It works! I tried all variants I could think of except that one.
Thanks Pako for the quick help!
Re: Webserver
Posted: Mon Dec 08, 2014 9:40 pm
by eirik226
Hey!
Not sure if this would be the right place to post something like this, since it's not a problem with the plugin itself. I'll hope for the best anyway!
Explanation of what I want to do:
I have created a webpage that I controll everything from (Spotify, Xbmc, my computer etc) that runs from the webserver. Recently however I've had some ideas to an improvement but I can't for the life of me figure out how to do that. What I want to do is for example have a picture of my TV on the webpage (A black TV, aka a TV that's off and not on) and when I press it the TV change picture to a TV that is on (This is to display that the TV is on in real life on the webpage). I have actually gotten this to work, but here is where the problem occurs - I access the webpage from many different things, such as my computer, my laptop, my phone and my tablet. And if I press the TV on lets say my laptop it does not affect the webpage on my computer or my mobile.
So basically what I am asking is if theres anyway to save and share what picture should be visible on every thing I access the webpage on? Another problem occurs if I update the webpage (like pressing f5 in your webbrowser does). The picture goes back to the "off state" even if the TV is on.
is it even possible with the webserver plugin?
I've searched around but since it's so hard to explain what I'm trying to do it's hard for me to find good search words to use.
Thanks for all the help, and sorry if this would be a wrong place to ask this kinda question.
Re: Webserver
Posted: Tue Dec 09, 2014 7:30 am
by krambriw
The key to solve the problem is using a persistent variable for the TV status (on/off) so that it 'survives' a page reload and web-sockets to distribute the same status information to all clients. In this way, the status of your TV will be shown correctly on all connected web clients and if you change it it on any, all the others will be automatically updated.
What is now the easiest way to fix your problem? I think if you zip and put your html file here it will be the easiest and someone (like me) can have a look at it. Or you read the thread about how to add web-socket support and how to use a persistent variable.
BR
Re: Webserver
Posted: Tue Dec 09, 2014 9:47 am
by eirik226
Thanks for your quick answer! I sent you a PM
EDIT: I did try to see if I could do this on my own, basically thats a no. I clearly have no idea what I'm doing.
Re: Webserver
Posted: Tue Dec 09, 2014 12:25 pm
by krambriw
Dear Pako,
I have been running this webserver plugin version 3.3 starting yesterday morning as normal http and I am using the built-in websocket services. It is working fine from my perspective regarding the functionality (I am however not using all available options).
I do not know if it's only me having a problem with my connected websocket clients, mostly android devices, they are being disconnected very frequently. I need to inform that they are all connected wireless so it could be that this is related to short breaks in my wifi network. However, I do not think I had this type of problem with the tornado webserver or the websocket suite...
So my question: do you think it is possible to have a timeout before the websocket clients gets disconnected?
Currently I have solved it in a "dirty way" monitoring 'wSocket.onclose' message and making a 'wSocket.onopen' call right away when this happens but I would like to have a correct solution instead
Also, one suggestion, should it not be possible to have a setting in the plugin for the websocket port to be used?
My best regards, Walter
Re: Webserver
Posted: Tue Dec 09, 2014 1:13 pm
by eirik226
krambriw wrote:What is now the easiest way to fix your problem? I think if you zip and put your html file here it will be the easiest and someone (like me) can have a look at it. Or you read the thread about how to add web-socket support and how to use a persistent variable.
Did you receive the PM i sent? Unsure if your inbox is full or not, thats a common problem on some forums I guess. Sorry for the nagging if you did.
Re: Webserver
Posted: Tue Dec 09, 2014 1:22 pm
by krambriw
@eirik226
Yes, received
Re: Webserver
Posted: Tue Dec 09, 2014 3:34 pm
by Pako
Dear Walter !
krambriw wrote:I do not know if it's only me having a problem with my connected websocket clients, mostly android devices, they are being disconnected very frequently. I need to inform that they are all connected wireless so it could be that this is related to short breaks in my wifi network. However, I do not think I had this type of problem with the tornado webserver or the websocket suite...
What does it mean "very frequently"?
It can be expressed using some number?
It can be said that (for example) more than 10 minutes keeps no connection?
It is a regular phenomenon, or some connection keeps long?
Have you tried a local connection (localhost)? It also breaks down?
krambriw wrote:So my question: do you think it is possible to have a timeout before the websocket clients gets disconnected?
I think it is possible to set a timeout for each socket. However, I feel that there is something strange was happening and so it does not help.
I do not have this problem at all.krambriw wrote:Also, one suggestion, should it not be possible to have a setting in the plugin for the websocket port to be used?
I have a desire to say "it's impossible".
Of course - almost everything is possible in this field.
However, it does not make sense. In fact - it would have to run two servers. One for http (https) and the other (on a different port) for ws (wss).
I see no advantage in such solutions.
Best regards,
Luboš
Re: Webserver
Posted: Tue Dec 09, 2014 4:06 pm
by krambriw
Dear Pako,
What does it mean "very frequently"?
This is from a client connected via wired LAN, time connected varies
Code: Select all
2014-11-09 14:22:28 Connection opened: 192.168.10.50:8282
2014-11-09 16:10:0 Connection opened: 192.168.10.50:8282
2014-11-09 16:42:38 Connection opened: 192.168.10.50:8282
2014-11-09 16:55:38 Connection opened: 192.168.10.50:8282
This is from two android tablets connected wireless, breaks more frequent
Code: Select all
2014-12-09 16:01:01 EVENT: HTTP.WsClientDisconnected [('192.168.10.3', 55720)]
2014-12-09 16:01:01 EVENT: HTTP.WsClientConnected [('192.168.10.3', 55731)]
2014-12-09 16:01:02 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.3', 55731)]
2014-12-09 16:05:01 EVENT: HTTP.WsClientDisconnected [('192.168.10.2', 43188)]
2014-12-09 16:05:02 EVENT: HTTP.WsClientConnected [('192.168.10.2', 43194)]
2014-12-09 16:05:02 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.2', 43194)]
2014-12-09 16:14:02 EVENT: HTTP.WsClientDisconnected [('192.168.10.2', 43194)]
2014-12-09 16:14:02 EVENT: HTTP.WsClientConnected [('192.168.10.2', 43195)]
2014-12-09 16:14:02 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.2', 43195)]
2014-12-09 16:14:36 EVENT: HTTP.WsClientDisconnected [('192.168.10.2', 43195)]
2014-12-09 16:14:36 EVENT: HTTP.WsClientConnected [('192.168.10.2', 43196)]
2014-12-09 16:14:36 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.2', 43196)]
2014-12-09 16:36:08 EVENT: HTTP.WsClientDisconnected [('192.168.10.3', 55731)]
2014-12-09 16:36:08 EVENT: HTTP.WsClientConnected [('192.168.10.3', 55736)]
2014-12-09 16:36:08 EVENT: HTTP.WsClientDisconnected [('192.168.10.2', 43196)]
2014-12-09 16:36:08 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.3', 55736)]
2014-12-09 16:36:15 EVENT: HTTP.WsClientConnected [('192.168.10.2', 43200)]
2014-12-09 16:36:15 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.2', 43200)]
2014-12-09 16:37:36 EVENT: HTTP.WsClientDisconnected [('192.168.10.3', 55736)]
2014-12-09 16:37:36 EVENT: HTTP.WsClientConnected [('192.168.10.3', 55737)]
2014-12-09 16:37:37 ['u\'HTTP."WebSocket', 'rocks"\'']HTTP."WebSocket rocks" [('192.168.10.3', 55737)]
Have you tried a local connection (localhost)? It also breaks down?
It is running this test now until tomorrow and then we will see
My question regarding ports, of course you are right
I suspect something strange happening in my network but have not found it yet...
Thanks for looking into this,
My best regards, Walter
Re: Webserver
Posted: Tue Dec 09, 2014 5:04 pm
by Pako
Dear Walter,
Now I've got a much more accurate picture of the problem.
I still have no idea what is happening.
We will wait for localhost test.
BTW: I created a WebSocket connection (from Android phone/Firefox browser) at 15:55. Right now is 18:05 and the connection keeps.
Best regards,
Luboš
Re: Webserver
Posted: Wed Dec 10, 2014 10:26 am
by eddiex666
Hi,
how can i simply pipe/read (or write ) all the variables into a txt / html file?
(I tryed the choice inside webserver plugin that sayes ""automatic saves the documents ......" but I cannot se any files with this info?)
Eddie
Re: Webserver
Posted: Wed Dec 10, 2014 12:16 pm
by krambriw
Dear Pako,
Related to yesterdays description of problems I am facing I think I have analyzed the situation a bit further
- the same problem is also happening when locally connected
- the same behaviour with Chrome and Firefox
- from time to time, it is working better, less disconnects
The computer is not so powerful and has a lot of tasks to do. I suspect now a computer performance issue and not the network because when I this morning disabled logging in the log view, it seems to work more stable (if the log view is active, a lot of events are normally happening since it is my house automation system).
However, interesting log results are the following:
The browser when connected is logging re-connections to its own window and this is from the locally connected browser (Chrome). A connection lasts from 10 - 20 minutes, sometimes less
From part of the night with logging enabled
Code: Select all
2014-11-10 2:29:15 Connection opened: 192.168.10.50:8282
2014-11-10 2:36:8 Connection opened: 192.168.10.50:8282
2014-11-10 2:37:45 Connection opened: 192.168.10.50:8282
2014-11-10 2:53:44 Connection opened: 192.168.10.50:8282
2014-11-10 3:3:22 Connection opened: 192.168.10.50:8282
2014-11-10 3:18:36 Connection opened: 192.168.10.50:8282
2014-11-10 3:26:13 Connection opened: 192.168.10.50:8282
2014-11-10 3:41:41 Connection opened: 192.168.10.50:8282
2014-11-10 4:2:16 Connection opened: 192.168.10.50:8282
2014-11-10 4:5:50 Connection opened: 192.168.10.50:8282
2014-11-10 4:19:8 Connection opened: 192.168.10.50:8282
2014-11-10 4:35:55 Connection opened: 192.168.10.50:8282
2014-11-10 4:51:0 Connection opened: 192.168.10.50:8282
2014-11-10 5:6:48 Connection opened: 192.168.10.50:8282
2014-11-10 5:15:56 Connection opened: 192.168.10.50:8282
2014-11-10 5:31:41 Connection opened: 192.168.10.50:8282
2014-11-10 5:47:37 Connection opened: 192.168.10.50:8282
2014-11-10 6:10:28 Connection opened: 192.168.10.50:8282
From the morning after logging disabled. Some connections now live longer
Code: Select all
2014-11-10 7:36:31 Connection opened: 127.0.0.1:8282
2014-11-10 7:37:4 Connection opened: 127.0.0.1:8282
2014-11-10 7:40:45 Connection opened: 127.0.0.1:8282
2014-11-10 8:16:50 Connection opened: 127.0.0.1:8282
2014-11-10 8:17:12 Connection opened: 127.0.0.1:8282
2014-11-10 9:11:11 Connection opened: 127.0.0.1:8282
2014-11-10 10:9:46 Connection opened: 127.0.0.1:8282
2014-11-10 10:16:32 Connection opened: 127.0.0.1:8282
2014-11-10 10:42:46 Connection opened: 127.0.0.1:8282
2014-11-10 11:50:8 Connection opened: 127.0.0.1:8282
2014-11-10 12:2:23 Connection opened: 127.0.0.1:8282
I have also noticed that when the browser gets disconnected I get at the same time the following error messages in EG log
Code: Select all
07:36:23 WebSocket client ('127.0.0.1', 6814) force deleted
07:36:54 WebSocket client ('127.0.0.1', 6818) force deleted
09:11:01 WebSocket client ('127.0.0.1', 12077) force deleted
10:09:36 WebSocket client ('127.0.0.1', 18908) force deleted
I am still hoping a socket delay timeout somehow could help to keep clients connected a little longer but it is of course difficult to know.
My best regards, Walter