<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Tabelle mit Verbrauchswerte pro Tag erfassen]]></title><description><![CDATA[<p dir="auto">Hallo zusammen</p>
<p dir="auto">Ich bin auf der Suche nach einer Vorlage für eine Tabelle, in der mir jeden Tag um 23:59 bestimmte Werte aus einem Datenpunkt hineingeschrieben wird samt Datum.</p>
<p dir="auto">Ich möchte gerne jede Nacht die Verbrauchsdaten unseres Stromes in der Tabelle pro Tag darstellen.</p>
<p dir="auto">Beispiel:<br />
<img src="/assets/uploads/files/1664115466882-7c7b91f1-aa12-47ba-87ab-343ffd6fdc32-grafik.png" alt="7c7b91f1-aa12-47ba-87ab-343ffd6fdc32-grafik.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Hat da jemand schon mal sowas gemacht und könnte mir zeigen wie das geht?</p>
]]></description><link>https://forum.iobroker.net/topic/58317/tabelle-mit-verbrauchswerte-pro-tag-erfassen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 10 May 2026 03:38:57 GMT</lastBuildDate><atom:link href="https://forum.iobroker.net/topic/58317.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 Sep 2022 14:19:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Tue, 11 Apr 2023 18:50:49 GMT]]></title><description><![CDATA[<p dir="auto">Frage hat sich erledigt, heute gehts auf einmal.</p>
]]></description><link>https://forum.iobroker.net/post/975721</link><guid isPermaLink="true">https://forum.iobroker.net/post/975721</guid><dc:creator><![CDATA[ostseeskipper]]></dc:creator><pubDate>Tue, 11 Apr 2023 18:50:49 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Wed, 05 Oct 2022 16:52:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: irgendwie was falsch ist:</p>
<p dir="auto">Die schließende if-Klammer gehört nicht in Zeile 10, sondern in Zeile 29.</p>
]]></description><link>https://forum.iobroker.net/post/868749</link><guid isPermaLink="true">https://forum.iobroker.net/post/868749</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Wed, 05 Oct 2022 16:52:56 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Wed, 05 Oct 2022 16:47:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> Das mit den Auswertungen funktioniert einwandfrei. Nur habe ich jetzt festgestellt, das beim Monatsverbrauch irgendwie was falsch ist:</p>
<pre><code>const idVerbrauch = '0_userdata.0.Wohnungsverbrauch.Monatsverbrauch_kwh';// ID zuweisen!

const idTable = '0_userdata.0.Wohnungsverbrauch.Monatsverbrauch';// ID anpassen!

schedule('59 23 28-31 * *', function() { 

    let morgen = Date.now() + 120000; // 23:59 + 2 Minuten

    if(new Date(morgen).getDate() == 1) { // morgen ist der 1. des Monats
     }

    var arr = [];

    if(getState(idTable).val) arr = JSON.parse(getState(idTable).val);

    const obj = {

        Datum: formatDate(new Date(), 'DD.MM.YYYY'),

        Verbrauch: getState(idVerbrauch).val.toFixed(3) + ' kwh'

    }

    arr.push(obj);

    if(arr.length &gt; 20) arr.shift(); // max. 20 Zeilen

    setState(idTable, JSON.stringify(arr), true);

});

</code></pre>
<p dir="auto">Auswertung zeigt folgendes an:</p>
<pre><code>[
  {
    "Datum": "28.09.2022",
    "Verbrauch": "144.2827 kwh"
  },
  {
    "Datum": "29.09.2022",
    "Verbrauch": "148.8127 kwh"
  },
  {
    "Datum": "30.09.2022",
    "Verbrauch": "153.0203 kwh"
  }
]
</code></pre>
]]></description><link>https://forum.iobroker.net/post/868746</link><guid isPermaLink="true">https://forum.iobroker.net/post/868746</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Wed, 05 Oct 2022 16:47:37 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 02 Oct 2022 13:08:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: in Deutsch oder Englisch angezeigt?</p>
<pre><code>15:07:52.496	info	javascript.1 (1952) script.js.common.Neuer_Test: So, 02.10.2022
</code></pre>
]]></description><link>https://forum.iobroker.net/post/866896</link><guid isPermaLink="true">https://forum.iobroker.net/post/866896</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 02 Oct 2022 13:08:35 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 02 Oct 2022 12:56:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> sagte in <a href="/post/866878">Tabelle mit Verbrauchswerte pro Tag erfassen</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: beim Datum noch den Wochentag angezeigt zu haben?</p>
<pre><code>        Datum: formatDate(new Date(), 'W, DD.MM.YYYY'),
</code></pre>
</blockquote>
<p dir="auto">Werden die Tage dann in Deutsch oder Englisch angezeigt?</p>
]]></description><link>https://forum.iobroker.net/post/866890</link><guid isPermaLink="true">https://forum.iobroker.net/post/866890</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 02 Oct 2022 12:56:55 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 02 Oct 2022 12:44:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: beim Datum noch den Wochentag angezeigt zu haben?</p>
<pre><code>        Datum: formatDate(new Date(), 'W, DD.MM.YYYY'),
</code></pre>
]]></description><link>https://forum.iobroker.net/post/866878</link><guid isPermaLink="true">https://forum.iobroker.net/post/866878</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 02 Oct 2022 12:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 02 Oct 2022 11:27:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> funktioniert einwandrei.</p>
<p dir="auto">Was müsste ich einbinden, um beim Datum noch den Wochentag angezeigt zu haben?</p>
]]></description><link>https://forum.iobroker.net/post/866802</link><guid isPermaLink="true">https://forum.iobroker.net/post/866802</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 02 Oct 2022 11:27:49 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sat, 01 Oct 2022 08:53:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: Welchen Trick muss ich anwenden, das in der Tabelle nur 3 Zahlen nach dem Punkt erscheinen?</p>
<pre><code>        Verbrauch: getState(idVerbrauch).val.toFixed(3) + ' kWh'
</code></pre>
]]></description><link>https://forum.iobroker.net/post/866368</link><guid isPermaLink="true">https://forum.iobroker.net/post/866368</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sat, 01 Oct 2022 08:53:11 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sat, 01 Oct 2022 08:33:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> Welchen Trick muss ich anwenden, das in der Tabelle nur 3 Zahlen nach dem Punkt erscheinen?</p>
<p dir="auto"><img src="/assets/uploads/files/1664613192426-258773a4-a98d-4ca5-8632-e5aa4aa28652-grafik.png" alt="258773a4-a98d-4ca5-8632-e5aa4aa28652-grafik.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.iobroker.net/post/866356</link><guid isPermaLink="true">https://forum.iobroker.net/post/866356</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sat, 01 Oct 2022 08:33:16 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 15:47:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: wie trage ich den das ein, wenn ich immer am letzen Tag des Monats den Eintrag haben möchte?</p>
<pre><code>schedule('59 23 28-31 * *', function() { 
    let morgen = Date.now() + 120000; // 23:59 + 2 Minuten
    if(new Date(morgen).getDate() == 1) { // morgen ist der 1. des Monats

    }
});
</code></pre>
]]></description><link>https://forum.iobroker.net/post/863196</link><guid isPermaLink="true">https://forum.iobroker.net/post/863196</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 15:47:56 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 15:40:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a><br />
Aber was mir jetzt noch unklar ist, wie trage ich den das ein, wenn ich immer am letzen Tag des Monats den Eintrag haben möchte?<br />
Nicht jeder Monat hat ja 31 Tage.</p>
]]></description><link>https://forum.iobroker.net/post/863194</link><guid isPermaLink="true">https://forum.iobroker.net/post/863194</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 15:40:08 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 15:26:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: Für was stehen den die anderen 2 Sterne?</p>
<p dir="auto"><a href="https://de.wikipedia.org/wiki/Cron" rel="nofollow ugc">Für Tag des Monats und Monat.</a></p>
]]></description><link>https://forum.iobroker.net/post/863187</link><guid isPermaLink="true">https://forum.iobroker.net/post/863187</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 15:26:12 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 15:24:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> sagte in <a href="/post/863168">Tabelle mit Verbrauchswerte pro Tag erfassen</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: jeden Sonntag Abend um 23:59</p>
<pre><code>'59 23 * * 0'
</code></pre>
</blockquote>
<p dir="auto">Für was stehen den die anderen 2 Sterne?</p>
]]></description><link>https://forum.iobroker.net/post/863185</link><guid isPermaLink="true">https://forum.iobroker.net/post/863185</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 15:24:58 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 15:10:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: jeden Sonntag Abend um 23:59</p>
<pre><code>'59 23 * * 0'
</code></pre>
]]></description><link>https://forum.iobroker.net/post/863168</link><guid isPermaLink="true">https://forum.iobroker.net/post/863168</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 15:10:11 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 15:05:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> Wenn ich jeden Sonntag Abend um 23:59 einen Wert in die Tabelle geschrieben haben möchte, wie muss den die Logik sein bei Schedule?</p>
]]></description><link>https://forum.iobroker.net/post/863163</link><guid isPermaLink="true">https://forum.iobroker.net/post/863163</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 15:05:34 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:59:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> Super Danke für den Hinweis.</p>
]]></description><link>https://forum.iobroker.net/post/863161</link><guid isPermaLink="true">https://forum.iobroker.net/post/863161</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:59:32 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:58:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: Gibt es auch eine Möglichkeit, nach z.B 30 Tagen den 1. alten Wert zu entfernen usw:?</p>
<p dir="auto">Mit</p>
<pre><code>    if(arr.length &gt; 10) arr.shift(); // max. 10 Zeilen
</code></pre>
<p dir="auto">wird schon nach 10 Tagen der älteste Wert entfernt.</p>
]]></description><link>https://forum.iobroker.net/post/863159</link><guid isPermaLink="true">https://forum.iobroker.net/post/863159</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:58:34 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:56:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> sagte in <a href="/post/863153">Tabelle mit Verbrauchswerte pro Tag erfassen</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: Der Typ muss schon String sein als Datenpunkt oder?</p>
<p dir="auto">Ja, oder "json".</p>
</blockquote>
<p dir="auto">Jetzt funktioniert es. Perfekt.</p>
<p dir="auto">Gibt es auch eine Möglichkeit, nach z.B 30 Tagen den 1. alten Wert zu entfernen usw:?</p>
]]></description><link>https://forum.iobroker.net/post/863158</link><guid isPermaLink="true">https://forum.iobroker.net/post/863158</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:56:38 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:51:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: Der Typ muss schon String sein als Datenpunkt oder?</p>
<p dir="auto">Ja, oder "json".</p>
]]></description><link>https://forum.iobroker.net/post/863153</link><guid isPermaLink="true">https://forum.iobroker.net/post/863153</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:51:29 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:51:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a><br />
Ja da steht schon einen Wert drin: [{"Datum":"25.09.2022","Verbrauch":"2881.4 Wh"}]<br />
Der Typ muss schon String sein als Datenpunkt oder?</p>
<p dir="auto">Edit: OK korrigiere das Skript</p>
]]></description><link>https://forum.iobroker.net/post/863151</link><guid isPermaLink="true">https://forum.iobroker.net/post/863151</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:51:39 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:50:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: bekomme diese Meldung im Log:</p>
<p dir="auto">Hat der Datenpunkt '0_userdata.0.Wohnungsverbrauch.Tagesverbrauch' schon einen Wert? Er sollte nach dem Erstellen nur einen Leerstring enthalten.</p>
<p dir="auto">Sorry, habe Fehler entdeckt. Richtig:</p>
<pre><code>    if(getState(idTable).val) arr = JSON.parse(getState(idTable).val);
</code></pre>
]]></description><link>https://forum.iobroker.net/post/863149</link><guid isPermaLink="true">https://forum.iobroker.net/post/863149</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:50:30 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:45:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul53" aria-label="Profile: paul53">@<bdi>paul53</bdi></a> Vielen Dank</p>
<p dir="auto">Hab es kurz getestet, bekomme diese Meldung im Log:</p>
<pre><code>2022-09-25 16:44:00.009 - error: javascript.0 (901036) Error in callback: TypeError: arr.push is not a function
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at Object. (script.js.Stromverbrauch.Tagesverbrauch:23:9)
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at Job.job (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1565:34)
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at Job.invoke (/opt/iobroker/node_modules/node-schedule/lib/Job.js:171:15)
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at /opt/iobroker/node_modules/node-schedule/lib/Invocation.js:268:28
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at Timeout._onTimeout (/opt/iobroker/node_modules/node-schedule/lib/Invocation.js:228:7)
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at listOnTimeout (node:internal/timers:559:17)
2022-09-25 16:44:00.010 - error: javascript.0 (901036) at processTimers (node:internal/timers:502:7)
</code></pre>
<p dir="auto">Skript sieht so aus:</p>
<pre><code>const idVerbrauch = 'javascript.0.ShellyVerbrauch.SHEM-3#E8DB84D68CF6#1.Total.heute'; // ID zuweisen!

const idTable = '0_userdata.0.Wohnungsverbrauch.Tagesverbrauch'; // ID anpassen!

 schedule('44 16 * * *', function() {

    var arr = [];

    if(getState(idTable).val) arr = JSON.parse(getState(idVerbrauch).val);

    const obj = {

        Datum: formatDate(new Date(), 'DD.MM.YYYY'),

        Verbrauch: getState(idVerbrauch).val + ' Wh'

    }

    arr.push(obj);

    if(arr.length &gt; 10) arr.shift(); // max. 10 Zeilen

    setState(idTable, JSON.stringify(arr), true);

});

</code></pre>
]]></description><link>https://forum.iobroker.net/post/863147</link><guid isPermaLink="true">https://forum.iobroker.net/post/863147</guid><dc:creator><![CDATA[stefu87_CH]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:45:44 GMT</pubDate></item><item><title><![CDATA[Reply to Tabelle mit Verbrauchswerte pro Tag erfassen on Sun, 25 Sep 2022 14:49:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/stefu87_ch" aria-label="Profile: stefu87_ch">@<bdi>stefu87_ch</bdi></a> sagte: Tabelle, in der mir jeden Tag um 23:59 bestimmte Werte aus einem Datenpunkt hineingeschrieben wird samt Datum.</p>
<p dir="auto">JSON-Table:</p>
<pre><code>const idVerbrauch = ''; // ID zuweisen!
const idTable = '0_userdata.0.xyz'; // ID anpassen!

schedule('59 23 * * *', function() {
    var arr = [];
    if(getState(idTable).val) arr = JSON.parse(getState(idTable).val);
    const obj = {
        Datum: formatDate(new Date(), 'DD.MM.YYYY'),
        Verbrauch: getState(idVerbrauch).val + ' Wh'
    }
    arr.push(obj);
    if(arr.length &gt; 10) arr.shift(); // max. 10 Zeilen
    setState(idTable, JSON.stringify(arr), true);
});
</code></pre>
]]></description><link>https://forum.iobroker.net/post/863136</link><guid isPermaLink="true">https://forum.iobroker.net/post/863136</guid><dc:creator><![CDATA[paul53]]></dc:creator><pubDate>Sun, 25 Sep 2022 14:49:56 GMT</pubDate></item></channel></rss>