Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Wunsch: getHistory für simple-api

    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

    Wunsch: getHistory für simple-api

    This topic has been deleted. Only users with topic management privileges can see it.
    • AlCalzone
      AlCalzone Developer last edited by

      Ich stehe gerade vor dem Problem, dass ich eine State-History remote auslesen will. Aktuell verwende ich für die Kommunikation den simple-api-Adapter, der diese Funktion leider nicht unterstützt. Socketio kann das jedoch. Wäre super, wenn die Funktion auch in simple-api nachgerüstet werden könnte.

      1 Reply Last reply Reply Quote 0
      • AlCalzone
        AlCalzone Developer last edited by

        Eine rudimentäre Erweiterung könnte in etwa so aussehen:

        case 'getHistory':
            if (!oId.length || !oId[0]) {
                doResponse(res, responseType, status, headers, { error: 'no datapoints given' }, values.prettyPrint);
                break;
            }
            var message = { id: oId[0], options: {} };
            var properties = ["start", "end", "count"];
            for (var i = 0; i < properties.length; i++) {
                if (values[properties[i]] !== null) message.options[properties[i]] = values[properties[i]];
            }
        
            that.adapter.sendTo('history.0', 'getHistory', message, function (result) {
                if (result.error) {
                	doResponse(res, responseType, 500, headers, 'error: ' + result.error, values.prettyPrint);
                }
                else {
                	response = result.result;
                	status = 200;
                	doResponse(res, responseType, status, headers, response, values.prettyPrint);
                }
            })
            break;
        
        

        Aber da fehlt natürlich noch einiges an Fehler-Abfragen und Features des History-Adapters.

        1 Reply Last reply Reply Quote 0
        • apollon77
          apollon77 last edited by

          Und man sollte die History-Instanz konfigurierbar haben weil es neben "history" ja auch "sql" und "influxdb" gibt. Die können alle GetHistory

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

          Support us

          ioBroker
          Community Adapters
          Donate
          FAQ Cloud / IOT
          HowTo: Node.js-Update
          HowTo: Backup/Restore
          Downloads
          BLOG

          775
          Online

          31.9k
          Users

          80.3k
          Topics

          1.3m
          Posts

          2
          3
          971
          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