Websocket suite

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

Re: Websocket suite

Postby Pako » Mon Jan 09, 2012 8:46 am

Hi Walter !
Thanks for the reminder.
I promise that I will soon release a new version with your treatment.
No other changes yet I do not anticipate.

Best regards, Pako
User avatar
Pako
Plugin Developer
 
Posts: 1282
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Websocket suite

Postby krambriw » Mon Jan 09, 2012 3:04 pm

Dear Pako, thank you very much!

My very best regards, Walter
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

Re: Websocket suite

Postby krambriw » Tue Jan 10, 2012 4:19 pm

Dear Pako,

My friend has a problem to get the websocket suites to work correctly. The browsers are configured to support websockets (Opera and Chrome)

The following happens:

First the client connects by navigating to the html page and the following is logged in the EG log window (I have enabled debug in Websocket Suites):
Code: Select all
18:51:21 Server Home_Automation: New client ('127.0.0.1', 52254) tries to connect
18:51:21 get_headers - data: "GET / HTTP/1.1\r\nOrigin: http://127.0.0.1:8282\r\nSec-WebSocket-Key1: AZ-27 + 1S7 $'6fE4 11 20\r\nSec-WebSocket-Key2: 3 29 9152^[/B6H!C5>`4\r\nConnection: Upgrade\r\nHost: 127.0.0.1:1235\r\nUpgrade: WebSocket\r\n\r\n<\x07\x8e\xabx\xc8\x93\x92"

The count for connected clients are counting up correctly

Next we click on the "Clients" button and then the following is logged:
Code: Select all
18:51:32 Traceback (most recent call last) (1544):
18:51:32 File "wx\_core.pyc", line 14660, in <lambda>
18:51:32 File "C:\Program Files\EventGhost\plugins\WebsocketSuite\__init__.py", line 1899, in __init__
18:51:32 FillListCtrl()
18:51:32 File "C:\Program Files\EventGhost\plugins\WebsocketSuite\__init__.py", line 1889, in FillListCtrl
18:51:32 ip, port = clnts[i].getpeername()
18:51:32 File "<string>", line 1, in getpeername
18:51:32 File "socket.pyc", line 165, in _dummy
18:51:32 error: [Errno 9] Bad file descriptor


It seems that the problem is in resolving the ip-address and port for the client and then of course nothing more works.
We have also exchanged all possible files and they work fine in my computers.

Best regards, Walter
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

Re: Websocket suite

Postby Pako » Wed Jan 11, 2012 7:38 am

Hi Walter!
I am afraid that you gave me too little information.
I can not help you, while I can not get the same (or similar) entry in the log.
I have four questions now:
1) Which browser (and which version) was used, when the attached log was created ? I suppose it was Opera.
2) How it is done navigate to html page that contains websocket client code?
3) What happens when you open the websocket client page directly (open file ...) ?
4) How it can be done, that in the log is the entry Origin: http://127.0.0.1:8282? I always get Origin: null.

Best regards, Pako
User avatar
Pako
Plugin Developer
 
Posts: 1282
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic

Re: Websocket suite

Postby kingtd » Wed Jan 11, 2012 6:33 pm

I was very excited to stumble across this plugin, but I've got the same issue as krambriw's friend. I'll do some troubleshooting after work today but since you probably have the same questions about my setup, these are the answers:

1. Chrome 16.0.912.75 m (This should be the latest version - I have auto-updates turned on, and it passes websocket tests and can run the sample chat app here: http://html5demos.com/web-socket)
2 and 3. I have the HTML file stored locally and click to launch it. Chrome is the default handler and the page loads with all graphics intact. I also enabled the Eventghost webserver on the same system that is running VirtualHouse and Websocket Suite, and loaded the HTML from there, but the results are the same.
4. Even with debug enabled, I never see the "get_headers" line. I get the "tries to connect" line, but my client instantly issues onclose.

Other than this, everything is as Walter reports. The number of clients increments, but trying to list the clients results in the "Bad File Descriptor" error. I've done some debugging to see if the problem is on the client side, but there's not much to report. It issues onopen, followed immediately by onclose. The onmessage function is never called.

~K
kingtd
Plugin Developer
 
Posts: 78
Joined: Fri Jul 13, 2007 7:39 am

Re: Websocket suite

Postby kingtd » Wed Jan 11, 2012 7:15 pm

UPDATE to the update:

I've made the following changes and now mine is working. Apparently Persistent.userVariables was [] and it was getting called with an illegal index [1], but this was masked with the "Try" which was then forcing the connection closed in the "Except" clause. Adding a check to see if Persistent.userVariables was populated seems to have resolved my issue:

Code: Select all
                       
folder = self.dataSet[self.servers[ix][3]][3][3]
self.updateLogFile(folder, self.servers[ix][1], line)
if Persist.userVariables:  # THIS IS THE ADDED LINE
   vars = Persist.userVariables[self.servers[ix][3]][1]
   for v in vars:
        self.send_data(r, "%s=%s" % (v[0], v[1]))
        line = self.text.msgToCln % (unicode(v[0]), unicode(v[1]), r.getpeername())
        self.updateLogFile(folder, self.servers[ix][1], line)


Not sure if this should be the permanent fix or not, but it's definitely a case that needs to be addressed.

~K

(previous) Minor lunchtime update:

I went through and added print statements sprinkled into ServerHandler to see if I could start to troubleshoot, and at least part of the problem seems to be with referencing "Persist.userVariables[self.servers[ix][3]][1]". The def executes until it gets to that line, then ceases to process without any error or warning that I can see. If I add the following:

print Persist.userVariables[self.servers[ix][3]][1]
print "Made it to here"

There is no output and the second line is never executed.


-T
kingtd
Plugin Developer
 
Posts: 78
Joined: Fri Jul 13, 2007 7:39 am

Re: Websocket suite

Postby kingtd » Fri Jan 13, 2012 2:13 am

One more update. This plugin is great, but the Persistent Variables component, and especially the UI for entering the initial values is very fragile. In several cases its committed changes that broke my config in ways that I haven't been able to fix without poking around and editing at least the config.py file. I'm currently stuck right now after adding an empty list. Hitting the "Server Classes" button gives me "IndexError: List assignment out of range". Removing the last entry manually from config.py doesn't seem to be enough to release it.

After doing some more testing, it seems to be related to the way lists are handled. Attempting to add an empty list will kick you out of the interface and prevent you from going back in. I don't want to prepopulate the list, but I guess I can put some bogus data in there temporarily.


I think this aligns with the original problem that we were seeing - missing values in the Persistent Variables getting tracked improperly.

~K
kingtd
Plugin Developer
 
Posts: 78
Joined: Fri Jul 13, 2007 7:39 am

Re: Websocket suite

Postby krambriw » Fri Jan 13, 2012 12:03 pm

After the changes,
Code: Select all
if Persist.userVariables:  # THIS IS THE ADDED LINE

it works for my friend now :D

Best regards & thanks a lot,

Walter
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

Re: Websocket suite

Postby krambriw » Sat Jan 14, 2012 12:10 pm

After studying the websocket standards a bit reading documnets here:
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17

I think the following corrections needs to be made in the WebSocket Suits __init__.py file:

Line 2770 and 2771:
Code: Select all
                    "HTTP/1.1 101 Web Socket Protocol Handshake",
                    "Upgrade: Websocket",


should be changed to:
Code: Select all
                    "HTTP/1.1 101 WebSocket Protocol Handshake",
                    "Upgrade: WebSocket",


Line 2786 and 2787:
Code: Select all
                    "HTTP/1.1 101 Switching Protocols",
                    "Upgrade: WebSocket",


should be changed to:
Code: Select all
                    "HTTP/1.1 101 Switching Protocols",
                    "Upgrade: websocket",


I have also changed the lines 2790 and 2791:
Code: Select all
                client.send(our_handshake)
                #client.send(our_handshake.encode('latin-1'))


to the following:
Code: Select all
                #client.send(our_handshake)
                client.send(our_handshake.encode('latin-1'))


The change recommended by kingtd seems to be fine as well and I think it should be in.

In the attatched version all the above changes are in, in addition I have added some more debug-logging to better tracing of how different browsers connects and what protocol they are using. The debugging is easy to turn off on line 149:
Code: Select all
DEBUG = False
if DEBUG:
    log = eg.Print
else:
    def log(dummyMesg):
        pass


Could you please try this version and report your results?
__init__2012-01-14.zip
(36.81 KiB) Downloaded 109 times


Best regards, Walter
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

Re: Websocket suite

Postby Pako » Mon Jan 16, 2012 1:33 pm

@kingtd and @Walter: Thank you both for the work you have spent for Websocket suite plugin.

kingtd wrote:4. Even with debug enabled, I never see the "get_headers" line.
That is absolutely correct, if you are using the latest version of Chrome.
kingtd wrote:... but the Persistent Variables component, and especially the UI for entering the initial values is very fragile.
Totally agree with you. I hope I can find time to improve this part of the plugin.

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

Re: Websocket suite

Postby Bigert » Sat Jan 21, 2012 5:29 pm

Hi, I'm krambriw's support case.

After downloading the latest py-file from 2012-01-14 it was much more stable and Opera mobile started working.

Firefox 9.0.1 working
Opera Version 11.60, build 1185 working (with enable websockets)
Google Chrome 16.0.912.75 m instabile
IE9 not working
Opera Mobile 11.50.ADR.1111101157 working (with enable websockets)
Android 2.3 standard browser not working
Tellstick Duo Batch3 FW5, Nexa/Jula-brytare, temp-mätare (Teknikmag), fuktmätare Ebay, HP MCE MS Remote, Efergy R2, Conrad-antenn.
EventGhost 0.4.1R1600, Telldus Center 2.1.1, SunTracker, EventPhone, websocketsuite, Win7x64, MySQL.

/Bigert
Bigert
 
Posts: 3
Joined: Sat Dec 10, 2011 10:29 pm

Re: Websocket suite

Postby Siutsch » Wed Apr 18, 2012 6:13 pm

Hi,

I need some help of a html coding profi. :?:

Like I described in websocket thread from cfull1 (http://www.eventghost.net/forum/viewtopic.php?f=10&t=3320&start=30) I want to use the possibilities of WebSocket to show status infos of EG in realtime.

All the virtual house stuff I don't need, I just want to show some different variables on a web page.

If I understand this plugin correctly, this can probably done with "persistent variables".

Therefore I've created a server class "testclass" with 2 persistent variables var1, var2 of type "str".

Maybe someone can show me what should be the code for this ...

I mean particularly the script code for "ws.onmessage ..." and the html code for showing these different infos (<div id="var1"></div> etc.)

Sorry for my inability ... :oops:

Siutsch.
Siutsch
 
Posts: 43
Joined: Wed Apr 28, 2010 6:53 am

Re: Websocket suite

Postby Siutsch » Mon Apr 23, 2012 7:21 pm

No one? :|
Siutsch
 
Posts: 43
Joined: Wed Apr 28, 2010 6:53 am

Re: Websocket suite

Postby Pako » Wed Apr 25, 2012 9:48 am

Unfortunately I do not understand what you need.

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

Re: Websocket suite

Postby krambriw » Wed Apr 25, 2012 3:03 pm

The picture you see below is a web page that is updated dynamically from websocket suite. It will give you some examples of how an incoming event from the websocket server is processed (ws.onmessage) and how single elements in the html page are updated.

Best regards, Walter

Image4.jpg


Code: Select all
<html lang="sv">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<title>System information</title>

<style type="text/css">
.on {
    border:4px inset;
    color:#369;
    background:#efefef;
}
   
.off {
    border:4px outset;
    color:#369;
    background:#f9d543;
}
</style>

<script type="text/javascript">

//var wsUri = "ws://192.168.10.248:1235/";
var wsUri = "ws://192.168.10.252:1235/";
var output;

  function init()
{
output = document.getElementById("output");
testWebSocket();
}                

  function testWebSocket()
{

//websocket = new WebSocket(wsUri);

    if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
    //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
    var ffversion=new Number(RegExp.$1); // capture x.x portion and store as a number
        if (ffversion>=7)
            websocket = new MozWebSocket(wsUri);
    else if (ffversion>=6)
            websocket = new WebSocket(wsUri);
    else if (ffversion>=5)
            websocket = new WebSocket(wsUri);
    else if (ffversion>=4)
            websocket = new WebSocket(wsUri);
    else if (ffversion>=3)
            websocket = new WebSocket(wsUri);
    else if (ffversion>=2)
            websocket = new WebSocket(wsUri);
    else if (ffversion>=1)
            websocket = new WebSocket(wsUri);
    } else
            websocket = new WebSocket(wsUri);

websocket.onopen = function(evt) { onOpen(evt) };
websocket.onclose = function(evt) { onClose(evt) };
websocket.onmessage = function(evt) { onMessage(evt) };
websocket.onerror = function(evt) { onError(evt) };
}

  function onOpen(evt)
{
//writeToScreen("CONNECTED");
doSend("WebSocket rocks");
}

  function onClose(evt)
{
writeToScreen("DISCONNECTED");
websocket.close();
}

  function onError(evt)
{
writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data);
}

  function doSend(message)
{
//writeToScreen("SENT: " + message);
websocket.send(message);
}

  function writeToScreen(message)
{
var pre = document.createElement("p");
pre.style.wordWrap = "break-word";
pre.innerHTML = message;
output.appendChild(pre);
          }

  function onMessage(evt)
{
//writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data+'</span>');
//alert(evt.data);
document.getElementById("t11").style.color ="white";
document.getElementById("t11").style.fontFamily ="arial";
document.getElementById("t11").style.fontSize ="2";
document.getElementById("t11").innerHTML = '';
document.getElementById("tt1").style.color ="white";
document.getElementById("tt1").style.fontFamily ="arial";
document.getElementById("tt1").style.fontSize ="2";
document.getElementById("tt1").innerHTML = '';

document.getElementById("or13").style.color ="white";
document.getElementById("or13").style.fontFamily ="arial";
document.getElementById("or13").style.fontSize ="2";
document.getElementById("or13").innerHTML = '';
document.getElementById("or14").style.color ="white";
document.getElementById("or14").style.fontFamily ="arial";
document.getElementById("or14").style.fontSize ="2";
document.getElementById("or14").innerHTML = '';

    if (evt.data.search("Weather Condition:")!=-1)
    {
    //alert(evt.data);
    var m = evt.data.split(".");
    var m1 = m[1]
    var w = ''
    //alert(m1);
    switch (m1) {
      case 'Cloudy': w = 'Klart'; break;
      case 'Fog': w = 'Dimma'; break;
      case 'Overcast': w = 'Gråmulet'; break;
      case 'Light rain': w = 'Lätt regn'; break;
      case 'Rain': w = 'Regn'; break;
      case 'Rain Showers': w = 'Regnskurar'; break;
      case 'Freezing Rain': w = 'Underkylt regn'; break;
      case 'Freezing Drizzle': w = 'Underkylt regn'; break;
      case 'Drizzle': w = 'Duggregn'; break;
      case 'Flurries': w = 'Lätt snöfall'; break;
      case 'Rain and Snow': w = 'Snöblandat regn'; break;
      case 'Showers': w = 'Skurar'; break;
      case 'Isolated Thunderstorms': w = 'Lokal storm'; break;
      case 'Thunderstorm': w = 'Storm'; break;
      case 'Chance of Showers': w = 'Risk för regn'; break;
      case 'Chance of Snow': w = 'Risk för snö'; break;
      case 'Chance of Storm': w = 'Risk för storm'; break;
      case 'Scattered Showers': w = 'Spridda skurar'; break;
      case 'Mist': w = 'Lätt dimma'; break;
      case 'Dust': w = 'Damm'; break;
      case 'Icy': w = 'Isigt'; break;
      case 'Smoke': w = 'Rök'; break;
      case 'Sleet': w = 'Snömodd'; break;
      case 'Snow': w = 'Snö'; break;
      case 'Light snow': w = 'Lätt snö'; break;
      case 'Snow Showers': w = 'Snöstorm'; break;
      case 'Mostly Cloudy': w = 'Mestadels molnigt'; break;
      case 'Ice/Snow': w = 'Is/snö'; break;
      case 'Haze': w = 'Smog'; break;
      case 'Partly Cloudy': w = 'Delvis molnigt'; break;
      case 'Clear': w = 'Klart'; break;
      case 'Sunny': w = 'Soligt'; break;
      case 'Mostly Sunny': w = 'Mestadels soligt'; break;
      case 'Partly Sunny': w = 'Delvis soligt'; break;
      default: w = 'Okänt';
    }
    document.getElementById("t14").style.color ="white";
    document.getElementById("t14").style.fontFamily ="arial";
    document.getElementById("t14").style.fontSize ="12";
    document.getElementById("t14").innerHTML = w;
    }
   
    if (evt.data.search("Difference to dew point in Ground")!=-1)
    {
    var m = evt.data.split(".");
    //alert(m);
    //alert(m[1]);
    document.getElementById("t02").style.color ="white";
    document.getElementById("t02").style.fontFamily ="arial";
    document.getElementById("t02").style.fontSize ="12";
    document.getElementById("t02").innerHTML = m[1]+"."+m[2]+"."+m[3]+", Senaste beräkning: "+global_n[1]+" "+global_n[2];
    }
   
    if (evt.data.search("Difference to dew point in Attic")!=-1)
    {
    var m = evt.data.split(".");
    //alert(m);
    //alert(m[0]);
    //alert(m[1]);
    //alert(m[2]);
    //alert(m[3]);
    document.getElementById("t06").style.color ="white";
    document.getElementById("t06").style.fontFamily ="arial";
    document.getElementById("t06").style.fontSize ="12";
    document.getElementById("t06").innerHTML = m[1]+"."+m[2]+"."+m[3]+", Senaste beräkning: "+global_n[1]+" "+global_n[2];
    }
   
    if (evt.data.search("Lost contact with Ground")!=-1)
    {
    var m = evt.data;
    //alert(m);
    document.getElementById("t15").style.color ="red";
    document.getElementById("t15").style.fontFamily ="arial";
    document.getElementById("t15").style.fontSize ="12";
    document.getElementById("t15").innerHTML = 'Förlorat kontakten med sensorn i krypgrunden'+' '+global_n[1]+' '+global_n[2];
    }
   
    if (evt.data.search("Lost contact with Attic")!=-1)
    {
    var m = evt.data;
    //alert(m);
    document.getElementById("t16").style.color ="red";
    document.getElementById("t16").style.fontFamily ="arial";
    document.getElementById("t16").style.fontSize ="12";
    document.getElementById("t16").innerHTML = 'Förlorat kontakten med sensorn på vinden'+' '+global_n[1]+' '+global_n[2];
    }
   
    if (evt.data.search("Recovered contact with Ground")!=-1)
    {
    var m = evt.data;
    //alert(m);
    document.getElementById("t15").style.color ="green";
    document.getElementById("t15").style.fontFamily ="arial";
    document.getElementById("t15").style.fontSize ="12";
    document.getElementById("t15").innerHTML = 'Återfått kontakten med sensorn i krypgrunden'+' '+global_n[1]+' '+global_n[2];
    }
   
    if (evt.data.search("Recovered contact with Attic")!=-1)
    {
    var m = evt.data;
    //alert(m);
    document.getElementById("t16").style.color ="green";
    document.getElementById("t16").style.fontFamily ="arial";
    document.getElementById("t16").style.fontSize ="12";
    document.getElementById("t16").innerHTML = 'Återfått kontakten med sensorn på vinden'+' '+global_n[1]+' '+global_n[2];
    }
   
    if (evt.data.search("TempCapture0x15")!=-1) //BV
    {
    var m = evt.data;
    var n = m.split(",");
    //alert(m);
    document.getElementById("ot00").style.color ="white";
    document.getElementById("ot00").style.fontFamily ="arial";
    document.getElementById("ot00").style.fontSize ="12";
    document.getElementById("ot00").innerHTML = n[1]+","+n[2]+","+n[3]+", Senaste kontakt: "+global_n[1]+" "+global_n[2];
    }
   
    if (evt.data.search("TempCapture0x3a")!=-1) //1V
    {
    var m = evt.data;
    var n = m.split(",");
    //alert(m);
    document.getElementById("ot01").style.color ="white";
    document.getElementById("ot01").style.fontFamily ="arial";
    document.getElementById("ot01").style.fontSize ="12";
    document.getElementById("ot01").innerHTML = n[1]+","+n[2]+","+n[3]+", Senaste kontakt: "+global_n[1]+" "+global_n[2];
    }

    if (evt.data.search("TempCapture0x7")!=-1) //Vind
    {
    var m = evt.data;
    var n = m.split(",");
    //alert(m);
    document.getElementById("ot03").style.color ="white";
    document.getElementById("ot03").style.fontFamily ="arial";
    document.getElementById("ot03").style.fontSize ="12";
    document.getElementById("ot03").innerHTML = n[1]+","+n[2]+","+n[3]+", Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
   
    if (evt.data.search("TempCapture0x20")!=-1) //Krypgrund
    {
    var m = evt.data;
    var n = m.split(",");
    //alert(m);
    document.getElementById("ot02").style.color ="white";
    document.getElementById("ot02").style.fontFamily ="arial";
    document.getElementById("ot02").style.fontSize ="12";
    document.getElementById("ot02").innerHTML = n[1]+","+n[2]+","+n[3]+", Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
   
    if (evt.data.search("currDate_Time")!=-1)
    {
    var m = evt.data.split(".");
    //alert(m[1]);
    global_n = m[1].split(" ");
    var n = m[1].split(" ");
    //alert(n[1]);
    var today = null;
    var o = parseInt(n[0]);
   
    switch (o) {
    case 0: today = 'Söndag'; break;
    case 1: today = 'Måndag'; break;
   case 2: today = 'Tisdag'; break;
    case 3: today = 'Onsdag'; break;
    case 4: today = 'Torsdag'; break;
    case 5: today = 'Fredag'; break;
    case 6: today = 'Lördag'; break;
    default: today = 'unknown';
    }
   
    document.getElementById("t00").style.color ="yellow";
    document.getElementById("t00").style.fontFamily ="arial";
    document.getElementById("t00").style.fontSize ="14";
    document.getElementById("t00").innerHTML = today+"    "+n[1];
    document.getElementById("tt0").style.color ="yellow";
    document.getElementById("tt0").style.fontFamily ="arial";
    document.getElementById("tt0").style.fontSize ="14";
    document.getElementById("tt0").innerHTML = n[2];
    }
   
    if (evt.data.search("SCALEO")!=-1)
    {
    var m = evt.data.split("|");
    //alert(m);
    var batt = 'unknown';
   
    if (m[7] == 0) {
      batt = 'OK';
    } else {
      batt = 'Low';
    }
   
    if (m[2]=="8" && m[4]=="1")
    {         
      if (m[7] == 0) {
          document.getElementById("t04").style.color ="white";
      } else {
          document.getElementById("t04").style.color ="orange";
      }
      document.getElementById("t04").style.fontFamily ="arial";
      document.getElementById("t04").style.fontSize ="12";
      document.getElementById("t04").innerHTML = m[5]+"C, "+m[6]+"RH%, "+"Batteri "+batt+', '+"Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
    if (m[2]=="1" && m[4]=="1")
    {         
      if (m[7] == 0) {
          document.getElementById("t12").style.color ="white";
      } else {
          document.getElementById("t12").style.color ="orange";
      }
      document.getElementById("t12").style.fontFamily ="arial";
      document.getElementById("t12").style.fontSize ="12";
      document.getElementById("t12").innerHTML = m[5]+"C, "+m[6]+"RH%, "+"Batteri "+batt+', '+"Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
    if (m[2]=="1" && m[4]=="2")
    {         
      if (m[7] == 0) {
          document.getElementById("t18").style.color ="white";
      } else {
          document.getElementById("t18").style.color ="orange";
      }
      document.getElementById("t18").style.fontFamily ="arial";
      document.getElementById("t18").style.fontSize ="12";
      document.getElementById("t18").innerHTML = m[5]+"C, "+m[6]+"RH%, "+"Batteri "+batt+', '+"Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
    if (m[2]=="15" && m[4]=="1")
    {         
      if (m[7] == 0) {
          document.getElementById("t20").style.color ="white";
      } else {
          document.getElementById("t20").style.color ="orange";
      }
      document.getElementById("t20").style.fontFamily ="arial";
      document.getElementById("t20").style.fontSize ="12";
      document.getElementById("t20").innerHTML = m[5]+"C, "+m[6]+"RH%, "+"Batteri "+batt+', '+"Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
    if (m[2]=="15" && m[4]=="2")
    {         
      if (m[7] == 0) {
          document.getElementById("t22").style.color ="white";
      } else {
          document.getElementById("t22").style.color ="orange";
      }
      document.getElementById("t22").style.fontFamily ="arial";
      document.getElementById("t22").style.fontSize ="12";
      document.getElementById("t22").innerHTML = m[5]+"C, "+m[6]+"RH%, "+"Batteri "+batt+', '+"Senaste kontakt: "+global_n[1]+' '+global_n[2];
    }
    }
}

  window.addEventListener("load", init, false);
 
</script>

<!-- <h2>WebSocket Test</h2> -->

<div id="output"></div>

<body bgcolor="#3A3C69" text=white link=white vlink=white alink=white />
<center>
<table border="1" width="70%">
  <tr><!-- Row 0 -->
          <td><text id="t00"><font face="arial" color="white" font size="4">&nbsp;Dag och datum</text></td>
        <td><text id="tt0"><font face="arial" color="white" font size="4">&nbsp;Tid</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t11"><font face="arial" color="white" font size="2">&nbsp; </text></td>
        <td><text id="tt1"><font face="arial" color="white" font size="2">&nbsp; </text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t13"><font face="arial" color="white" font size="2">&nbsp;Vädret</text></td>
        <td><text id="t14"><font face="arial" color="white" font size="2">&nbsp;Odefinierat</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t17"><font face="arial" color="white" font size="2">&nbsp;Klimat under trappan</text></td>
        <td><text id="t18"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t03"><font face="arial" color="white" font size="2">&nbsp;Klimat ute, trädgården</text></td>
        <td><text id="t04"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t11"><font face="arial" color="white" font size="2">&nbsp;Klimat ute, garaget</text></td>
        <td><text id="t12"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t19"><font face="arial" color="white" font size="2">&nbsp;Frysbox, vänster</text></td>
        <td><text id="t20"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t21"><font face="arial" color="white" font size="2">&nbsp;Frysbox, höger</text></td>
        <td><text id="t22"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="or00"><font face="arial" color="white" font size="2">&nbsp;Klimat BV</text></td>
        <td><text id="ot00"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="or01"><font face="arial" color="white" font size="2">&nbsp;Klimat 1V</text></td>
        <td><text id="ot01"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="or02"><font face="arial" color="white" font size="2">&nbsp;Klimat vinden</text></td>
        <td><text id="ot02"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="or03"><font face="arial" color="white" font size="2">&nbsp;Klimat krypgrunden</text></td>
        <td><text id="ot03"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="or13"><font face="arial" color="white" font size="2">&nbsp; </text></td>
        <td><text id="or14"><font face="arial" color="white" font size="2">&nbsp; </text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t01"><font face="arial" color="white" font size="2">&nbsp;Delta Daggpunkt krypgrunden</text></td>
        <td><text id="t02"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="t05"><font face="arial" color="white" font size="2">&nbsp;Delta Daggpunkt vinden</text></td>
        <td><text id="t06"><font face="arial" color="white" font size="2">&nbsp;Väntar på data...</text></td>
  </tr>
  <tr><!-- Row 9 -->
        <td><text id="or15"><font face="arial" color="white" font size="2">&nbsp; </text></td>
        <td><text id="or16"><font face="arial" color="white" font size="2"> </text></td>
  </tr>

</table>
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

PreviousNext

Return to Plugin Support

Who is online

Users browsing this forum: Samme and 1 guest