Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Tester
    4. Test Adapter flexcharts - Stapeldiagramme und mehr

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Test Adapter flexcharts - Stapeldiagramme und mehr

    This topic has been deleted. Only users with topic management privileges can see it.
    • U
      UlliJ @jrbwh last edited by

      @jrbwh sagte in Test Adapter flexcharts - Stapeldiagramme und mehr:

      Werde das am WE oder nächste Woche einbauen und ein Release machen.

      Super, danke und gute Reise

      jrbwh 1 Reply Last reply Reply Quote 0
      • SMS
        SMS @jrbwh last edited by

        @jrbwh Denke ich habe es hinbekommen:
        ebf7c67b-95aa-4f25-a319-3d9ae77bc5e0-grafik.png
        könnte das richtig sein?
        Daten eingefügt und alles wo weekly stand in daily bzw. hourly abgeändert

        hier habe ich einen Unterschied:
        c0a63f32-68ca-40fe-b5ca-82fad7f2750c-grafik.png

        Frage zu Punkt 2 deine Anleitung:
        welches soll ich nehmen?
        8762e7d5-3aeb-47b0-86fe-2ee55c34df98-grafik.png
        nehme ich JS und füge alles ein (ich habe jetzt mal das Skript für daily und hourly geändert und drüber eingefügt

        //
        // Create chart for Tibber hourly data to be used with flexcharts
        //
        
        const ID_TIBBER_HOURLY = '0_userdata.0.flexcharts.tibberLink.tibberHourly';    // State id containing tibber data (json format)
        const ID_CHART_HOURLY  = '0_userdata.0.flexcharts.tibberLink.charthourly';     // State id containing template for chart data (json format)
        const TITLE_HOURLY     = 'Tibber hourly';                                                             // Title of chart
        
        evalTibberData(ID_TIBBER_HOURLY, ID_CHART_HOURLY, TITLE_HOURLY);    // Convert data on start of script
        
        on({id: ID_TIBBER_HOURLY, change: "any"}, function (obj) {
            evalTibberData(ID_TIBBER_HOURLY, ID_CHART_HOURLY, TITLE_HOURLY);
        });
        
        function evalTibberData(idTibber, idChart, title) {
            const tibber = JSON.parse(getState(idTibber).val);  // Read tibber data
            const chart = JSON.parse(getState(idChart).val);    // Read chart template
            const xAxis  = [];
            const yAxis0 = [];
            const yAxis1 = [];
            for (const data of Object.values(tibber)) {
                xAxis.push(new Date(data.from).toLocaleDateString());
                yAxis0.push(data.consumption.toFixed(2));
                yAxis1.push(data.cost.toFixed(2));
            }
            chart.title.text = title;           // Set chart title
            chart.xAxis[0].data  = xAxis;       // Set chart x-axis data
            chart.series[0].data = yAxis0;      // Set chart y-values consumption
            chart.series[1].data = yAxis1;      // Set chart y-values cost
            setState(idChart, JSON.stringify(chart), true); // Write changed chart data to state
            console.log('Evaluation of tibber hourly data done. Title: '+title);
        }
        //
        //
        //
        // Create chart for Tibber daily data to be used with flexcharts
        //
        
        const ID_TIBBER_DAILY = '0_userdata.0.flexcharts.tibberLink.tibberDaily';    // State id containing tibber data (json format)
        const ID_CHART_DAILY  = '0_userdata.0.flexcharts.tibberLink.chartDaily';     // State id containing template for chart data (json format)
        const TITLE_DAILY     = 'Tibber daily';                                                             // Title of chart
        
        evalTibberData(ID_TIBBER_DAILY, ID_CHART_DAILY, TITLE_DAILY);    // Convert data on start of script
        
        on({id: ID_TIBBER_DAILY, change: "any"}, function (obj) {
            evalTibberData(ID_TIBBER_DAILY, ID_CHART_DAILY, TITLE_DAILY);
        });
        
        function evalTibberData(idTibber, idChart, title) {
            const tibber = JSON.parse(getState(idTibber).val);  // Read tibber data
            const chart = JSON.parse(getState(idChart).val);    // Read chart template
            const xAxis  = [];
            const yAxis0 = [];
            const yAxis1 = [];
            for (const data of Object.values(tibber)) {
                xAxis.push(new Date(data.from).toLocaleDateString());
                yAxis0.push(data.consumption.toFixed(2));
                yAxis1.push(data.cost.toFixed(2));
            }
            chart.title.text = title;           // Set chart title
            chart.xAxis[0].data  = xAxis;       // Set chart x-axis data
            chart.series[0].data = yAxis0;      // Set chart y-values consumption
            chart.series[1].data = yAxis1;      // Set chart y-values cost
            setState(idChart, JSON.stringify(chart), true); // Write changed chart data to state
            console.log('Evaluation of tibber daily data done. Title: '+title);
        }
        //
        //
        //
        // Create chart for Tibber weekly data to be used with flexcharts
        //
        
        const ID_TIBBER_WEEKLY = '0_userdata.0.flexcharts.tibberLink.tibberWeekly';    // State id containing tibber data (json format)
        const ID_CHART_WEEKLY  = '0_userdata.0.flexcharts.tibberLink.chartWeekly';     // State id containing template for chart data (json format)
        const TITLE_WEEKLY     = 'Tibber weekly';                                                             // Title of chart
        
        evalTibberData(ID_TIBBER_WEEKLY, ID_CHART_WEEKLY, TITLE_WEEKLY);    // Convert data on start of script
        
        on({id: ID_TIBBER_WEEKLY, change: "any"}, function (obj) {
            evalTibberData(ID_TIBBER_WEEKLY, ID_CHART_WEEKLY, TITLE_WEEKLY);
        });
        
        function evalTibberData(idTibber, idChart, title) {
            const tibber = JSON.parse(getState(idTibber).val);  // Read tibber data
            const chart = JSON.parse(getState(idChart).val);    // Read chart template
            const xAxis  = [];
            const yAxis0 = [];
            const yAxis1 = [];
            for (const data of Object.values(tibber)) {
                xAxis.push(new Date(data.from).toLocaleDateString());
                yAxis0.push(data.consumption.toFixed(2));
                yAxis1.push(data.cost.toFixed(2));
            }
            chart.title.text = title;           // Set chart title
            chart.xAxis[0].data  = xAxis;       // Set chart x-axis data
            chart.series[0].data = yAxis0;      // Set chart y-values consumption
            chart.series[1].data = yAxis1;      // Set chart y-values cost
            setState(idChart, JSON.stringify(chart), true); // Write changed chart data to state
            console.log('Evaluation of tibber weekly data done. Title: '+title);
        }
        

        und starte das Skript kommen folgende Meldungen:
        3a9391f9-2287-478d-a627-9c7733f1d976-grafik.png

        nehme ich blockly bleibt das Feld leer!

        Die Seite aktualisiert sich leider auch nicht wenn das json geändert wird.

        jrbwh 1 Reply Last reply Reply Quote 0
        • jrbwh
          jrbwh @SMS last edited by

          @sms Ja, JS ist richtig. Aber Du hast die Funktion evalTibberData() jetzt zweimal definiert. Das ist falsch. Jede Funktion darf nur einmal definiert werden. Durch die Übergabe der Parameter arbeitet die Funktion ja jeweils mit den gewünschten Daten. Bei charthourly hast Du einen Schreibfehler drin. Das H muss groß geschrieben sein!
          Alle Datenpunkte müssen das Format "JSON" haben.

          SMS 1 Reply Last reply Reply Quote 0
          • SMS
            SMS @jrbwh last edited by

            @jrbwh Einen Schreibfehler habe ich gefunden. Aber irgendwas passt immer noch nicht:

            //
            // Create chart for Tibber hourly data to be used with flexcharts
            //
            
            const ID_TIBBER_HOURLY = '0_userdata.0.flexcharts.tibberLink.tibberHourly';    // State id containing tibber data (json format)
            const ID_CHART_HOURLY  = '0_userdata.0.flexcharts.tibberLink.chartHourly';     // State id containing template for chart data (json format)
            const TITLE_HOURLY     = 'Tibber hourly';                                                             // Title of chart
            
            evalTibberData(ID_TIBBER_HOURLY, ID_CHART_HOURLY, TITLE_HOURLY);    // Convert data on start of script
            
            on({id: ID_TIBBER_HOURLY, change: "any"}, function (obj) {
                evalTibberData(ID_TIBBER_HOURLY, ID_CHART_HOURLY, TITLE_HOURLY);
            });
            
            function evalTibberData(idTibber, idChart, title) {
                const tibber = JSON.parse(getState(idTibber).val);  // Read tibber data
                const chart = JSON.parse(getState(idChart).val);    // Read chart template
                const xAxis  = [];
                const yAxis0 = [];
                const yAxis1 = [];
                for (const data of Object.values(tibber)) {
                    xAxis.push(new Date(data.from).toLocaleDateString());
                    yAxis0.push(data.consumption.toFixed(2));
                    yAxis1.push(data.cost.toFixed(2));
                }
                chart.title.text = title;           // Set chart title
                chart.xAxis[0].data  = xAxis;       // Set chart x-axis data
                chart.series[0].data = yAxis0;      // Set chart y-values consumption
                chart.series[1].data = yAxis1;      // Set chart y-values cost
                setState(idChart, JSON.stringify(chart), true); // Write changed chart data to state
                console.log('Evaluation of tibber hourly data done. Title: '+title);
            }
            

            02c68d36-3c98-4d44-b298-59fc3edd478d-grafik.png

            Geändert habe ich weekly oder WEEKLY auf hourly oder HOURLY, also eigentlich genauso geschrieben (Groß- und Kleinbuchstaben). Da finde ich jetzt keinen Fehler mehr. Komischerweise hat es bei daily funktioniert. Außer das ich noch nicht weiß ob die Seite aktualisiert wird, da es heute morgen nicht geklappt hat.
            Jede Abfrage hat jetzt ein eigenes Skript.
            c7066cad-108b-46dc-8bf6-e2d217530d36-grafik.png

            Kann es was mit der Uhrzeit zu tun haben?
            In chartHourly steht:

            {
              "tooltip": {
                "trigger": "axis",
                "axisPointer": {
                  "type": "cross"
                }
              },
              "legend": {
                "show": true,
                "orient": "horizontal",
                "left": "center",
                "top": 25
              },
              "title": {
                "left": "center",
                "text": "Tibber hourly"
              },
              "grid": {
                "right": "20%"
              },
              "toolbox": {
                "feature": {
                  "dataView": {
                    "show": true,
                    "readOnly": false
                  },
                  "restore": {
                    "show": true
                  },
                  "saveAsImage": {
                    "show": true
                  }
                }
              },
              "xAxis": [
                {
                  "type": "category",
                  "axisTick": {
                    "alignWithLabel": true
                  },
                  "data": [
                    "14:00",
                    "15:00",
                    "16:00"
                  ]
                }
              ],
              "yAxis": [
                {
                  "type": "value",
                  "position": "left",
                  "alignTicks": true,
                  "axisLine": {
                    "show": true,
                    "lineStyle": {
                      "color": "#5470C6"
                    }
                  },
                  "axisLabel": {
                    "formatter": "{value} kWh"
                  }
                },
                {
                  "type": "value",
                  "position": "right",
                  "alignTicks": true,
                  "axisLine": {
                    "show": true,
                    "lineStyle": {
                      "color": "#91CC75"
                    }
                  },
                  "axisLabel": {
                    "formatter": "{value} €"
                  }
                }
              ],
              "series": [
                {
                  "name": "Consumption",
                  "type": "bar",
                  "data": [
                    "0.081",
                    "0.096",
                    "0.086"
                  ]
                },
                {
                  "name": "Cost",
                  "type": "bar",
                  "yAxisIndex": 1,
                  "data": [
                    "0.03",
                    "0.03",
                    "0.03"
                  ]
                }
              ]
            }
            

            Wobei ich die Uhrzeiten selbst eingetragen habe.
            In tibberHourly steht:

            [
              {
                "from": "2025-01-29T09:00:00.000+01:00",
                "to": "2025-01-29T10:00:00.000+01:00",
                "cost": 0.029134056,
                "unitPrice": 0.3641757,
                "unitPriceVAT": 0.0581457,
                "consumption": 0.08,
                "consumptionUnit": "kWh",
                "totalCost": 0.02616991475,
                "unitCost": 0.029134056,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T10:00:00.000+01:00",
                "to": "2025-01-29T11:00:00.000+01:00",
                "cost": 0.0497585053,
                "unitPrice": 0.3339497,
                "unitPriceVAT": 0.0533197,
                "consumption": 0.149,
                "consumptionUnit": "kWh",
                "totalCost": 0.04679436405,
                "unitCost": 0.0497585053,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T11:00:00.000+01:00",
                "to": "2025-01-29T12:00:00.000+01:00",
                "cost": 0.0412843487,
                "unitPrice": 0.3151477,
                "unitPriceVAT": 0.0503177,
                "consumption": 0.131,
                "consumptionUnit": "kWh",
                "totalCost": 0.03832020745,
                "unitCost": 0.0412843487,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T12:00:00.000+01:00",
                "to": "2025-01-29T13:00:00.000+01:00",
                "cost": 0.021706314,
                "unitPrice": 0.3100902,
                "unitPriceVAT": 0.0495102,
                "consumption": 0.07,
                "consumptionUnit": "kWh",
                "totalCost": 0.01874217275,
                "unitCost": 0.021706314,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T13:00:00.000+01:00",
                "to": "2025-01-29T14:00:00.000+01:00",
                "cost": 0.0307613691,
                "unitPrice": 0.3107209,
                "unitPriceVAT": 0.0496109,
                "consumption": 0.099,
                "consumptionUnit": "kWh",
                "totalCost": 0.02779722785,
                "unitCost": 0.0307613691,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T14:00:00.000+01:00",
                "to": "2025-01-29T15:00:00.000+01:00",
                "cost": 0.0253746675,
                "unitPrice": 0.3132675,
                "unitPriceVAT": 0.0500175,
                "consumption": 0.081,
                "consumptionUnit": "kWh",
                "totalCost": 0.02241052625,
                "unitCost": 0.0253746675,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T15:00:00.000+01:00",
                "to": "2025-01-29T16:00:00.000+01:00",
                "cost": 0.0317964192,
                "unitPrice": 0.3312127,
                "unitPriceVAT": 0.0528827,
                "consumption": 0.096,
                "consumptionUnit": "kWh",
                "totalCost": 0.02883227795,
                "unitCost": 0.0317964192,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T16:00:00.000+01:00",
                "to": "2025-01-29T17:00:00.000+01:00",
                "cost": 0.0315452816,
                "unitPrice": 0.3668056,
                "unitPriceVAT": 0.0585656,
                "consumption": 0.086,
                "consumptionUnit": "kWh",
                "totalCost": 0.02858114035,
                "unitCost": 0.0315452816,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T17:00:00.000+01:00",
                "to": "2025-01-29T18:00:00.000+01:00",
                "cost": 0.0228287815,
                "unitPrice": 0.3869285,
                "unitPriceVAT": 0.0617785,
                "consumption": 0.059,
                "consumptionUnit": "kWh",
                "totalCost": 0.01986464025,
                "unitCost": 0.0228287815,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T18:00:00.000+01:00",
                "to": "2025-01-29T19:00:00.000+01:00",
                "cost": 0.0112388717,
                "unitPrice": 0.3875473,
                "unitPriceVAT": 0.0618773,
                "consumption": 0.029,
                "consumptionUnit": "kWh",
                "totalCost": 0.00827473045,
                "unitCost": 0.0112388717,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T19:00:00.000+01:00",
                "to": "2025-01-29T20:00:00.000+01:00",
                "cost": 0.007660744,
                "unitPrice": 0.3830372,
                "unitPriceVAT": 0.0611572,
                "consumption": 0.02,
                "consumptionUnit": "kWh",
                "totalCost": 0.00469660275,
                "unitCost": 0.007660744,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T20:00:00.000+01:00",
                "to": "2025-01-29T21:00:00.000+01:00",
                "cost": 0.0065872926,
                "unitPrice": 0.3659607,
                "unitPriceVAT": 0.0584307,
                "consumption": 0.018,
                "consumptionUnit": "kWh",
                "totalCost": 0.00362315135,
                "unitCost": 0.0065872926,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T21:00:00.000+01:00",
                "to": "2025-01-29T22:00:00.000+01:00",
                "cost": 0.0063238266,
                "unitPrice": 0.3513237,
                "unitPriceVAT": 0.0560937,
                "consumption": 0.018,
                "consumptionUnit": "kWh",
                "totalCost": 0.00335968535,
                "unitCost": 0.0063238266,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T22:00:00.000+01:00",
                "to": "2025-01-29T23:00:00.000+01:00",
                "cost": 0.0065019577,
                "unitPrice": 0.3422083,
                "unitPriceVAT": 0.0546383,
                "consumption": 0.019,
                "consumptionUnit": "kWh",
                "totalCost": 0.00353781645,
                "unitCost": 0.0065019577,
                "currency": "EUR"
              },
              {
                "from": "2025-01-29T23:00:00.000+01:00",
                "to": "2025-01-30T00:00:00.000+01:00",
                "cost": 1.1309330053,
                "unitPrice": 0.3271429,
                "unitPriceVAT": 0.0522329,
                "consumption": 3.457,
                "consumptionUnit": "kWh",
                "totalCost": 1.12796886405,
                "unitCost": 1.1309330053,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T00:00:00.000+01:00",
                "to": "2025-01-30T01:00:00.000+01:00",
                "cost": 0.1119367431,
                "unitPrice": 0.3189081,
                "unitPriceVAT": 0.0509181,
                "consumption": 0.351,
                "consumptionUnit": "kWh",
                "totalCost": 0.10897260185,
                "unitCost": 0.1119367431,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T01:00:00.000+01:00",
                "to": "2025-01-30T02:00:00.000+01:00",
                "cost": 0.1058853908,
                "unitPrice": 0.3189319,
                "unitPriceVAT": 0.0509219,
                "consumption": 0.332,
                "consumptionUnit": "kWh",
                "totalCost": 0.10292124955,
                "unitCost": 0.1058853908,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T02:00:00.000+01:00",
                "to": "2025-01-30T03:00:00.000+01:00",
                "cost": 0.0892808091,
                "unitPrice": 0.3200029,
                "unitPriceVAT": 0.0510929,
                "consumption": 0.279,
                "consumptionUnit": "kWh",
                "totalCost": 0.08631666785,
                "unitCost": 0.0892808091,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T03:00:00.000+01:00",
                "to": "2025-01-30T04:00:00.000+01:00",
                "cost": 0.089474196,
                "unitPrice": 0.3195507,
                "unitPriceVAT": 0.0510207,
                "consumption": 0.28,
                "consumptionUnit": "kWh",
                "totalCost": 0.08651005475,
                "unitCost": 0.089474196,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T04:00:00.000+01:00",
                "to": "2025-01-30T05:00:00.000+01:00",
                "cost": 0.1077989822,
                "unitPrice": 0.3189319,
                "unitPriceVAT": 0.0509219,
                "consumption": 0.338,
                "consumptionUnit": "kWh",
                "totalCost": 0.10483484095,
                "unitCost": 0.1077989822,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T05:00:00.000+01:00",
                "to": "2025-01-30T06:00:00.000+01:00",
                "cost": 0.1200729635,
                "unitPrice": 0.3382337,
                "unitPriceVAT": 0.0540037,
                "consumption": 0.355,
                "consumptionUnit": "kWh",
                "totalCost": 0.11710882225,
                "unitCost": 0.1200729635,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T06:00:00.000+01:00",
                "to": "2025-01-30T07:00:00.000+01:00",
                "cost": 0.0240216256,
                "unitPrice": 0.3753379,
                "unitPriceVAT": 0.0599279,
                "consumption": 0.064,
                "consumptionUnit": "kWh",
                "totalCost": 0.02105748435,
                "unitCost": 0.0240216256,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T07:00:00.000+01:00",
                "to": "2025-01-30T08:00:00.000+01:00",
                "cost": 0.0121080358,
                "unitPrice": 0.3905818,
                "unitPriceVAT": 0.0623618,
                "consumption": 0.031,
                "consumptionUnit": "kWh",
                "totalCost": 0.00914389455,
                "unitCost": 0.0121080358,
                "currency": "EUR"
              },
              {
                "from": "2025-01-30T08:00:00.000+01:00",
                "to": "2025-01-30T09:00:00.000+01:00",
                "cost": null,
                "unitPrice": 0.3996972,
                "unitPriceVAT": 0.0638172,
                "consumption": null,
                "consumptionUnit": "kWh",
                "totalCost": null,
                "unitCost": null,
                "currency": "EUR"
              }
            ]
            

            Bez. wenn ich auf den Stift gehe unter Objektdaten bei chartHourly:

            {
              "common": {
                "name": "chartHourly",
                "desc": "Manuell erzeugt",
                "role": "state",
                "type": "json",
                "read": true,
                "write": true
              },
              "type": "state",
              "native": {},
              "from": "system.adapter.admin.0",
              "user": "system.user.admin",
              "ts": 1738172595401,
              "_id": "0_userdata.0.flexcharts.tibberLink.chartHourly",
              "acl": {
                "object": 1638,
                "state": 1638,
                "owner": "system.user.admin",
                "ownerGroup": "system.group.administrator"
              }
            }
            

            und bei tibberHourly:

            {
              "common": {
                "name": "tibberHourly",
                "desc": "Manuell erzeugt",
                "role": "state",
                "type": "json",
                "read": true,
                "write": true
              },
              "type": "state",
              "native": {},
              "from": "system.adapter.admin.0",
              "user": "system.user.admin",
              "ts": 1738172636549,
              "_id": "0_userdata.0.flexcharts.tibberLink.tibberHourly",
              "acl": {
                "object": 1638,
                "state": 1638,
                "owner": "system.user.admin",
                "ownerGroup": "system.group.administrator"
              }
            }
            
            jrbwh 2 Replies Last reply Reply Quote 0
            • jrbwh
              jrbwh @SMS last edited by

              @sms Die Fehlermeldung kommt, weil Deine Daten keine gültigen Zahlenwerte, sondern null enthalten. Außerdem sollte bei stündlichen Werten an der x-Achse die Uhrzeit und nicht das Datum stehen.

              Ich habe das Skript entsprechend erweitert. null Werte werden jetzt als 0 gespeichert.

              Wenn du die Funktion evalTibberData() in Deinem Skript durch die geänderte Version ersetzt, sollte es funktionieren.

              SMS 1 Reply Last reply Reply Quote 0
              • jrbwh
                jrbwh @UlliJ last edited by

                @ullij Ich habe eine Version im Branch develop erstellt, kann im Moment aber nur eingeschränkt testen. Bei mir sieht's gut aus. Falls Du es ausprobieren möchtest:

                Im Expertenmodus im Adapter-Installationsdialog unter "Custom" folgende Adresse verwenden:
                https://github.com/MyHomeMyData/ioBroker.flexcharts/tree/develop

                U 2 Replies Last reply Reply Quote 1
                • SMS
                  SMS @jrbwh last edited by SMS

                  @jrbwh Muss ich in dem Skript noch irgendwas anpassen? Irgendeine ID?
                  Leider hat es jetzt nach der letzten Stunde nicht funktioniert. Der Zeitstempel vom DP tibberlink ändert bzw. aktualisiert sich, aber beim DP flexchart ändert sich nichts.

                  Hier Zeitstempel tibberlink nach Neustart des Adapters:
                  e7af3a24-2a62-4b6b-84b7-0ac0e94f8a87-grafik.png
                  Und hier von den angelegten DP's:
                  ac08cbd5-61b3-4f07-b8d0-02815fa4e963-grafik.png

                  jrbwh 1 Reply Last reply Reply Quote 0
                  • U
                    UlliJ @jrbwh last edited by

                    @jrbwh sagte in Test Adapter flexcharts - Stapeldiagramme und mehr:

                    Bei mir sieht's gut aus

                    bei mir noch nicht😢 Habe irgendwo eine Fehlermeldung vom web-Adapter gesehen, bin noch am suchen

                    jrbwh 1 Reply Last reply Reply Quote 0
                    • jrbwh
                      jrbwh @SMS last edited by

                      @sms Wenn die IDs der Datenpunkte im Skript stimmen, sollte es funktionieren. Im Log siehst Du ja, ob das Skript läuft, wenn Du den DP änderst.

                      SMS 1 Reply Last reply Reply Quote 0
                      • jrbwh
                        jrbwh @UlliJ last edited by jrbwh

                        @ullij Funktioniert denn ein anderes Diagramm, also ohne 3D?

                        U 1 Reply Last reply Reply Quote 0
                        • U
                          UlliJ @jrbwh last edited by

                          @jrbwh
                          jepp, die funktionieren wie gehabt. Installiere den Adapter morgen mal neu…kriegen wir schon. Danke

                          1 Reply Last reply Reply Quote 0
                          • SMS
                            SMS @jrbwh last edited by

                            @jrbwh Dann würde ich sagen funktioniert es nicht! Das hier steht im Skript:

                            //
                            // Create chart for Tibber hourly data to be used with flexcharts
                            //
                            
                            const ID_TIBBER_HOURLY = '0_userdata.0.flexcharts.tibberLink.tibberHourly';       // State id containing tibber data (json format)
                            const ID_CHART_HOURLY  = '0_userdata.0.flexcharts.tibberLink.chartHourly';        // State id containing template for chart data (json format)
                            const TITLE_HOURLY     = 'Tibber hourly';
                            
                            evalTibberData(ID_TIBBER_HOURLY, ID_CHART_HOURLY, TITLE_HOURLY);    // Convert data on start of script
                            
                            on({id: ID_TIBBER_HOURLY, change: "any"}, function (obj) {
                                evalTibberData(ID_TIBBER_HOURLY, ID_CHART_HOURLY, TITLE_HOURLY);
                            });
                            
                            function evalTibberData(idTibber, idChart, title) {
                                const tibber = JSON.parse(getState(idTibber).val);  // Read tibber data
                                const chart = JSON.parse(getState(idChart).val);    // Read chart template
                                const xAxis  = [];
                                const yAxis0 = [];
                                const yAxis1 = [];
                                for (const data of Object.values(tibber)) {
                                    const isHourly = (new Date(data.from).getHours() != new Date(data.to).getHours());  // Hourly data?
                                    const xValue = (isHourly ? new Date(data.from).toLocaleTimeString() : new Date(data.from).toLocaleDateString());
                                    xAxis.push(xValue);
                                    yAxis0.push((data.consumption ? data.consumption.toFixed(2) : 0));  // push 0 on null values
                                    yAxis1.push((data.cost ? data.cost.toFixed(2) : 0));                // push 0 on null values
                                }
                                chart.title.text = title;           // Set chart title
                                chart.xAxis[0].data  = xAxis;       // Set chart x-axis data
                                chart.series[0].data = yAxis0;      // Set chart y-values consumption
                                chart.series[1].data = yAxis1;      // Set chart y-values cost
                                setState(idChart, JSON.stringify(chart), true); // Write changed chart data to state
                                console.log('Evaluation of tibber hourly data done. Title: '+title);
                            }
                            

                            Das hier ist die ID vom tibberHourly:
                            55b73699-8c69-402c-928a-09f6f4ad4b33-grafik.png

                            Und hier vom chartHourly:
                            3c4eea95-f4df-40be-b6cc-4c0a814f1f20-grafik.png

                            Muss noch irgendwo die ID von tibberlink rein?
                            41306522-f2bd-428f-88e4-27ccbcbc7257-grafik.png

                            jrbwh 1 Reply Last reply Reply Quote 0
                            • jrbwh
                              jrbwh @SMS last edited by

                              @sms Was steht im Log? Und wie kommen die Daten von tibberLink.0.Homes.... nach 0_userdata.0.flexcharts.tibberHourly? Denke, Du solltest im Skript direkt die tibberLink.0.Homes...-ID verwenden.

                              1 Reply Last reply Reply Quote 0
                              • L
                                legro last edited by legro

                                @sms

                                Aller Anfang ist schwer. Am Ende hilft jedoch nur, sich selbst in die Materie einzuarbeiten. Meine Leidens- und vor allem Erfolgsgeschichten kannst du hier in Teilen nachlesen. Dort findest du viele Ideen und Techniken, wie du dein Vorhaben weitestgehend selbst in die Tat umsetzen kannst.

                                Nicht erschrecken! Aber ohne sich durch derartige Gedanken hindurch zu kämpfen, wirst du mit FlexCharts nicht glücklich. Aber sei versichert: Es lohnt sich.

                                1 Reply Last reply Reply Quote 0
                                • U
                                  UlliJ @jrbwh last edited by

                                  @jrbwh sagte in Test Adapter flexcharts - Stapeldiagramme und mehr:

                                  Ich habe eine Version im Branch develop erstellt, kann im Moment aber nur eingeschränkt testen. Bei mir sieht's gut aus. Falls Du es ausprobieren möchtest:

                                  nach Neuinstallation sieht das so aus👍
                                  42f1695b-961c-4f93-bf7c-3ef3621c7a83-image.png

                                  jrbwh 1 Reply Last reply Reply Quote 1
                                  • jrbwh
                                    jrbwh @UlliJ last edited by

                                    @ullij Super. Danke fürs Testen!

                                    1 Reply Last reply Reply Quote 0
                                    • jrbwh
                                      jrbwh @SMS last edited by

                                      @sms Ich habe eine "Variante 2" des Skripts erstellt. Das benötigt keine zusätzlichen Datenpunkte und kann stündliche, tägliche, wöchentliche und monatliche Daten direkt verarbeiten. Man muss lediglich die IDs der tibberLink-Datenpunkte ("tibberLink.0.Homes...") im Skript bei "IDS" korrekt eintragen, dann sollte es funktioniert. Die Auswahl der Daten erfolgt dann im http-Aufruf.
                                      Wäre super, wenn Du das mal ausprobieren könntest. Ich kann es selber nicht gut testen, da ich keine tibberLink-Daten habe.

                                      SMS 1 Reply Last reply Reply Quote 0
                                      • jrbwh
                                        jrbwh @Merlin123 last edited by

                                        @merlin123 Ich habe ein Skript erstellt, um ein einfaches Chart für Verbrauch und Kosten zu generieren. Passt für Dich vermutlich nicht, aber es wäre klasse, wenn Du "Variante 2" mal ausprobieren könntest. Mein Problem ist, dass ich ohne Tibber-Daten nur sehr grob testen kann.

                                        Merlin123 1 Reply Last reply Reply Quote 0
                                        • SMS
                                          SMS @jrbwh last edited by

                                          @jrbwh Hi! Läuft seit heute morgen ca. 8Uhr! Scheint zu funktionieren. 🙂

                                          jrbwh 1 Reply Last reply Reply Quote 0
                                          • jrbwh
                                            jrbwh @SMS last edited by

                                            @sms Sehr schön! Du benutzt "Variante 2", richtig?

                                            SMS 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            822
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            chart charts diagramme echarts visualisierung visualization
                                            18
                                            231
                                            20971
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo