Save
Saving
  • H Holzatelier

    Thank you for all the help with this!

    It works now:forecast_chart.png

    Turns out there was no need to escape the data. It's this that fixed it:

    json-string='""+ptVals+""'
    

    So here is my markup in case anybody else is interested:

    <div class="ma-designer-root" style="width: 100%; height: 100%; position: relative;" id="792c5eac-7dc7-4de0-8e0e-a4df6d1d98d5">
        
        <ma-get-point-value point-xid="DP_be6e20a6-a71d-493a-a8b8-623a6d259b77" point="minTemp"></ma-get-point-value>
        <ma-get-point-value point-xid="DP_bb9a46b6-440b-4908-a8fb-1412d1f160d9" point="meanTemp"></ma-get-point-value>
        <ma-get-point-value point-xid="DP_e786c22d-1c02-44f6-bab0-7b669cdab3c0" point="maxTemp"></ma-get-point-value>
        <ma-get-point-value point-xid="DP_238a534c-fe33-4ed8-b9b3-35b1b2e1be6d" point="minPrecip"></ma-get-point-value>
        <ma-get-point-value point-xid="DP_5eadd0ab-68d8-43b6-8398-c8d95c30cbb2" point="meanPrecip"></ma-get-point-value>
        <ma-get-point-value point-xid="DP_7a00c8d4-760d-4d2d-9770-dd447f9c3bf8" point="maxPrecip"></ma-get-point-value>
    
        <get-json-object json-string='""+minTemp.renderedValue+""' output="minTempValues"></get-json-object>
        <get-json-object json-string='""+meanTemp.renderedValue+""' output="meanTempValues"></get-json-object>
        <get-json-object json-string='""+maxTemp.renderedValue+""' output="maxTempValues"></get-json-object>
        <get-json-object json-string='""+minPrecip.renderedValue+""' output="minPrecipValues"></get-json-object>
        <get-json-object json-string='""+meanPrecip.renderedValue+""' output="meanPrecipValues"></get-json-object>
        <get-json-object json-string='""+maxPrecip.renderedValue+""' output="maxPrecipValues"></get-json-object>
    
        <ma-serial-chart 
            default-type="smoothedLine" 
            style="height: 100%; width: 100%" 
            series-1-color="rgba(255, 128, 0, 0.3)" series-1-axis="left" series-1-values="minTempValues" 
            series-2-color="rgba(255, 128, 0, 1)"   series-2-axis="left" series-2-values="meanTempValues" 
            series-3-color="rgba(255, 128, 0, 0.3)" series-3-axis="left" series-3-values="maxTempValues" 
            series-4-type="column" series-4-color="rgba(1, 15, 18, 1)"     series-4-axis="right" series-4-values="minPrecipValues"  
            series-5-type="column" series-5-color="rgba(0, 255, 255, 0.3)" series-5-axis="right" series-5-values="meanPrecipValues"  
            series-6-type="column" series-6-color="rgba(0, 92, 92, 0.2)"   series-6-axis="right" series-6-values="maxPrecipValues" 
            options="{
                        valueAxes:[
                            {
                                axisColor:'rgba(255, 128, 0, 1)', 
                                title: 'Temperatur [°C]', 
                                fontSize:16,
                                titleFontSize:18,
                            }, 
                            {
                                axisColor:'rgba(0, 255, 255, 0.3)', 
                                title: 'Niederschlag [mm]', 
                                fontSize:16,
                                titleFontSize:18, 
                            }
                        ]
        }" ></ma-serial-chart>
        
    </div>
    

    posted in Scripting general Discussion read more
  • H Holzatelier

    Thank you for the module!

    I got it working as far as you had it running in your last post. However I'm struggling to get the point data hooked into the module call in the markup. This is what I have now:

    <ma-point-values point-xid="DP_be6e20a6-a71d-493a-a8b8-623a6d259b77"  point="minTemp" values="minTempVals"></ma-point-values>
    <get-json-object json-string="minTempVals" output="ptValues"></get-json-object>
    <p>{{ptValues}}</p>
    <ma-serial-chart  default-type="smoothedLine" style="height: 300px; width: 100%" serias-1-point="" series-1-values="ptValues"></ma-serial-chart>
    

    This doesn't show the chart and the module spits out a warning:

    Input not string
    

    If I use the curly brackets to call the values like this:

    <get-json-object json-string={{minTempVals}} output="ptValues"></get-json-object>
    

    I get an error:

    Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{minTempVals}}] starting at [{minTempVals}}].
    

    So how do I pass the point value as a string? I presume that by not using this in the serial-chart markup:

    from="dateBar.from" to="dateBar.to"
    

    we just grab the latest data entry of the data point?

    Somehow I think I maybe need to concatenate the point value to double quotes?

    " + {{minTemp.value}} + "

    posted in Scripting general Discussion read more
  • H Holzatelier

    Fox, thanks for your support.

    I tried the suggested code:
    With {{}} I get an error:

    Error: [$parse:syntax] Syntax Error: Token '{' invalid key at column 2 of the expression [{{JSON.parse(minTempVals)}}] starting at [{JSON.parse(minTempVals)}}].
    

    Without {{}} I get no error but still no chart.

    As for the userModule, I found the HowTo and now have the userComponent available in the dashboard designer:

    Hello World.png

    posted in Scripting general Discussion read more
  • H Holzatelier

    Wow, thanks Matt. I really appreciate it!

    After a bit of fiddling I have the script writing the JSON arrays to the Data Points.
    And yes I'll definitely need some help to get this to show in a chart:

    [{"value":0.3,"timestamp":1611615600000},{"value":0.3,"timestamp":1611619200000},{"value":0.2,"timestamp":1611622800000},{"value":0.3,"timestamp":1611626400000},{"value":0.3,"timestamp":1611630000000},{"value":-0.1,"timestamp":1611633600000},{"value":-0.2,"timestamp":1611637200000},{"value":-0.6,"timestamp":1611640800000},{"value":-0.8,"timestamp":1611644400000},{"value":-0.6,"timestamp":1611648000000},{"value":-0.2,"timestamp":1611651600000},{"value":0.7,"timestamp":1611655200000},{"value":1.5,"timestamp":1611658800000},{"value":1.7,"timestamp":1611662400000},{"value":1.9,"timestamp":1611666000000},{"value":2,"timestamp":1611669600000},{"value":1.8,"timestamp":1611673200000},{"value":1.8,"timestamp":1611676800000},{"value":1.5,"timestamp":1611680400000},{"value":1.1,"timestamp":1611684000000},{"value":0.4,"timestamp":1611687600000},{"value":-0.2,"timestamp":1611691200000},{"value":-0.9,"timestamp":1611694800000},{"value":-1.4,"timestamp":1611698400000},{"value":-1.8,"timestamp":1611702000000},{"value":-2,"timestamp":1611705600000},{"value":-2,"timestamp":1611709200000},{"value":-1.9,"timestamp":1611712800000},{"value":-1.9,"timestamp":1611716400000},{"value":-1.9,"timestamp":1611720000000},{"value":-2,"timestamp":1611723600000},{"value":-2,"timestamp":1611727200000},{"value":-2,"timestamp":1611730800000},{"value":-1.9,"timestamp":1611734400000},{"value":-1.6,"timestamp":1611738000000},{"value":-1.1,"timestamp":1611741600000},{"value":-0.6,"timestamp":1611745200000},{"value":0.1,"timestamp":1611748800000},{"value":0.7,"timestamp":1611752400000},{"value":1.3,"timestamp":1611756000000},{"value":1.8,"timestamp":1611759600000},{"value":2.2,"timestamp":1611763200000},{"value":2.5,"timestamp":1611766800000},{"value":2.7,"timestamp":1611770400000},{"value":2.9,"timestamp":1611774000000},{"value":3,"timestamp":1611777600000},{"value":3,"timestamp":1611781200000},{"value":3,"timestamp":1611784800000},{"value":2.8,"timestamp":1611788400000},{"value":2.6,"timestamp":1611792000000},{"value":2.2,"timestamp":1611795600000},{"value":2.1,"timestamp":1611799200000},{"value":2,"timestamp":1611802800000},{"value":2.1,"timestamp":1611806400000},{"value":2.3,"timestamp":1611810000000},{"value":2.5,"timestamp":1611813600000},{"value":2.9,"timestamp":1611817200000},{"value":3.3,"timestamp":1611820800000},{"value":3.7,"timestamp":1611824400000},{"value":4.1,"timestamp":1611828000000},{"value":4.4,"timestamp":1611831600000},{"value":4.6,"timestamp":1611835200000},{"value":4.7,"timestamp":1611838800000},{"value":4.8,"timestamp":1611842400000},{"value":4.8,"timestamp":1611846000000},{"value":4.8,"timestamp":1611849600000},{"value":4.8,"timestamp":1611853200000},{"value":4.8,"timestamp":1611856800000},{"value":4.9,"timestamp":1611860400000},{"value":5,"timestamp":1611864000000},{"value":5.2,"timestamp":1611867600000},{"value":5.6,"timestamp":1611871200000},{"value":6.2,"timestamp":1611874800000},{"value":7,"timestamp":1611878400000},{"value":8.2,"timestamp":1611882000000},{"value":9.1,"timestamp":1611885600000},{"value":9.7,"timestamp":1611889200000},{"value":10,"timestamp":1611892800000},{"value":10,"timestamp":1611896400000},{"value":9.7,"timestamp":1611900000000},{"value":9.2,"timestamp":1611903600000},{"value":8.6,"timestamp":1611907200000},{"value":7.9,"timestamp":1611910800000},{"value":7.1,"timestamp":1611914400000},{"value":6.3,"timestamp":1611918000000},{"value":5.7,"timestamp":1611921600000},{"value":5.3,"timestamp":1611925200000},{"value":5,"timestamp":1611928800000},{"value":5,"timestamp":1611932400000},{"value":5.1,"timestamp":1611936000000},{"value":5.3,"timestamp":1611939600000},{"value":5.5,"timestamp":1611943200000},{"value":5.6,"timestamp":1611946800000},{"value":5.8,"timestamp":1611950400000},{"value":5.9,"timestamp":1611954000000},{"value":6.2,"timestamp":1611957600000},{"value":6.5,"timestamp":1611961200000},{"value":6.9,"timestamp":1611964800000},{"value":7.3,"timestamp":1611968400000},{"value":7.7,"timestamp":1611972000000},{"value":7.9,"timestamp":1611975600000},{"value":8,"timestamp":1611979200000},{"value":8,"timestamp":1611982800000},{"value":8,"timestamp":1611986400000},{"value":7.9,"timestamp":1611990000000},{"value":7.7,"timestamp":1611993600000},{"value":7.6,"timestamp":1611997200000},{"value":7.4,"timestamp":1612000800000},{"value":7.3,"timestamp":1612004400000},{"value":7.1,"timestamp":1612008000000},{"value":6.9,"timestamp":1612011600000},{"value":6.7,"timestamp":1612015200000},{"value":6.5,"timestamp":1612018800000},{"value":6.3,"timestamp":1612022400000},{"value":6.1,"timestamp":1612026000000},{"value":5.8,"timestamp":1612029600000},{"value":5.5,"timestamp":1612033200000},{"value":5.1,"timestamp":1612036800000},{"value":4.7,"timestamp":1612040400000},{"value":4.3,"timestamp":1612044000000},{"value":3.7,"timestamp":1612047600000},{"value":3,"timestamp":1612051200000},{"value":2,"timestamp":1612054800000},{"value":1.4,"timestamp":1612058400000},{"value":1,"timestamp":1612062000000},{"value":0.7,"timestamp":1612065600000},{"value":0.5,"timestamp":1612069200000},{"value":0.3,"timestamp":1612072800000},{"value":0.3,"timestamp":1612076400000},{"value":0.3,"timestamp":1612080000000},{"value":0.3,"timestamp":1612083600000},{"value":0.4,"timestamp":1612087200000},{"value":0.5,"timestamp":1612090800000},{"value":0.5,"timestamp":1612094400000},{"value":0.5,"timestamp":1612098000000},{"value":0.5,"timestamp":1612101600000},{"value":0.4,"timestamp":1612105200000},{"value":0.3,"timestamp":1612108800000},{"value":0.2,"timestamp":1612112400000},{"value":0.1,"timestamp":1612116000000},{"value":0,"timestamp":1612119600000},{"value":0,"timestamp":1612123200000},{"value":-0.1,"timestamp":1612126800000},{"value":-0.3,"timestamp":1612130400000},{"value":-0.5,"timestamp":1612134000000},{"value":-1,"timestamp":1612137600000},{"value":-1.9,"timestamp":1612141200000},{"value":-2.5,"timestamp":1612144800000},{"value":-2.9,"timestamp":1612148400000},{"value":-3,"timestamp":1612152000000},{"value":-2.8,"timestamp":1612155600000},{"value":-2.4,"timestamp":1612159200000},{"value":-1.9,"timestamp":1612162800000},{"value":-1.3,"timestamp":1612166400000},{"value":-0.6,"timestamp":1612170000000},{"value":0,"timestamp":1612173600000},{"value":0.4,"timestamp":1612177200000},{"value":0.8,"timestamp":1612180800000},{"value":1,"timestamp":1612184400000},{"value":1,"timestamp":1612188000000},{"value":0.9,"timestamp":1612191600000},{"value":0.7,"timestamp":1612195200000},{"value":0.5,"timestamp":1612198800000},{"value":0.2,"timestamp":1612202400000},{"value":0,"timestamp":1612206000000},{"value":-0.2,"timestamp":1612209600000},{"value":-0.5,"timestamp":1612213200000},{"value":-0.8,"timestamp":1612216800000}] @ 26 Jan 2021 15:52
    

    posted in Scripting general Discussion read more
  • H Holzatelier

    Thanks Matt,
    I think the solution using the alphanumeric point with the JSON is the ideal way for me as I just want to chart the hourly forecast.
    Being only a light user of mango I'm a bit green on how to go about it though.

    If I understand correctly I would change my scripting source to write the JSON from the website to six data points (TempMin, TempMean, TempMax, PrecipMin, PrecipMean, PrecipMax) of a virtual data source (change type: NO_CHANGE)?

    I presume the array would look like this for each of the six data points?
    [ {value:12.6,timestamp:165798243000 },{value:12.6,timestamp:16801843000 }, ... ]

    Thanks again for your help.

    posted in Scripting general Discussion read more
  • H Holzatelier

    Here is my Datasource:

    {
      "dataSources":[
        {
          "xid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "name":"Meteo_forecast",
          "enabled":true,
          "type":"SCRIPTING",
          "alarmLevels":{
            "SCRIPT_ERROR":"URGENT",
            "CONTEXT_POINT_DISABLED":"IGNORE",
            "DATA_TYPE_ERROR":"URGENT",
            "POLL_ABORTED":"URGENT",
            "LOG_ERROR":"URGENT"
          },
          "purgeType":"YEARS",
          "updatePeriods":6,
          "updatePeriodType":"HOURS",
          "updateEvent":"UPDATE",
          "context":[
          ],
          "logLevel":"NONE",
          "scriptPermissions":[
            "superadmin"
          ],
          "polling":true,
          "executionDelaySeconds":0,
          "historicalSetting":true,
          "logCount":5,
          "logSize":1.0,
          "script":"var headers = {}; \nvar parameters = {};\nvar station = \"634000\";\nvar requestUrl = \"https:\/\/app-prod-ws.meteoswiss-app.ch\/v1\/forecast?plz=\" + station;\n\nHttpBuilder.get(requestUrl, headers, parameters)\n    .err(function(status, headers, content) {\n        throw content;\n    }).resp(function(status, headers, content) {\n        var response = JSON.parse(content);\n        var periods = response.graph.temperatureMin1h;\n        for(var k = 0; k < periods.length; k+=1) {\n            var period = periods[k];\n            TempMin.set(periods[k], response.graph.start+(k*3600000));\n        }\n        var periods = response.graph.temperatureMax1h;\n        for(var k = 0; k < periods.length; k+=1) {\n            var period = periods[k];\n            TempMax.set(periods[k], response.graph.start+(k*3600000));\n        }\n        var periods = response.graph.temperatureMean1h;\n        for(var k = 0; k < periods.length; k+=1) {\n            var period = periods[k];\n            TempMean.set(periods[k], response.graph.start+(k*3600000));\n        }\n        var periods = response.graph.precipitationMin1h;\n        for(var k = 0; k < periods.length; k+=1) {\n            var period = periods[k];\n            PrecipMin.set(periods[k], response.graph.start+(k*3600000));\n        }\n        var periods = response.graph.precipitationMax1h;\n        for(var k = 0; k < periods.length; k+=1) {\n            var period = periods[k];\n            PrecipMax.set(periods[k], response.graph.start+(k*3600000));\n        }\n        var periods = response.graph.precipitationMean1h;\n        for(var k = 0; k < periods.length; k+=1) {\n            var period = periods[k];\n            PrecipMean.set(periods[k], response.graph.start+(k*3600000));\n        }\n    }).execute();\n",
          "quantize":true,
          "useCron":false,
          "editPermission":"superadmin",
          "purgeOverride":false,
          "purgePeriod":1
        }
      ],
      "dataPoints":[
        {
          "xid":"DP_be6e20a6-a71d-493a-a8b8-623a6d259b77",
          "name":"TemperaturMin",
          "enabled":true,
          "loggingType":"ON_CHANGE",
          "intervalLoggingPeriodType":"HOURS",
          "intervalLoggingType":"AVERAGE",
          "purgeType":"DAYS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "contextUpdate":false,
            "settable":true,
            "varName":"TempMin"
          },
          "eventDetectors":[
          ],
          "plotType":"SPLINE",
          "rollup":"NONE",
          "unit":"",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "defaultCacheSize":1,
          "deviceName":"Meteo_forecast",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":true,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":false,
            "suffix":"",
            "format":"0.00"
          },
          "tolerance":0.0
        },
        {
          "xid":"DP_e786c22d-1c02-44f6-bab0-7b669cdab3c0",
          "name":"TemperaturMax",
          "enabled":true,
          "loggingType":"ON_CHANGE",
          "intervalLoggingPeriodType":"HOURS",
          "intervalLoggingType":"INSTANT",
          "purgeType":"DAYS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "contextUpdate":false,
            "settable":true,
            "varName":"TempMax"
          },
          "eventDetectors":[
          ],
          "plotType":"SPLINE",
          "rollup":"NONE",
          "unit":"",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "defaultCacheSize":1,
          "deviceName":"Meteo_forecast",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":true,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":false,
            "suffix":"",
            "format":"0.00"
          },
          "tolerance":0.0
        },
        {
          "xid":"DP_bb9a46b6-440b-4908-a8fb-1412d1f160d9",
          "name":"TemperaturMean",
          "enabled":true,
          "loggingType":"ON_CHANGE",
          "intervalLoggingPeriodType":"HOURS",
          "intervalLoggingType":"INSTANT",
          "purgeType":"DAYS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "contextUpdate":false,
            "settable":true,
            "varName":"TempMean"
          },
          "eventDetectors":[
          ],
          "plotType":"SPLINE",
          "rollup":"NONE",
          "unit":"",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "defaultCacheSize":1,
          "deviceName":"Meteo_forecast",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":true,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":false,
            "suffix":"",
            "format":"0.00"
          },
          "tolerance":0.0
        },
        {
          "xid":"DP_238a534c-fe33-4ed8-b9b3-35b1b2e1be6d",
          "name":"PrecipitationMin",
          "enabled":true,
          "loggingType":"ON_CHANGE",
          "intervalLoggingPeriodType":"HOURS",
          "intervalLoggingType":"INSTANT",
          "purgeType":"DAYS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "contextUpdate":false,
            "settable":true,
            "varName":"PrecipMin"
          },
          "eventDetectors":[
          ],
          "plotType":"SPLINE",
          "rollup":"NONE",
          "unit":"",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "defaultCacheSize":1,
          "deviceName":"Meteo_forecast",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":true,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":false,
            "suffix":"",
            "format":"0.00"
          },
          "tolerance":0.0
        },
        {
          "xid":"DP_7a00c8d4-760d-4d2d-9770-dd447f9c3bf8",
          "name":"PrecipitationMax",
          "enabled":true,
          "loggingType":"ON_CHANGE",
          "intervalLoggingPeriodType":"HOURS",
          "intervalLoggingType":"INSTANT",
          "purgeType":"DAYS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "contextUpdate":false,
            "settable":true,
            "varName":"PrecipMax"
          },
          "eventDetectors":[
          ],
          "plotType":"SPLINE",
          "rollup":"NONE",
          "unit":"",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "defaultCacheSize":1,
          "deviceName":"Meteo_forecast",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":true,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":false,
            "suffix":"",
            "format":"0.00"
          },
          "tolerance":0.0
        },
        {
          "xid":"DP_5eadd0ab-68d8-43b6-8398-c8d95c30cbb2",
          "name":"PrecipitationMean",
          "enabled":true,
          "loggingType":"ON_CHANGE",
          "intervalLoggingPeriodType":"HOURS",
          "intervalLoggingType":"INSTANT",
          "purgeType":"DAYS",
          "pointLocator":{
            "dataType":"NUMERIC",
            "contextUpdate":false,
            "settable":true,
            "varName":"PrecipMean"
          },
          "eventDetectors":[
          ],
          "plotType":"SPLINE",
          "rollup":"NONE",
          "unit":"",
          "simplifyType":"NONE",
          "chartColour":"",
          "chartRenderer":{
            "type":"IMAGE",
            "timePeriodType":"DAYS",
            "numberOfPeriods":1
          },
          "dataSourceXid":"DS_6febb1ee-7e34-4a38-98ee-717e36613917",
          "defaultCacheSize":1,
          "deviceName":"Meteo_forecast",
          "discardExtremeValues":false,
          "discardHighLimit":1.7976931348623157E308,
          "discardLowLimit":-1.7976931348623157E308,
          "intervalLoggingPeriod":1,
          "intervalLoggingSampleWindowSize":0,
          "overrideIntervalLoggingSamples":false,
          "preventSetExtremeValues":false,
          "purgeOverride":true,
          "purgePeriod":1,
          "readPermission":"",
          "setExtremeHighLimit":1.7976931348623157E308,
          "setExtremeLowLimit":-1.7976931348623157E308,
          "setPermission":"",
          "tags":{
          },
          "textRenderer":{
            "type":"ANALOG",
            "useUnitAsSuffix":false,
            "suffix":"",
            "format":"0.00"
          },
          "tolerance":0.0
        }
      ]
    }
    

    posted in Scripting general Discussion read more
  • H Holzatelier

    I have a scripting data source that imports weather forecast data. It works fine but every time it runs (ideally once every hour) it writes a duplicate set of data to the datapoints. It seems that I would need to purge all data from the respective data point before the script writes the updated forecast data to it.
    Is there a way to purge all data from a datapoint from inside a script?

    var headers = {}; 
    var parameters = {};
    var station = "634000";
    var requestUrl = "https://app-prod-ws.meteoswiss-app.ch/v1/forecast?plz=" + station;
    
    HttpBuilder.get(requestUrl, headers, parameters)
        .err(function(status, headers, content) {
            throw content;
        }).resp(function(status, headers, content) {
            var response = JSON.parse(content);
            var periods = response.graph.temperatureMin1h;
            for(var k = 0; k < periods.length; k+=1) {
                var period = periods[k];
                TempMin.set(periods[k], response.graph.start+(k*3600000));
            }
            var periods = response.graph.temperatureMax1h;
            for(var k = 0; k < periods.length; k+=1) {
                var period = periods[k];
                TempMax.set(periods[k], response.graph.start+(k*3600000));
            }
            var periods = response.graph.temperatureMean1h;
            for(var k = 0; k < periods.length; k+=1) {
                var period = periods[k];
                TempMean.set(periods[k], response.graph.start+(k*3600000));
            }
            var periods = response.graph.precipitationMin1h;
            for(var k = 0; k < periods.length; k+=1) {
                var period = periods[k];
                PrecipMin.set(periods[k], response.graph.start+(k*3600000));
            }
            var periods = response.graph.precipitationMax1h;
            for(var k = 0; k < periods.length; k+=1) {
                var period = periods[k];
                PrecipMax.set(periods[k], response.graph.start+(k*3600000));
            }
            var periods = response.graph.precipitationMean1h;
            for(var k = 0; k < periods.length; k+=1) {
                var period = periods[k];
                PrecipMean.set(periods[k], response.graph.start+(k*3600000));
            }
        }).execute();

    posted in Scripting general Discussion read more
  • H Holzatelier

    Thanks, that solved it.

    posted in User help read more
  • H Holzatelier

    Hi,

    I just installed v3.7.7 and I am trying to get a serial data source set up. My problem seems to be that Mango does not send a <CR> to terminate the command. From searching the forum I found that Mango seems to translate \n as a terminator <CR>. So I have set the terminator in the DataSource as \n but Mango just appends the characters '\' 'n' to the command string.

    How do I get it to terminate with <CR>?

    Thanks

    This is what gets sent by mango:
    command_send.png

    But I need to terminate the command with:
    serial_<CR>.png

    My set up:

    Datasource_setup.png
    Point_setup.png

    posted in User help read more
  • H Holzatelier

    Hi

    Moved this to a new topic.

    Browser: Firefox Quantum 61.0.2 (64bit) :
    I can't delete dashboards in the dashboard designer. When I click on the trash can symbol nothing happens.

    I get an error message in the browser console: (I'm sorry can't upload pictures, forum says I don't have enough privileges.)

    <unavailable> mangoUi~ngMango~ngMangoServices.js:230:77026
    a/<
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:230:77026
    c
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:72:147720
    a/<
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:72:148680
    $apply
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:230:100815
    compile/</<
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:230:147472
    dispatch
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:39:37882
    add/g.handle
    http://192.168.1.125:8080/modules/mangoUI/web/mangoUi~ngMango~ngMangoServices.js:39:35947
    XML Parsing Error: no root element found
    Location: http://192.168.1.125:8080/rest/v2/server/client-error
    Line Number 1, Column 1: client-error:1:1

    I tried in Chrome and there it works just fine.

    posted in User help read more