FHEM Forum

FHEM => Frontends => FHEMWEB => Thema gestartet von: betateilchen am 19 Januar 2015, 21:55:58

Titel: FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: betateilchen am 19 Januar 2015, 21:55:58
Zitat von: rudolfkoenig am 10 Januar 2015, 21:27:26
- die widgets time/slider/noArg/textField/multiple sind jetzt im fhemweb.js implementiert, und benoetigen keine extra Dateien mehr. Diese habe ich im SVN

Ich gehe davon aus, dass diese Aenderungen trotz intensiver Tests einige Probleme nach sich ziehen werden, bitte diese im Frontend Bereich _MIT_SINNVOLLEM_BETREFF_ melden.

Hallo Rudi,

irgendwie sieht mein set Eingabefeld in openweathermap-Devices komisch aus:

(http://up.picr.de/20738318yq.png)

Viel schlimmer als die Darstellung ist allerdings die Tatsache, dass eine EIngabe in das Feld nicht mehr korrekt funktioniert. Wählt man in der Dropdownliste "stationByName" aus und trägt dann "Berlin" ein, kommt diese Eingabe nicht im Modul an.  In der get-Eingabe funktioniert es problemlos, obwohl es programmtechnisch identisch abgebildet wird.

Was muss ich denn in meinem Coding ändern, damit das wieder funktioniert?


sub OWO_Set($@){
my ($hash, @a) = @_;
my $name = $hash->{NAME};
my $usage = "Unknown argument, choose one of clear:noArg stationById stationByGeo stationByName send:noArg";
my $response;

return "No Argument given" if(!defined($a[1]));

my $urlString = AttrVal($name, "owoGetUrl", undef);
return "Please set attribute owoGetUrl!" if(!defined($urlString));

my $cmd = $a[1];

given($cmd){
when("?") { return $usage; }

when("clear"){
CommandDeleteReading(undef, "$name _.*");
CommandDeleteReading(undef, "$name c_.*");
CommandDeleteReading(undef, "$name g_.*");
return;
}
when("send"){
OWO_GetStatus($hash,1);
return;
}
when("stationByName"){
$urlString = $urlString."?q=";
my $count;
my $element = @a;
for ($count = 2; $count < $element; $count++) {
$urlString = $urlString."%20".$a[$count];
}
}
when("stationById"){
$urlString = $urlString."?id=".$a[2];
}
when("stationByGeo"){
$a[2] = AttrVal("global", "latitude", 0) unless(defined($a[2]));
$a[3] = AttrVal("global", "longitude", 0) unless(defined($a[3]));
$urlString = $urlString."?lat=$a[2]&lon=$a[3]";
}
default: { return $usage; }
}
UpdateReadings($hash, $urlString, "c_");
return;
}
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: rudolfkoenig am 19 Januar 2015, 23:44:24
Es schaut auch bei mir so aus, wenn der Browser nicht sehr breit ist. Sonst kriege ich 2 "normale" Reihen.

Dieser Code ist eigentlich weiterhin JavaScript-frei, beide Zeilen sitzen in einem <form>, und werden beim Druck auf dem set/get Knopf zu FHEM gesendet. Die Module sollten gar nix aendern, und es sollte weiterhin funktionieren.

Kannst du mit "attr WEB verbose 5" schauen, was FHEMWEB beim Druck auf dem Knopf bekommt?
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: wtue am 20 Januar 2015, 08:40:20
Hallo Rudi,
ich hatte das Problem mal gepostet und betateilchen hat mir einen workarround gezeigt. Deshalb antorte ich mal.

http://forum.fhem.de/index.php/topic,32426.msg248578.html#msg248578

verbose 5 liefert...

2015.01.20 08:27:22.010 4: HTTP FHEMWEB:172.16.2.44:49466 GET /fhem
2015.01.20 08:27:22.127 4: 11845:FHEMWEB:172.16.2.44:49466: /fhem / RL:1369 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:22.600 4: Connection accepted from FHEMWEB:172.16.2.44:49469
2015.01.20 08:27:22.676 4: HTTP FHEMWEB:172.16.2.44:49466 GET /fhem?XHR=1&inform=type=status;filter=;since=1421738841;fmt=JSON&timestamp=1421738843241
2015.01.20 08:27:27.063 4: HTTP FHEMWEB:172.16.2.44:49463 GET /fhem?room=RSS
2015.01.20 08:27:27.133 4: 11845:FHEMWEB:172.16.2.44:49463: /fhem?room=RSS / RL:1954 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:27.142 4: Connection closed for FHEMWEB:172.16.2.44:49466: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
2015.01.20 08:27:27.490 4: Connection accepted from FHEMWEB:172.16.2.44:49472
2015.01.20 08:27:27.494 4: HTTP FHEMWEB:172.16.2.44:49463 GET /fhem/images/default/Prev.png
2015.01.20 08:27:27.505 4: HTTP FHEMWEB:172.16.2.44:49469 GET /fhem/images/default/Zoom-out.png
2015.01.20 08:27:27.518 4: HTTP FHEMWEB:172.16.2.44:49460 GET /fhem/pgm2/svg.js
2015.01.20 08:27:27.534 4: HTTP FHEMWEB:172.16.2.44:49465 GET /fhem/images/default/Zoom-in.png
2015.01.20 08:27:27.599 4: HTTP FHEMWEB:172.16.2.44:49462 GET /fhem/SVG_showLog?dev=SVG_owo&logdev=owolog&gplotfile=SVG_owolog_1&logfile=CURRENT&pos=
2015.01.20 08:27:27.606 5: plotcommand: get owolog CURRENT INT 2015-01-20_00:00:00 2015-01-21_00:00:01  4:owo.c_temperature\x3a:: 4:owo.c_humidity\x3a:: 4:owo.c_pressure\x3a:950:$fld[3]-950
2015.01.20 08:27:27.872 4: 11845:FHEMWEB:172.16.2.44:49462: /fhem/SVG_showLog?dev=SVG_owo&logdev=owolog&gplotfile=SVG_owolog_1&logfile=CURRENT&pos= / RL:2681 / image/svg+xml / Content-Encoding: gzip
/
2015.01.20 08:27:27.877 4: HTTP FHEMWEB:172.16.2.44:49460 GET /fhem?XHR=1&inform=type=status;filter=room=RSS;since=1421738846;fmt=JSON&timestamp=1421738848265
2015.01.20 08:27:32.606 4: Connection closed for FHEMWEB:172.16.2.44:49472: EOF
2015.01.20 08:27:37.289 4: HTTP FHEMWEB:172.16.2.44:49463 GET /fhem?detail=owo
2015.01.20 08:27:37.376 4: 11845:FHEMWEB:172.16.2.44:49463: /fhem?detail=owo / RL:3567 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:37.383 4: Connection closed for FHEMWEB:172.16.2.44:49460: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
2015.01.20 08:27:37.913 4: HTTP FHEMWEB:172.16.2.44:49463 GET /fhem?cmd={ReadingsVal(%22owo%22,%22clear%22,%22%22)}&XHR=1
2015.01.20 08:27:37.940 4: 11845:FHEMWEB:172.16.2.44:49463: /fhem?cmd={ReadingsVal(%22owo%22,%22clear%22,%22%22)}&XHR=1 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:37.945 4: HTTP FHEMWEB:172.16.2.44:49462 GET /fhem?cmd={AttrVal(%22owo%22,%22room%22,%22%22)}&XHR=1
2015.01.20 08:27:37.973 4: 11845:FHEMWEB:172.16.2.44:49462: /fhem?cmd={AttrVal(%22owo%22,%22room%22,%22%22)}&XHR=1 / RL:24 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:37.977 4: Connection accepted from FHEMWEB:172.16.2.44:49475
2015.01.20 08:27:37.982 4: Connection accepted from FHEMWEB:172.16.2.44:49476
2015.01.20 08:27:38.008 4: HTTP FHEMWEB:172.16.2.44:49463 GET /fhem?XHR=1&inform=type=status;filter=owo;since=1421738856;fmt=JSON&timestamp=1421738858574
2015.01.20 08:27:43.021 4: Connection closed for FHEMWEB:172.16.2.44:49476: EOF
2015.01.20 08:27:43.227 4: HTTP FHEMWEB:172.16.2.44:49465 GET /fhem?cmd={ReadingsVal(%22owo%22,%22stationByName%22,%22%22)}&XHR=1
2015.01.20 08:27:43.252 4: 11845:FHEMWEB:172.16.2.44:49465: /fhem?cmd={ReadingsVal(%22owo%22,%22stationByName%22,%22%22)}&XHR=1 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:51.531 4: Connection closed for FHEMWEB:172.16.2.44:49463: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
2015.01.20 08:27:51.534 4: HTTP FHEMWEB:172.16.2.44:49462 GET /fhem&detail=owo&dev.setowo=owo&cmd.setowo=set&arg.setowo=stationByName
2015.01.20 08:27:51.826 4: HTTP FHEMWEB:172.16.2.44:49465 GET /fhem?detail=owo
2015.01.20 08:27:51.913 4: 11845:FHEMWEB:172.16.2.44:49465: /fhem?detail=owo / RL:3600 / text/html; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:52.391 4: HTTP FHEMWEB:172.16.2.44:49462 GET /fhem?cmd={ReadingsVal(%22owo%22,%22clear%22,%22%22)}&XHR=1
2015.01.20 08:27:52.416 4: 11845:FHEMWEB:172.16.2.44:49462: /fhem?cmd={ReadingsVal(%22owo%22,%22clear%22,%22%22)}&XHR=1 / RL:21 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:52.421 4: HTTP FHEMWEB:172.16.2.44:49465 GET /fhem?cmd={AttrVal(%22owo%22,%22room%22,%22%22)}&XHR=1
2015.01.20 08:27:52.446 4: 11845:FHEMWEB:172.16.2.44:49465: /fhem?cmd={AttrVal(%22owo%22,%22room%22,%22%22)}&XHR=1 / RL:24 / text/plain; charset=UTF-8 / Content-Encoding: gzip
/
2015.01.20 08:27:52.452 4: Connection accepted from FHEMWEB:172.16.2.44:49480
2015.01.20 08:27:52.457 4: Connection accepted from FHEMWEB:172.16.2.44:49481
2015.01.20 08:27:52.483 4: HTTP FHEMWEB:172.16.2.44:49462 GET /fhem?XHR=1&inform=type=status;filter=owo;since=1421738870;fmt=JSON&timestamp=1421738873049


Im Reading steht dann

_httpResponse_c  {"message":"Error: Not found city","cod":"404"}


Also set owo stationByName Berlin funktioniert in der Befehlszeile von FHEM aber nicht über die Auswahl in der set Funktion des Modul. Das Problem tritt erst sei vorgestern nach einem Update auf.

LG wtue
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: betateilchen am 20 Januar 2015, 10:39:19
Zitat von: rudolfkoenig am 19 Januar 2015, 23:44:24
Es schaut auch bei mir so aus, wenn der Browser nicht sehr breit ist. Sonst kriege ich 2 "normale" Reihen.

An der Browserbreite sollte es wohl nicht liegen

(http://up.picr.de/20741095nh.jpg)
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: wtue am 20 Januar 2015, 10:55:16
Bei meinem Standart Stil ist das Feld richtig.
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: betateilchen am 20 Januar 2015, 10:57:59
Ich habe mir eben mal die Unterschiede im HTML-Quelltext zwischen dem set und dem get Bereich angeschaut:


<div class="makeSelect" dev="owo" cmd="set" list="clear:noArg stationById stationByGeo stationByName send:noArg">
<form method="post" action="/fhem" autocomplete="off">
<input type="hidden" name="detail" value="owo">
<input type="hidden" name="dev.setowo" value="owo">
<input type="submit" name="cmd.setowo" value="set" class="set">
<div class="set downText">&nbsp;owo&nbsp;</div>
<select id="sel_setowo" informid="sel_setowo" name="arg.setowo" class="set"><option selected="selected" value="clear">clear</option>
<option value="send">send</option>
<option value="stationByGeo">stationByGeo</option>
<option value="stationById">stationById</option>
<option value="stationByName">stationByName</option>
</select>
<div style="display:inline-block" class="textField_widget" informid="owo-stationByName"><input type="text" size="30"></div>
</form></div>

<div class="makeSelect" dev="owo" cmd="get" list="stationById stationByGeo stationByName">
<form method="post" action="/fhem" autocomplete="off">
<input type="hidden" name="detail" value="owo">
<input type="hidden" name="dev.getowo" value="owo">
<input type="submit" name="cmd.getowo" value="get" class="get">
<div class="get downText">&nbsp;owo&nbsp;</div>
<select id="sel_getowo" informid="sel_getowo" name="arg.getowo" class="get"><option selected="selected" value="stationByGeo">stationByGeo</option>
<option value="stationById">stationById</option>
<option value="stationByName">stationByName</option>
</select>
<div style="display:inline-block" class="textField_widget" informid="owo-stationByGeo"><input type="text" size="30" name="val.getowo"></div>
</form></div>


Da fallen mir nur zwei Unterschiede auf:

1. im set Bereich gibt es Befehle mit :noArg, im get nicht
2. im get Bereich hat das input-Feld ein "name" Tag, bei set nicht.

Und dann stellt sich mir noch die Frage, was eigentlich passiert, wenn sowohl in "set" als auch in "get" die gleiche informid auftaucht, was offensichtich immer dann möglich ist, wenn sowohl in set als auch in get die gleichen Befehle vorhanden sind.
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: wtue am 20 Januar 2015, 11:30:27
Ups im Dark Style geht es bei mir auch.
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: betateilchen am 20 Januar 2015, 11:46:43
Die fehlerhafte Darstellung tritt bei mir sogar in einem komplett neu aufgesetzten fhem auf.
In der fhem.cfg wurde lediglich das owo Device neu angelegt, ansonsten keine Änderungen.

Edit: getestet mit Chrome und Safari.

(http://up.picr.de/20741531fv.jpg)

(Das fehlerhafte Verhalten der Rotfärbung tritt dabei auch auf, aber das ist ein anderes Thema)
Titel: Antw:FHEMWEB Umbau - Eingabefeld "set" in 98_openweathermap tot
Beitrag von: rudolfkoenig am 20 Januar 2015, 20:37:19
Ich hoffe, dass der Fix aus dem fhemweb.js Umbau Thread das hier erwaehnte Problem behebt.