FHEMWiki:Sandbox: Unterschied zwischen den Versionen

Aus FHEMWiki
Keine Bearbeitungszusammenfassung
(Der Seiteninhalt wurde durch einen anderen Text ersetzt: „<source lang="perl"> #!/usr/bin/perl use strict; use warnings; use Path::Class; use autodie; # die if problem reading or writing a…“)
Zeile 20: Zeile 20:
     $file_handle->print($line . "\n");
     $file_handle->print($line . "\n");
}
}
</source>
<source lang="html4strict">
<!DOCTYPE html>
<html>
<head></head>
<body>
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="5" data-template="menu.html"></li>
<!-- Vaillant Bus links -->
<li data-row="1" data-col="2" data-sizex="1" data-sizey="5">
<header><font size="+1">Vaillant BUS</font></header>
        <div class="top-space">
            <div data-type="label" class="top-space">Aussentemp</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="Aussentemp" data-get="Aussentemp"
data-unit="%B0C%0A" ></div>
        </div>
        <div class="top-space">
            <div data-type="label" class="top-space">Fanspeed</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="Fanspeed" data-get="Fanspeed"
data-unit=" Upm" ></div>
        </div>
        <div class="top-space">
            <div data-type="label" class="top-space">PumpeWatt</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="PumpeWatt" data-get="PumpeWatt"
                    data-unit=" Watt" ></div>
        </div>
        <div class="top-space">
            <div data-type="label" class="top-space">Vorlauf</div>
            <div class="large" data-type="label" data-colors='["#F44336"]' data-limits='["0"]'
data-device="Vorlauf" data-get="Vorlauf"
data-unit="%B0C%0A" ></div>
        </div>
        <div class="top-space">
            <div data-type="label" class="top-space">Ruecklauf</div>
            <div class="large" data-type="label" data-colors='["#2196f3"]' data-limits='["0"]'
data-device="Ruecklauf" data-get="Ruecklauf"
data-unit="%B0C%0A" ></div>
        </div>       
        <div class="top-space">
            <div data-type="label" class="top-space">Druck Heizsystem</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="Druck" data-get="Druck"
data-unit=" Bar" ></div>
        </div>       
        <div class="top-space">
            <div data-type="label" class="top-space">Vorlauf Soll</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="FlowTempDesired" data-get="FlowTempDesired"
data-unit="%B0C%0A" ></div>
        </div>       
        <div class="top-space">
            <div data-type="label" class="top-space">Warmwasser</div>
            <div class="large" data-type="label" data-colors='["#F44336"]' data-limits='["0"]'
data-device="WarmW.Temp." data-get="WarmW.Temp."
data-unit="%B0C%0A" ></div>
        </div> 
            <div class="top-space">
            <div data-type="label" class="top-space">HKurve</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="HKurve" data-get="HKurve"
data-unit=" " ></div>
        </div>
        <div class="top-space">
            <div data-type="label" class="top-space">Betrieb.Std.</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="Betrieb.Std." data-get="Betrieb.Std."
data-unit=" h" ></div>
        </div>     
</li>
    <!-- Schwellwerte -->   
    <li data-row="1" data-col="3" data-sizex="3" data-sizey="2">
<header><font size="+1">Einstellungen Kurven</font></header>
<div class="cell">
<table width="100%">
<tr>
<td>
              <div data-type="label" class="">HeizkurveEinstellen</div>
              <div data-type="label" class="">(0,2 - 1,7 Kurve)</div>
          <div data-type="select" data-device="HeizkurveEinstellen" data-items='["0.20","0.50","0.70","0.80","0.90","1.00","1.10","1.20","1.30"]' data-get="STATE" class="cell hue-tick w2x" ></div>
            <!--<div data-type="slider" data-device='HeizkurveEinstellen'  data-get="STATE" data-step="0.1" data-min="0.2"  data-max="1.7" data-off='("0.2")' data-on='("1.7")' data-value=true  class="big" >  </div> -->
</td>
<td>
              <div data-type="label" class="">WarmWasserEinstellen</div>
              <div data-type="label" class="">(50 - 60 Grad)</div>
              <div data-type="slider" data-device='WarmWasserEinstellen' data-get="STATE" data-min="50"  data-max="60" data-off='(on|closed|down)' data-on='(open|off)' data-value=true  class="big" >  </div>
</td>
</tr>
</table>
</div>
</li>     
    <li data-row="3" data-col="3" data-sizex="3" data-sizey="2">
<header><font size="+1">Heizkurve Tabelle</font></header>
<div class="cell">
      <div data-type="image"
        data-size="100%"
        data-url="http://10.0.0.5:8083/fhem/www/tablet/Heizkurve.png"
      </div>
      </div>
</li>
<!-- Pumpen -->
<li data-row="5" data-col="3" data-sizex="3" data-sizey="1">
<header><font size="+1">Pumpen</font></header>
<div class="cell">
<table width="100%">
<tr>
<td>
<div data-type="label" class="narrow">FB Kueche</div>
              <div data-type="switch" data-device="Kueche" data-icon="oa-sani_pump" data-get-on='Ein|on' data-get-off='Aus|off' data-set-on='Ein' data-set-off='Aus' class="cell"></div>
</td>
<td>
<div data-type="label" class="narrow">FB Wohnzimmer</div>
              <div data-type="switch" data-device="Wohnzimmer" data-icon="oa-sani_pump" data-get-on='Ein|on' data-get-off='Aus|off' data-set-on='Ein' data-set-off='Aus' class="cell"></div>
</td>
            <td>
<div data-type="label" class="narrow">Pumpe EG</div>
<div data-type="switch" data-device="PumpeEG" data-icon="oa-sani_pump" data-get-on='Ein|on' data-get-off='Aus|off' data-set-on='Ein' data-set-off='Aus' class="cell"></div>
</td>
</tr>
</table>
</div>
</li>
<!-- Temperaturen -->
    <li data-row="1" data-col="6" data-sizex="1" data-sizey="2">
      <div class="centered">
            <div data-type="label" class="top-space">Wohnzimmer</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="netatmo_wz" data-get="temperature"
data-unit="%B0C%0A" ></div>
      </div>
<div class="centered"> 
<div data-type="range"
                data-device="netatmo_wz"
                data-high="temperature"
                data-width="17"
                data-height="190"
                data-max="30"
                data-min="10"
                data-limit-low="17"
                data-limit-high="23"
                data-color-low="blue"
                data-color="green"
                data-color-high="red"
          </div>                               
</div>
</li>   
    <li data-row="3" data-col="6" data-sizex="1" data-sizey="2">
      <div class="centered">
            <div data-type="label" class="top-space">Aussen</div>
            <div class="large" data-type="label" data-colors='["#B28F00"]' data-limits='["0"]'
data-device="netatmo_aussen" data-get="temperature"
data-unit="%B0C%0A" ></div>
      </div>
<div class="centered">
<div data-type="range"
                data-device="netatmo_aussen"
                data-high="temperature"
                data-width="17"
                data-height="190"
                data-max="30"
                data-min="-10"
                data-limit-low="0"
                data-limit-high="15"
                data-color-low="blue"
                data-color="lightblue"
                data-color-high="orange"
          </div>                               
</div>
</li>   
<!-- Vaillant Schalter rechts -->
<li data-row="1" data-col="7" data-sizex="1" data-sizey="4">
<header><font size="+1">Schalter</font></header>
        <div class="top-space">
            <div data-type="label" class="top-space">Winterbetrieb</div>
            <div data-type="checkbox" data-device='Winter'
      data-get-on="1"    data-get-off="0"
                data-set-on="1" data-set-off="0"
              class="green">
            </div>
          <br>
        </div>     
        <div class="top-space">
            <div data-type="label" class="top-space">Heizung sanft anfahren</div>
            <div data-type="checkbox" data-device='sanft'
      data-get-on="1"    data-get-off="0"
                data-set-on="1" data-set-off="0"
              class="green">
            </div>
          <br>
        </div>       
        <div class="top-space">
            <div data-type="label" class="top-space">Automatischer Vorlauf</div>
            <div data-type="checkbox" data-device='AutoVorlauf'
      data-get-on="1"    data-get-off="0"
                data-set-on="1" data-set-off="0"
              class="blue">
            </div>
          <br>
        </div>
        <div class="top-space">
            <div data-type="label" class="top-space">Vorlauf anheben</div>
            <div data-type="checkbox" data-device='Kompensation'
      data-get-on="Ein"    data-get-off="Aus"
                data-set-on="Ein" data-set-off="Aus"
              class="blue">
            </div>
          <br>
        </div>                       
        <div class="top-space">
            <div data-type="label" class="top-space">Dauerbetrieb</div>
            <div data-type="checkbox" data-device='Dauerbetrieb'
      data-get-on="Ein"    data-get-off="Aus"
                data-set-on="Ein" data-set-off="Aus"
              class="green">
            </div>
          <br>
        </div>                     
</li>   
    <li data-row="7" data-col="6" data-sizex="2" data-sizey="1">
<header><font size="">Wasserdruck</font></header>
<div class="cell">
<table width="100%">
<tr>
  <td>       
<div data-type="thermostat"
          data-step="0.1" 
              data-temp="Druck"
              data-get="Druck"
data-min="0" data-max="3" data-device="Druck" class="cell"
data-fgColor="#B28F00">
          </div>                               
</td>   
<td>         
  </tr>               
</table>
</div>
</li>           
</ul>
</div>
</body>
</html>
</source>
</source>

Version vom 21. Januar 2016, 18:18 Uhr

#!/usr/bin/perl
use strict;
use warnings;

use Path::Class;
use autodie; # die if problem reading or writing a file

my $dir = dir("/tmp"); # /tmp

my $file = $dir->file("file.txt"); # /tmp/file.txt

# Get a file_handle (IO::File object) you can write to
my $file_handle = $file->openw();

my @list = ('a', 'list', 'of', 'lines');

foreach my $line ( @list ) {
    # Add the line to the file
    $file_handle->print($line . "\n");
}