Einbindung Grillson

Hallo,

ich würde gerne die Temperaturen und Zustände meines Grillson in IPS visualisieren. Wenn man sich die Webseite des Grills im Debug Mode anschaut, sieht man, dass die etwas mit JSON machen.
Ich habe beim Hersteller nachgefragt, ob sie eine Doku herausgeben wie man auf die Werte zugreifen kann.
Leider habe ich da nichts bekommen.

Hat das jemand von euch schon gemacht, oder hat eine Idee wie ich das hinbekommen kann?

Viele Grüße

Markus

Wenn du an die Daten per JSON heran kommst, kannst du alles in IPS integrieren, was über JSON bereitgestellt wird.
Wie sieht denn so ein Debug aus?

Grüße,
Kai


/* --------------------------------------------------------------------
 *
 *        COMPANY:      SEVENSTAX GmbH
 *                      Günther-Wagner-Allee 19
 *                      30177 Hannover,
 *                      GERMANY
 *
 *        CONTACT:      [SEVENSTAX - Ihr Partner für das Internet of Things](http://www.sevenstax.de)
 *                      [EMAIL="info@sevenstax.de"]info@sevenstax.de[/EMAIL]
 *
 *                      ALL RIGHTS RESERVED
 *
 *************************************************************************/
/*jslint indent: 4, maxerr: 500, white: true, regexp: true, sloppy: true, eqeq: true */
/* activate stronger runtime checking for JSLint! */
//"use strict";

/* JSLint global symbol list: */
/* [JSLint: The JavaScript Code Quality Tool](http://jslint.com/) global symbol list */
/*global console, storage, window, document, $, jQuery, navigator, location, setTimeout, WEBVERSION, StartPage, STXJsonHandler_HostData, STXJsonHandler_LoginData, $, JSONRequest, AUTO_REQ_GET, AUTO_REQ_GET_ONCE,
AUTO_REQ_NONE, JSONHandler, window, PARA_ELEM, PARA_Home, PARA_ELEM_Html, PARA_ELEM_Class, PARA_ELEM_Form, PARA_JsonReq,AUTO_REQ_PAUSE,
PARA_ELEM_SWITCH,PARA_ELEM_SINT, PARA_ELEM_SLIDER, PARA_ELEM_UINT,
PARA_ELEM_Variable,stxGrill_SetGauge, AUTO_REQ_GET_AFTER_SET, get_meat_ramping_2, get_grillroomtemp_ist, get_grillroomtemp_soll_get,
get_grilltime, get_infodpump, get_meat_soll_1, get_meat_ist_2, get_infopfuell, get_meat_soll_2, get_meat_ramping_1, get_infopdruck,
stxGrill_StartTimer, stxTimerStopFunction, get_grillremote, stxSetTimerStart, get_meat_ist_1, get_infobtemp, stxGrill_CheckAktiv,
stxGrill_TimerStartTmp, stxTimer_Callback_Stop, stxTimer_Callback_Start, stxGrill_CheckValues, Option, TimerValueInit, CMD_GET, PARA_ELEM_STORAGE,
PARA_ELEM_TIMER, PARA_ELEM_BUTTON, PARA_ELEM_FLOAT, PARA_ELEM_STATUS, CMD_SET, PARA_ELEM_ALERT, HOST, JSONFILE, LOGIN, stxTimer_STOP, ERROR_VALUE_NA,
alertmsg, NA  */
/*--------------------------------------*/
/*---------------------------------------*/

var get_gr0;
var get_gr1;
var get_gr2;
var get_gr3;
var get_gr4;

var set_status;
var set_meat1;
var set_meat2;

var timer_start_value = 0;
var time_act = 0;

var pressuremin = 0.16;
var pressuremax = 1.5;

var allids_info = [];
var allids_icon = [];

/**********************************************************************
 * stxSetAllIDsNA
 */
/** \brief Set all ids to the NA value
 * \details -
 * \param -
 * \retval -
 ***********************************************************************/
function stxSetAllIDsNA() {
    var i;

    for (i = 0; i < allids_info.length; i = i + 1) {
        $('#' + allids_info[i]).html(NA);
    }

    for (i = 0; i < allids_icon.length; i = i + 1) {
        stxSetIconNotActive(allids_icon[i]);
        stxSetIDNotActive(allids_icon[i]);
    }

    $('.scale').css("width", 0);
    $('.indicator').css("width", 0);

    storage.setItem("Switch_Activ", "off");
}

/**********************************************************************
 * stxInfo_Init
 */
/** \brief Init function for the requests of the site
 * \details -
 * \param -
 * \retval -
 ***********************************************************************/
function stxInfo_Init() {
    var set_group_0 = [],
    set_group_1 = [],
    set_group_2 = [],
    get_group_1 = [],
    get_group_2 = [],
    get_group_4 = [],

    get_para_gr0,
    get_para_gr1,
    get_para_gr2,
    get_para_gr3,
    get_para_gr4,

    set_para_status,
    set_para_meat1,
    set_para_meat2;

    if (storage.getItem("p45") !== null) {
        pressuremin = parseFloat(storage.getItem("p45"));
    }
    if (storage.getItem("p46") !== null) {
        pressuremax = parseFloat(storage.getItem("p46"));
    }

    /*module, variable, index, data,  min,  max,  mul, float?,  cmd,            handlefct(     id, unit, extval1, extval2, extval3, */
    /*Zustand Grill*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z18", 0, 300, 1, false, CMD_GET, new PARA_ELEM_STORAGE("idgrillstatus", "", null, null, null, "idgrillstatus")));
    /*Grillraumtemp Ist*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z03", 50, 520, 10, false, CMD_GET, new PARA_ELEM_TEMPERATUR("idz03i", window.localizationManager.localize('general.unittemp'), null, null, null, "z03")));
    allids_info.push("idz03i");
    /*Grillraumtemp Soll Zustand*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z04", 75, 520, 10, false, CMD_GET, new PARA_ELEM_TEMPERATUR("idz04i", window.localizationManager.localize('general.unittemp'), null, null, null, "z04")));
    allids_info.push("idz04i");
    /*Grillzeit Soll*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "P60", null, null, null, false, CMD_GET, new PARA_ELEM_TIMER("idp60i", "", null, null, null, "p60")));
    allids_info.push("idp60i");
    /*Grillzeit IST*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "Z25", null, null, null, false, CMD_GET, new PARA_ELEM_TIMER("idz25i", "", null, null, null, "z25")));
    allids_info.push("idz25i");
    get_group_1.push(new PARA_ELEM("host", "data", null, "P63", 0, 1, 1, false, CMD_GET, new PARA_ELEM_BUTTON("idp63", "", null, null, null, "p63")));
    /*Fleisch 1 Soll*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "P53", 25, 100, 1, false, CMD_GET, new PARA_ELEM_TEMPERATUR("idp53i", window.localizationManager.localize('general.unittemp'), null, null, null, "p53")));
    allids_info.push("idp53i");
    /*Fleisch 1 Ist*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "Z22", 0, 300, 10, false, CMD_GET, new PARA_ELEM_TEMPERATUR("idz22i", window.localizationManager.localize('general.unittemp'), null, null, null, "z22")));
    allids_info.push("idz22i");
    /*Fleisch 2 Soll*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "P54", 25, 100, 1, false, CMD_GET, new PARA_ELEM_TEMPERATUR("idp54i", window.localizationManager.localize('general.unittemp'), null, null, null, "p54")));
    allids_info.push("idp54i");
    /*Fleisch 2 Ist*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "Z23", 0, 300, 10, false, CMD_GET, new PARA_ELEM_TEMPERATUR("idz23i", window.localizationManager.localize('general.unittemp'), null, null, null, "z23")));
    allids_info.push("idz23i");
    /*Palletfüllstand*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z24", 0, 1, 1, false, CMD_GET, new PARA_ELEM_ICON("idz24i", null, null, null, null, "z24")));
    allids_icon.push("idz24i");
    /*Pumpendruck*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z20", pressuremin, pressuremax, 1, true, CMD_GET, new PARA_ELEM_FLOAT("idz20i", " bar", null, null, null, "z20")));
    allids_info.push("idz20i");
    /*Drehzahl Pumpe*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z33", 0, 100, 1, false, CMD_GET, new PARA_ELEM_UINT("idz16i", " %", null, null, null, "z16")));
    allids_info.push("idz16i");
    /*Steuerung*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "P61", null, null, null, false, CMD_GET, new PARA_ELEM_ICON("idp61i", "", null, null, null, "p61")));
    allids_icon.push("idp61i");
    /*Alert*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z21", null, null, null, false, CMD_GET, new PARA_ELEM_STATUS("idz21i", "", null, null, null, "z21")));
    /*Druck Min*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "P45", null, null, 100, true, CMD_GET, new PARA_ELEM_STORAGE("idp45", " bar", null, null, null, "p45")));
    /*Druck Max*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "P46", null, null, 100, true, CMD_GET, new PARA_ELEM_STORAGE("idp46", " bar", null, null, null, "p46")));
    allids_info.push("idp46");
    /*CleanModus*/
    get_group_1.push(new PARA_ELEM("host", "data", null, "Z35", null, null, null, false, CMD_GET, new PARA_ELEM_ICON("idp48i", "", [0, window.localizationManager.localize('info.inaktiv')], [1, window.localizationManager.localize('info.aktiv')], [0, window.localizationManager.localize('info.inaktiv')], "p48")));
    allids_icon.push("idp48i");
    /*Status*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z30", null, null, null, false, CMD_GET, new PARA_ELEM_STATUS("idz30i", "", null, null, null, "z30")));
    /*Ramping*/
    get_group_2.push(new PARA_ELEM("host", "data", null, "Z34", 0, 2, 1, false, CMD_GET, new PARA_ELEM_ICON("idz34i", null, null, null, null, "z34")));
    allids_icon.push("idz34i");

    set_group_0.push(new PARA_ELEM("host", "data", null, "P49", null, null, 1, false, CMD_SET, new PARA_ELEM_ALERT("idp49", "", 1, null, null, "p49")));
    set_group_1.push(new PARA_ELEM("host", "data", null, "P53", 0, 100, 1, false, CMD_SET, new PARA_ELEM_STORAGE("idp53i", window.localizationManager.localize('general.unittemp'), null, null, null, "p53")));
    set_group_2.push(new PARA_ELEM("host", "data", null, "P54", 0, 100, 1, false, CMD_SET, new PARA_ELEM_STORAGE("idp54i", window.localizationManager.localize('general.unittemp'), null, null, null, "p54")));

    get_para_gr4 = new PARA_JsonReq(get_group_4);
    get_para_gr1 = new PARA_JsonReq(get_group_1);
    get_para_gr2 = new PARA_JsonReq(get_group_2);

    set_para_status = new PARA_JsonReq(set_group_0);
    set_para_meat1 = new PARA_JsonReq(set_group_1);
    set_para_meat2 = new PARA_JsonReq(set_group_2);

    get_gr4 = new JSONRequest(HOST, JSONFILE, LOGIN, 11, (AUTO_REQ_GET | AUTO_REQ_GET_ONCE), get_para_gr4);
    get_gr1 = new JSONRequest(HOST, JSONFILE, LOGIN, 5, (AUTO_REQ_GET | AUTO_REQ_GET_ONCE), get_para_gr1);
    get_gr2 = new JSONRequest(HOST, JSONFILE, LOGIN, 5, (AUTO_REQ_GET | AUTO_REQ_GET_ONCE), get_para_gr2);

    set_status = new JSONRequest(HOST, JSONFILE, LOGIN, 0, AUTO_REQ_GET_AFTER_SET, set_para_status);

    set_meat1 = new JSONRequest(HOST, JSONFILE, LOGIN, 0, AUTO_REQ_GET_AFTER_SET, set_para_meat1);

    set_meat2 = new JSONRequest(HOST, JSONFILE, LOGIN, 0, AUTO_REQ_GET_AFTER_SET, set_para_meat2);

}

/**********************************************************************
 * stxInfo_RegRequests
 */
/** \brief Init function for the home site
 * \details Register all parameter groups for the json handler
 * \param -
 * \retval -
 ***********************************************************************/
function stxInfo_RegRequests() {
    console.group('stxInfo_RegRequests()');
    //JSONHandler.register(get_gr4);
    JSONHandler.register(get_gr2);
    JSONHandler.register(get_gr1);

    JSONHandler.register(set_status);
    JSONHandler.register(set_meat1);
    JSONHandler.register(set_meat2);
    console.groupEnd();
}

function stxInfo_SetWidthBar(id_elem, soll, ist) {
    var res = (100 / soll) * ist;
    res = res + "%";
    $('#' + id_elem).css('width', res);
}

function stxInfo_StartTimer() {
    var hour,
    min,
    sec;
    time_act = parseInt(storage.getItem("Timer_Act_Value"), 10);
    if (isNaN(time_act) === true) {
        time_act = 0;
    }
    if ((isNaN(timer_start_value) === true)) {
        timer_start_value = time_act;
    }
    if ((storage.getItem("Timerrunning") === "true") && (storage.getItem("idgrillstatus") === "ein")) {
        if (time_act > 0) {
            time_act = time_act - 1;
            setTimeout(function () {
                stxInfo_StartTimer();
            }, 1000);
        } else if (time_act === 0) {
            time_act = 0;
            stxTimer_STOP();
        } else {}
        hour = parseInt(time_act / (3600), 10);
        min = parseInt((time_act - (hour * 3600)) / (60), 10);
        sec = parseInt((time_act - ((hour * 3600) + (min * 60))), 10);

        if (hour < 10) {
            hour = "0" + hour;
        }
        if (min < 10) {
            min = "0" + min;
        }
        if (sec < 10) {
            sec = "0" + sec;
        }
        $('#idz25i').html(hour + ":" + min + ":" + sec);

        hour = parseInt((timer_start_value - time_act) / (3600), 10);
        min = parseInt(((timer_start_value - time_act) - (hour * 3600)) / (60), 10);
        sec = parseInt(((timer_start_value - time_act) - ((hour * 3600) + (min * 60))), 10);

        if (hour < 10) {
            hour = "0" + hour;
        }
        if (min < 10) {
            min = "0" + min;
        }
        if (sec < 10) {
            sec = "0" + sec;
        }

        $('#idp60i').html(hour + ":" + min + ":" + sec);
        stxInfo_SetWidthBar("timebar", timer_start_value, (timer_start_value - time_act));

        storage.setItem("Timer_Act_Value", time_act);
    } else {}
}

function TimerValueInit() {
    console.log("TimerValueInit call");
    var hour,
    min,
    sec;

    timer_start_value = parseInt(storage.getItem("Timer_Start_Value"), 10);
    time_act = parseInt(storage.getItem("Timer_Act_Value"), 10);
    if ((timer_start_value !== null) && (time_act !== null)) {
        hour = parseInt((timer_start_value - time_act) / (3600), 10);
        min = parseInt(((timer_start_value - time_act) - (hour * 3600)) / (60), 10);
        sec = parseInt(((timer_start_value - time_act) - ((hour * 3600) + (min * 60))), 10);

        if ((hour > 0) || (min > 0) || (sec > 0)) {

            if (hour < 10) {
                hour = "0" + hour;
            }
            if (min < 10) {
                min = "0" + min;
            }
            if (sec < 10) {
                sec = "0" + sec;
            }

            $('#idp60i').html(hour + ":" + min + ":" + sec);
            stxInfo_SetWidthBar("timebar", timer_start_value, (timer_start_value - time_act));
        }
    }
}

function stxTimer_Callback_Start() {
    storage.setItem("Timerrunning", true);
    stxInfo_StartTimer();
}

function stxTimer_Callback_Stop() {
    storage.setItem("Timerrunning", false);
}

function stxTimer_STOP() {
    storage.setItem("Timerrunning", false);
}

function stxInfo_InitElements() {
    var j;
    timer_start_value = parseInt(storage.getItem("Timer_Start_Value"), 10);
    storage.setItem("Timerrunning_", false);

    if (pressuremax !== null) {
        $('#idz20i_max').html(pressuremax);
    } else {
        $('#idz20i_max').html(ERROR_VALUE_NA);
    }

    $('#idstatus_ok').click(function () {
        //$( '#dialog-status' ).dialog( "close" );
        storage.setItem("alertback", true);
        set_status.set();
    });

    $('#idstatus2_ok').click(function () {
        //$( '#dialog-status2' ).dialog( "close" );
        storage.setItem("alertback", true);
        set_status.set();
    });

    $('#idstatus2_new').click(function () {
        var text;
        text = $('#idstatus2').html();
        if (text.search("1/blau") != -1) {
            //$( '#dialog-status2' ).dialog( "close" );
            storage.setItem("alertback", true);
            set_status.set();
            set_meat1.set();
        } else if (text.search("2/rot") != -1) {
            //$( '#dialog-status2' ).dialog( "close" );
            storage.setItem("alertback", true);
            set_status.set();
            set_meat2.set();
        } else {}
        //

    });

    $('#idinfo').click(function () {

        if (($('#idz21i').html() !== alertmsg[0][4])) {
            for (j = 0; j < alertmsg.length; j = j + 1) {
                if (alertmsg[j][4] === $('#idz21i').html()) {
                    $("#idalert").html(alertmsg[j][1]);
                    console.warn('overlay().load()');
                    $("#dialog-alert").data("overlay").load();
                }
            }
        }
    });

    if (storage.getItem("z21") === window.localizationManager.localize('alertmsg.alert0.msg' ) ||
        storage.getItem("z21") === window.localizationManager.localize('alertmsg.alert1.code') ||
        storage.getItem("z21") === window.localizationManager.localize('alertmsg.alert2.code') ||
        storage.getItem("z21") === window.localizationManager.localize('alertmsg.alert9.code')) {
        //stxSetIDActive('idz21i');
        stxSetIDActive('idz21i_info');
        stxSetIconActive('idz21i_info');
        $('idz21i').html(storage.getItem("z21"));
    } else {
        //stxSetIDNotActive('idz21i');
        stxSetIDNotActive('idz21i_info');
        stxSetIconNotActive('idz21i_info');
        $('#idz21i').html(storage.getItem("z21"));
    }
}

function stxUpdateHeaderGrillName() {
    if (storage.getItem("ue0") === null) {
        $('#idgrillname').html(window.localizationManager.localize('general.title'));
    } else {
        $('#idgrillname').html(storage.getItem("ue0"));
    }

    if (storage.getItem("StartValues") === "false") {
        get_gr1.parameters.init();
        get_gr2.parameters.init();
    }
    storage.setItem("StartValues", false);
}

$(function () {});

function StartPage() {
    JSONHandler.deleteReg();
    stxInfo_Init();
    stxUpdateHeaderGrillName();
    stxInfo_RegRequests();
    stxInfo_InitElements();
    setTimeout(function () {
        JSONHandler.startAutoReq();
    }, 500);
}

function stxSetLogin_Startpage() {}

Das ist Javascript.
Was möchtest du mir damit sagen?

Grüße,
Kai

Hallo,

das ist das was ich sehe, wenn ich die Webseite mit „Quellcode Anzeigen“ ansehe.
Da steht ziemlich unten einiges mit JSONHandler.

Ich habe auch einen screenshot hochgeladen.
Da kann man die debug Ansicht sehen.
Unter „Lokales Speicher“ sein die Variablen in Tabellenform zu sehen.
Hast du eine Idee wie man darauf zugreifen kann?

Viele Grüße

Markus

Wenn es eine Webseite ist musst Du nicht auf Quellcode anzeigen gehen, da siehst Du ja lediglich wie die Seite aufgebaut ist. Was Du brauchst ist die Kommunikation. Dazu kannst Du z.B. bei Chrome oder auch Firefox die Entwicklungswerkzeuge nutzten. Bei Chrome zu finden unter Weitere Tools -> Entwicklertools (STRG + Umschalt + I). Dann siehst Du auch konkret wie Daten ausgetauscht werden bzw. Du kannst Dir auch das JSON ausgeben lassen.