NEWS
Influxdb einlesen ?
-
-
@paul53 der Wert ist falsch, sollte bei 6600 sein
welche Zeit nimmt er da? 6h ? die kommt vom ioBroker
die Abfrage "Letzte" sollte eigentlich die Zeit dann egal sein, oder? -
@humidor sagte: die Abfrage "Letzte" sollte eigentlich die Zeit dann egal sein, oder?
Ja, es wird der letzte Eintrag in der DB genommen. Die Zeiten sind alle UTC-Zeiten (-1 h).
-
@paul53 tja, er machts nicht richtig, den val was er da im string zeigt, ist nicht der Wert den der Datenpunkt hat und der Wert verändert sich auch nicht.
-
@humidor sagte: ist nicht der Wert den der Datenpunkt hat
Der Wert kommt doch von extern. Dann kann es keine ID des ioBroker mit der DB sein. Es muss die komplette ID als Text übergeben werden - so wie sie in der DB steht.
-
@paul53 ja, das wäre meine nächste Frage
aktuell teste ich noch mit einem Wert der am ioB vorhanden ist und ich auch auf dem Handy zum Vergleich sehe
der Datenpunkt wird in die influx geschrieben, das Blockly soll diesen auslesen
(später dann ein Wert, der nicht am ioB liegt) -
@humidor sagte: ist nicht der Wert den der Datenpunkt hat und der Wert verändert sich auch nicht.
Mit History zeigt er mir den aktuellen DP-Wert..
-
@humidor sagte: möchte im ioB Blockly einen nicht vorhanden Wert aus der Influxdb auslesen und in einem Datenpunkt ablegen.
Weshalb überträgst du die Werte nicht per Simple-API oder MQTT?
-
@paul53 history zeigt er einen anderen String (wie bei dir), Wert stimmt auch nicht
-
aha, jetzt hat er den Wert verändert, da ist eine massive Zeitverzögerung drin ???
-
@humidor sagte: da ist eine massive Zeitverzögerung drin ???
Die Zeitstempel liegen 10 Minuten auseinander. Wird der Wert nur alle 10 Minuten geändert?
-
@paul53 der Wert ändert sich sekündlich
-
@humidor sagte: der Wert ändert sich sekündlich
Vielleicht lassen die History-Einstellungen nur alle 10 Minuten zu?
-
@paul53 im Adapter ist alle auf 0, kA wo diese Zeit her resultiert
denke bei influx wird das auch sein, ich lasse mal laufennein, bei der influx ändert er den Wert nicht (aktuell)
Stunde später noch immer der selbe Wert, also das fkt. mal gar nicht.
-
@paul53 mit Blockly fkt. das nicht, die Werte sind nicht aktuell bzw. irgend welche?
gäbe es eine andere Möglichkeit einen Wert aus der Influx auszulesen und in einem DP zu übertragen ?
-
Ich habe in meiner Influxdatenbank ein Measurement mit Einträgen die nicht über einen iob-Datenpunkt gemacht wurden. Es ist jeweils ein json-Eintrag pro Stunde in der Datenbank. Mit diesem Script lese ich die Daten für einen bestimmten Zeitraum aus und lege die abgerufenen Daten als json in einen Datenpunkt um dann mit Excel darauf zugreifen zu können, bzw. werden die Daten einmal im Monat auf eine externe Datei gelegt. Geht vielleicht auch noch einfacher, aber funktioniert bei mir seit einem halben Jahr perfekt.
-
-
@manfredhi kannst du bitte den code einstellen, danke
@paul53 wie ich schon oben gesagt habe, das will ich nicht. geht auch um andere Dinge die nicht von einem ioB kommen, dh ich möchte es verstehen/lernen, kann ja nicht so ein Thema sein eine influxdb einen Wert einzulesen, dachte ich mir...
-
@humidor sagte in Influxdb einlesen ?:
kannst du bitte den code einstellen, danke
hier. eventuell kann man das noch optimieren oder vereinfachen. Aber bei mir funktioniert es auf alle Fälle.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="-iYozy]V_4xRN]whsBdi">dateiSchreiben</variable> <variable id="V/vm0D)?F~?$qg++kc?P">result</variable> <variable id="qGeC1J|}4W~i`zI6iRZE">suche_von</variable> <variable id="Fqylm,whrCxuJN%}qo+N">InfluxDB_Abfragesyntax</variable> <variable id="/ZDA7bcDIyIeO(AGd:]$">suche_bis</variable> <variable id="w`Y:wke@jbroqEP*knjE">json-object</variable> <variable id="LajR`?NMnD9PA`wwrrw6">anzahl_eintraege</variable> <variable id="[V9DMfmrXkZ7H6.{Gi91">ergebnis</variable> <variable id="G~+^Ru{LN7HF!MA}.$W9">i</variable> </variables> <block type="on" id="diIr#j6r!X,8A24|)|WX" x="-812" y="-1187"> <field name="OID">0_userdata.0.Strom.SmartEnergy.EXCEL-Export</field> <field name="CONDITION">true</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="controls_if" id="##JpQ^(`go*~.`mTY~fv"> <value name="IF0"> <block type="on_source" id="A[VJ}+(J.zuT:b{kQ)5u"> <field name="ATTR">state.val</field> </block> </value> <statement name="DO0"> <block type="procedures_callnoreturn" id="0FW:ogXLF^S/@.;P79#X"> <mutation name="taeglAbfrage"></mutation> <next> <block type="procedures_callnoreturn" id=".?L4PR(m]n|1eqQwKxOH"> <mutation name="datenbankabfrage"></mutation> <next> <block type="toggle" id="ed$.W2(K!aT#p0g2mZ@E"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Strom.SmartEnergy.EXCEL-Export</field> <field name="WITH_DELAY">FALSE</field> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> <block type="procedures_defnoreturn" id="^vgK-zMfKsA.SRbq8s;9" x="-812" y="-887"> <field name="NAME">taeglAbfrage</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="variables_set" id="AhRw^5=W|dMmG65z351("> <field name="VAR" id="-iYozy]V_4xRN]whsBdi">dateiSchreiben</field> <value name="VALUE"> <block type="logic_boolean" id="17;RY7j+V3!v(cea14:,"> <field name="BOOL">FALSE</field> </block> </value> <next> <block type="variables_set" id="IS:vt@^3lQ7$UeWukBn:"> <field name="VAR" id="qGeC1J|}4W~i`zI6iRZE">suche_von</field> <value name="VALUE"> <block type="text_join" id="Z#z{{H1$kh`y@1;?}gnE"> <mutation items="2"></mutation> <value name="ADD0"> <block type="get_value" id="hhT1e_mpeM4$x7cZMbW:"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Strom.influxExportDatei_bis</field> </block> </value> <value name="ADD1"> <block type="text" id="3X%w(;^X@Jci9_xTO(Ws"> <field name="TEXT">000000</field> </block> </value> </block> </value> <next> <block type="variables_set" id="A,RQt}[_kfYO;v|OS!Ev"> <field name="VAR" id="/ZDA7bcDIyIeO(AGd:]$">suche_bis</field> <value name="VALUE"> <block type="text_join" id="aXuZ2vZfXA/W2bCBp+#I"> <mutation items="2"></mutation> <value name="ADD0"> <block type="convert_from_date" id="?6jr?*{rpq{E-8InaJDV"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="convert_from_date" id="3Dl^kK[ju62+*WvteI:w"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT 00:00</field> <value name="VALUE"> <block type="math_arithmetic" id="YsEN0I2zghFrVIvz4*t`"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="Eq}mnYMs51o9X1``F5F("> <field name="NUM">1</field> </shadow> <block type="time_get" id="_fd;v8_M0CYKW0?G@f-L"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="rLp8HiR|lr_]$7F#9B:-"> <field name="NUM">172800000</field> </shadow> </value> </block> </value> </block> </value> </block> </value> <value name="ADD1"> <block type="text" id="]e4510]M7OEv7:g*q7p!"> <field name="TEXT">000000</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="dEh,88Y$)?i#~9;;dStz" x="-806" y="-625"> <field name="NAME">datenbankabfrage</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="variables_set" id="}2O[l{tcSn,,5-0H*n9U"> <field name="VAR" id="V/vm0D)?F~?$qg++kc?P">result</field> <value name="VALUE"> <block type="logic_null" id="Fsif^MQ(4W?X1.-xfk?X"></block> </value> <next> <block type="variables_set" id="bVE*+o=uT(,4kkdJ=4K:"> <field name="VAR" id="Fqylm,whrCxuJN%}qo+N">InfluxDB_Abfragesyntax</field> <value name="VALUE"> <block type="text_join" id="l2GO/TaD;0BHSC_WeXh6"> <mutation items="5"></mutation> <value name="ADD0"> <block type="text" id="(q|JDaCd3_Q`3[wsJ9:r"> <field name="TEXT">SELECT * FROM JSON_Stundentarife WHERE time >= </field> </block> </value> <value name="ADD1"> <block type="variables_get" id="ph[x0^8cqa{ipE]x2R1J"> <field name="VAR" id="qGeC1J|}4W~i`zI6iRZE">suche_von</field> </block> </value> <value name="ADD2"> <block type="text" id="M4ZOBW-5w~x^BxKg?y`W"> <field name="TEXT"> AND time <= </field> </block> </value> <value name="ADD3"> <block type="variables_get" id="}qv15Jv.j*]+^{s7DI!l"> <field name="VAR" id="/ZDA7bcDIyIeO(AGd:]$">suche_bis</field> </block> </value> <value name="ADD4"> <block type="text" id="+U/|*/;%oV=?xpL0WlnY"> <field name="TEXT"> order by ASC</field> </block> </value> </block> </value> <next> <block type="debug" id="S*M0(H@5N;Ht[G=nnVG?"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="o@q3KDawSxmd/nGY{KqR"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="_Jj0(,HheHII7A6WF$6)"> <field name="VAR" id="Fqylm,whrCxuJN%}qo+N">InfluxDB_Abfragesyntax</field> </block> </value> <next> <block type="sendto_custom" id=";^*b1J0)qb/%2O/us/TG"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="" with_statement="true"></mutation> <field name="INSTANCE">influxdb.0</field> <field name="COMMAND">query</field> <field name="LOG"></field> <field name="WITH_STATEMENT">TRUE</field> <value name="ARG0"> <shadow type="text" id="tm+Uk%N6(cGIc{m;Q`:@"> <field name="TEXT"> SELECT * FROM jsonManuell order by ASC</field> </shadow> <block type="variables_get" id="EA`6[.dzX`W_+p`eit.N"> <field name="VAR" id="Fqylm,whrCxuJN%}qo+N">InfluxDB_Abfragesyntax</field> </block> </value> <statement name="STATEMENT"> <block type="variables_set" id="*px/n$ENeWy~Y%7JdWDx"> <field name="VAR" id="w`Y:wke@jbroqEP*knjE">json-object</field> <value name="VALUE"> <block type="get_attr" id=")eSsID4gbSj=q-8D=J6+"> <value name="PATH"> <shadow type="text" id="$x*nO3U4CA.CT_x$]v!t"> <field name="TEXT">result.0</field> </shadow> </value> <value name="OBJECT"> <block type="variables_get" id=";:oVhm-8ozM2r^|]SZyW"> <field name="VAR" id="V/vm0D)?F~?$qg++kc?P">result</field> </block> </value> </block> </value> <next> <block type="variables_set" id="a[):l60Z8e[-zbyf.yi~"> <field name="VAR" id="LajR`?NMnD9PA`wwrrw6">anzahl_eintraege</field> <value name="VALUE"> <block type="lists_length" id="X9;1;6^Cj(UOV`np[Ga1"> <value name="VALUE"> <block type="variables_get" id="VMc[krPK5OWsP^Boa~oe"> <field name="VAR" id="w`Y:wke@jbroqEP*knjE">json-object</field> </block> </value> </block> </value> <next> <block type="variables_set" id="*{FMqk:b3a_vB=[#Sdtt"> <field name="VAR" id="[V9DMfmrXkZ7H6.{Gi91">ergebnis</field> <value name="VALUE"> <block type="text" id="t:~`hmy|KSnf!s0.@z!$"> <field name="TEXT">[</field> </block> </value> <next> <block type="variables_set" id="6D:zKF+b{#/f``6|0/GG"> <field name="VAR" id="G~+^Ru{LN7HF!MA}.$W9">i</field> <value name="VALUE"> <block type="math_number" id="UZ?:#L02Nc[km#T;i]+D"> <field name="NUM">1</field> </block> </value> <next> <block type="controls_for" id="?LPl6s1?4OW$Yjeeo=KI"> <field name="VAR" id="G~+^Ru{LN7HF!MA}.$W9">i</field> <value name="FROM"> <shadow type="math_number" id=".$UO)o+z4oj$YPt`2@zy"> <field name="NUM">1</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id=",C#-6johs4W}|9Mnj6Yq"> <field name="NUM">10</field> </shadow> <block type="variables_get" id="Gsu_ck.%VrRw|Ef#S%r!"> <field name="VAR" id="LajR`?NMnD9PA`wwrrw6">anzahl_eintraege</field> </block> </value> <value name="BY"> <shadow type="math_number" id="isvarYP/br5Qz2D#=u#Y"> <field name="NUM">1</field> </shadow> </value> <statement name="DO"> <block type="text_append" id=";*UBmeoNqpf,%o^vHC`1"> <field name="VAR" id="[V9DMfmrXkZ7H6.{Gi91">ergebnis</field> <value name="TEXT"> <shadow type="text" id="CZ4`w78JH,R5Qpc`BbNp"> <field name="TEXT"></field> </shadow> <block type="get_attr" id="s|%Lxl(|+ySoVrIXM[{;"> <value name="PATH"> <shadow type="text" id="YCdlvf)LbNKm0]o47`l8"> <field name="TEXT">value</field> </shadow> </value> <value name="OBJECT"> <block type="lists_getIndex" id="9d,OK5V}2I_%}B=O#N7."> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="?`@1OOYZrSVL,PuBH7I*"> <field name="VAR" id="w`Y:wke@jbroqEP*knjE">json-object</field> </block> </value> <value name="AT"> <block type="variables_get" id="Drg!4`7.HmWYzww41Ut]"> <field name="VAR" id="G~+^Ru{LN7HF!MA}.$W9">i</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_if" id="-/1:*/bsDa24{WFg:yfu"> <value name="IF0"> <block type="logic_compare" id="f*UzD;qx;]hiZsF0gV|V"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="D:E2s0-@0Q}D!e_xP-)s"> <field name="VAR" id="G~+^Ru{LN7HF!MA}.$W9">i</field> </block> </value> <value name="B"> <block type="variables_get" id="_?s_`uj{(6rzD+yyb48^"> <field name="VAR" id="LajR`?NMnD9PA`wwrrw6">anzahl_eintraege</field> </block> </value> </block> </value> <statement name="DO0"> <block type="text_append" id="x^*FOrgT5*M0cLH5vhO+"> <field name="VAR" id="[V9DMfmrXkZ7H6.{Gi91">ergebnis</field> <value name="TEXT"> <shadow type="text" id="Y{#+CZ[k~#!p{j!VfY54"> <field name="TEXT">,</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> <next> <block type="text_append" id="hk}/~2(StYRd0j,9=vsd"> <field name="VAR" id="[V9DMfmrXkZ7H6.{Gi91">ergebnis</field> <value name="TEXT"> <shadow type="text" id=",JrV!])A}3t}%Y=zE.t]"> <field name="TEXT">]</field> </shadow> </value> <next> <block type="control" id="Zszez6Q@cnZn[p/BZA}T"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Strom.influxExport</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="~`UhF(U-HgZEEZ8kog6f"> <field name="VAR" id="[V9DMfmrXkZ7H6.{Gi91">ergebnis</field> </block> </value> <next> <block type="debug" id="uB[*lP+v`$?~v{@%AlRE"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="_31*x(B=XdRq9`TP1QGu"> <field name="TEXT">test</field> </shadow> <block type="text_join" id="}XJ{U5a/IJQlgc2+=oQ{"> <mutation items="2"></mutation> <value name="ADD0"> <block type="variables_get" id="D,z;Z8*C#%*hdj{7}70y"> <field name="VAR" id="LajR`?NMnD9PA`wwrrw6">anzahl_eintraege</field> </block> </value> <value name="ADD1"> <block type="text" id="!_Tq^ZJf9S;!gC4Q#hHu"> <field name="TEXT"> Datensätze wurden für Excel exportiert.</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
-
@manfredhi damit ich dein Blockly verstehe, möchte ich es bitte mit dir durchgehen
du startest die Abfrage manuell?
darin rufst du die Funktion täglAbfrage und Datenbankabfrage auf
und speicherst? dann in die Excel?