Ankündigung

Einklappen
Keine Ankündigung bisher.

- √ - Float and Basic.Formula

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    - √ - Float and Basic.Formula

    Small issues I guess,

    1)my floats ware displayed as

    63.29999923706055 instead I would like 63,29 how can I format this??


    2)I have a value of 37103992 which is really 37,103992 can I use:

    basic.formula('formula1',('Forbrug.Varme.Forbrug') , 'Mwh') (VAR) / 1000000)) )

    #2
    Figured out my problems with basic.formula:

    {{ basic.formula('formula1',['Forbrug.Varme.Forbrug'], 'Mwh','AVG( VAR ) / 1000000') }}

    But the problems with float representation is still persistent, anyone??

    Kommentar


      #3
      basic.float uses the format given in your language-file, e. g. for germany (lang/lang_de.txt):

      $lang['format']['float'] = '%01,2f';

      so, every float should be formated.

      Which version do you use?

      Greetings
      Join smartVISU on facebook. Web: smartvisu.de.
      Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

      Kommentar


        #4
        you may also write that:

        {{ basic.formula('formula1', 'Forbrug.Varme.Forbrug', 'Mwh', 'VAR / 1000000') }}

        - without brackets, because it is only one item.
        - and with only one item AVG isn't needed.

        if you copy a language-file, like lang/lang_en.txt to lang/lang_XX.txt you may add in the new file a line for your unit:

        $lang['format']['mwh'] = '%01.2f Mwh';

        After that it will be formated in that way.

        Greetings
        Join smartVISU on facebook. Web: smartvisu.de.
        Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

        Kommentar


          #5
          Zitat von Apollo Beitrag anzeigen
          basic.float uses the format given in your language-file, e. g. for germany (lang/lang_de.txt):

          $lang['format']['float'] = '%01,2f';

          so, every float should be formated.

          Which version do you use?

          Greetings

          My language file
          Code:
          lang_en.txt
          says the same:
          Code:
          $lang['format']['float']			= '%01.2f';
          What is strange is that sometimes it is formatted correct but mostly not, also the data which comes from MBUS to KNX represents temperatures in my heat system but every now and then the graphs have spikes with up to 1000 degrees which I am sure the data is not representing.
          Angehängte Dateien

          Kommentar


            #6
            Did you change any widgets?

            May you post your page-code?

            Greetings
            Join smartVISU on facebook. Web: smartvisu.de.
            Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

            Kommentar


              #7
              Did not change any widgets, FYI I am working with Fleischer pages for easier setup.

              Code:
              /**
              * -----------------------------------------------------------------------------
              * @package     smartVISU
              * @author      Martin Gleiß
              * @copyright   2012
              * @license     GPL [http://www.gnu.de]
              * -----------------------------------------------------------------------------
              */
              
              
              {% extends "rooms.html" %}
              
              {% block content %}
              
              	<!--<h1><img class="icon" src='{{ icon0 }}sani_buffer_temp_down.png'/>Technik</h1>-->
              
              	<style>
              		.nav-custom .ui-btn .ui-btn-inner {
              			padding-top: 40px !important;
              		}
              
              		.nav-custom .ui-btn .ui-icon {
              			width: 30px !important;
              			height: 30px !important;
              			margin-left: -15px !important;
              			box-shadow: none !important;
              			-moz-box-shadow: none !important;
              			-webkit-box-shadow: none !important;
              			-webkit-border-radius: 0 !important;
              			border-radius: 0 !important;
              		}
              
              		#technik .ui-icon {
              			background: url({{ icon0 }}sani_pump.png) 50% 50% no-repeat;
              			background-size: 36px 36px;
              		}
              
              		#strom .ui-icon {
              			background: url({{ icon0 }}measure_power_meter.png) 50% 50% no-repeat;
              			background-size: 36px 36px;
              		}
              
              		#solar .ui-icon {
              			background: url({{ icon0 }}time_graph.png) 50% 50% no-repeat;
              			background-size: 36px 36px;
              		}
              
              		#heizung .ui-icon {
              			background: url({{ icon0 }}time_graph.png) 50% 50% no-repeat;
              			background-size: 36px 36px;
              		}
              
              		#wasser .ui-icon {
              			background: url({{ icon0 }}time_graph.png) 50% 50% no-repeat;
              			background-size: 36px 36px;
              		}
              	</style>
              	<div data-role="navbar" class="nav-custom">
              		<ul>
              			<li><a href="index.php?page=KG.Keller" id="technik" data-icon="custom">Úbersicht</a></li>
              			<li><a href="index.php?page=PlotStrom" id="strom" data-icon="custom">Strom</a></li>
              			<li><a href="index.php?page=PlotSolar" id="solar" data-icon="custom">Solar</a></li>
              			<li><a href="index.php?page=PlotHeizung" class="ui-btn-active" id="heizung" data-icon="custom">Heizung</a>
              			</li>
              			<li><a href="index.php?page=PlotWasser" id="wasser" data-icon="custom">Wasser</a></li>
              		</ul>
              	</div>
              
              	<div class="preblock">
              		<table width="100%">
              			<tr>
              				<td align="middle" width="70%">
              					Varme
              				</td>
              			</tr>
              		</table>
              	</div>
              
              	<h3>Effekt i Kw</h3>
              {{ plot.period('p1', 'Forbrug.Varme.Effekt', 'avg', '24h') }}
              	<h3>Flow</h3>
              {{ plot.period('p2', 'Forbrug.Varme.Flow', 'avg', '24h') }}
              	<h3>Temperatur</h3>
              {{ plot.period('p3', ['Forbrug.Varme.Frem', 'Forbrug.Varme.Retur'], 'avg', '24h', 0, 0, '', '', ['Frem', 'Retur'], ['#df0101', '#0080ff'], ['line', 'line'], ['', 'Temperatur °C']) }}
              	<div class="block">
              		<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
              			<div data-role="collapsible" data-collapsed="false">
              				<h3>Aktuelle Data:</h3>
              
              				<table width=100%>
              					<tr>
              						<td align=left style="padding-left: 10px;">
              							Fremløb:
              						</td>
              						<td align=right>
              							{{ basic.float('TempVorlaufHeizung2', 'Forbrug.Varme.Frem', '°C') }}
              						</td>
              					</tr>
              				</table>
              				<table width=100%>
              					<tr>
              						<td align=left style="padding-left: 10px;">
              							Returløb:
              						</td>
              						<td align=right>
              							{{ basic.float('TempRuecklaufHeizung2', 'Forbrug.Varme.Retur', '°C') }}
              						</td>
              					</tr>
              				</table>
              				<table width=100%>
              					<tr>
              						<td align=left style="padding-left: 10px;">
              							Afkøling:
              						</td>
              						<td align=right>
              							{{ basic.float('TempKesselHeizung2', 'Forbrug.Varme.Forskel', '°C') }}
              						</td>
              					</tr>
              				</table>
              			<table width=100%>
              					<tr>
              						<td align=left style="padding-left: 10px;">
              							Forbrug:
              						</td>
              						<td align=right>
              							{{ basic.formula('formula1',['Forbrug.Varme.Forbrug'], 'Mwh','AVG( VAR ) / 1000000') }}
              						</td>
              					</tr>
              				</table>
              			</div>
              		</div>
              	</div>
              
              	<div class="block">
              		<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
              			<div data-role="collapsible" data-collapsed="false">
              				<h3>Omkostninger:</h3>
              				<table width="100%">
              					<tr>
              						<td align="left">
              							{{ basic.symbol('PumpeVorlauf1', 'Allgemein.Zaehler.PumpeVL', 'Pumpe Heizkreis läuft', icon1~'sani_pump.png') }}
              							{{ basic.symbol('PumpeVorlauf2', 'Allgemein.Zaehler.PumpeVL', 'Pumpe Heizkreis läuft nicht', icon0~'sani_pump.png', 0) }}
              						</td>
              					</tr>
              					<tr>
              						<td align="left">
              							{{ basic.symbol('PumpeKessel1', 'Allgemein.Zaehler.PumpeKE', 'Pumpe Kessel läuft', icon1~'sani_pump.png') }}
              							{{ basic.symbol('PumpeKessel2', 'Allgemein.Zaehler.PumpeKE', 'Pumpe Kessel läuft nicht', icon0~'sani_pump.png', 0) }}
              						</td>
              					</tr>
              					<tr>
              						<td align="left">
              							{{ basic.symbol('PumpeSpeicher1', 'Allgemein.Zaehler.PumpeSP', 'Zirkulationspumpe läuft', icon1~'sani_pump.png') }}
              							{{ basic.symbol('PumpeSpeicher2', 'Allgemein.Zaehler.PumpeSP', 'Zirkulationspumpe läuft nicht', icon0~'sani_pump.png', 0) }}
              						</td>
              					</tr>
              				</table>
              			</div>
              
              		</div>
              	</div>
              
              {% endblock %}

              Kommentar


                #8
                You have to use '°' as unit only, not '° C' (the 'C' comes with the language file).

                Greetings
                Join smartVISU on facebook. Web: smartvisu.de.
                Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

                Kommentar


                  #9
                  Zitat von Apollo Beitrag anzeigen
                  You have to use '°' as unit only, not '° C' (the 'C' comes with the language file).

                  Greetings
                  Thank you very much that solved the temperatures, what do I do for other types like flow m3/h, and water usage m3???.

                  where can I create other data types??

                  Kommentar


                    #10
                    See post #4.

                    Greetings
                    Join smartVISU on facebook. Web: smartvisu.de.
                    Dir gefällt smartVISU? Bitte spenden für die Weiterentwicklung.

                    Kommentar


                      #11
                      Also this is possible:

                      Code:
                      {{ basic.formula(id~'-f1', gad_sensor, 'bar', '((' ~ max ~ ' / 100) * VAR).toFixed(2)' ) }}
                      With the .toFixed(2) the Value get displayed with 2 decimals

                      in your example:

                      Code:
                      {{ basic.formula('formula1',['Forbrug.Varme.Forbrug'], 'Mwh','(AVG( VAR ) / 1000000).toFixed(2)') }}

                      Kommentar

                      Lädt...
                      X