Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Cloud Dienste
  4. Neuer Alexa-Skill "iobroker.assistant"

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    770

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    18
    1
    6.2k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.5k

Neuer Alexa-Skill "iobroker.assistant"

Scheduled Pinned Locked Moved Cloud Dienste
666 Posts 146 Posters 85.8k Views 133 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hfrei85
    wrote on last edited by
    #641

    ich wollte es noch mal wissen und habe dann doch noch mal auf die neue 5.0.11 gezogen. Hat mit der Version 10-15 min gedauert, dann waren die Werten wieder nicht abzufragen. In der Alexa app wieder weg und "ich weiß nicht, was schiefgelaufen ist" als Antwort.
    Also wieder zurück auf die 5.0.7.

    Neustart braucht man wohl nicht, ich habe aber nach neue Geräte suchen lassen. Kommt zwar "Ich habe keine neuen Geräte gefunden" aber die Temperaturen waren dann wieder da.

    Steve

    1 Reply Last reply
    0
    • 1Topf1 Offline
      1Topf1 Offline
      1Topf
      wrote on last edited by
      #642

      Nach Update auf .11 kam bei mir bei Temperaturabfragen auch "Ich weiß nicht was schief gelaufen ist ... ". Zurück auf .7 ist alles wieder gut. Stand Jetzt.

      1 Reply Last reply
      0
      • BBTownB Offline
        BBTownB Offline
        BBTown
        wrote on last edited by
        #643

        auch in v.5.0.12 ist dieser Fehler weiter enthalten.
        nach wie vor ist due v5.0.7 die ketzte Version die due Temperarturabfrage korrekt beantwortet

        ioBroker auf NUC (VM debian v13 (Trixie ), node v22.22.2 npm v10.9.4, js-controller v7.1.1 jsonl/jsonl / HomeMatic CCU-2 (Wired und Funk) / Philips HUE / echo.DOT / Broadlink RM pro / SONOS

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Semenchkare
          wrote on last edited by
          #644

          So sehe ich das auch. Ich hatte mal den Thermometer entfernt, ich bekam den nicht mehr zur Alexa rüber auch nicht mit der 5.0.12. Erst mit 5.0.7 habe ich wieder einen "guten" Zustand.

          Viele Grüße

          Semenchkare

          raspberry 5 8GB mit iobroker,
          raspberry 5 8GB mit Raspberrymatic

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bastelfinger
            wrote on last edited by
            #645

            Grundsätzlich funktioniert der Adapter bei mir.
            Ich bekomme es allerdings nicht hin, einen Datenpunkt von meinem Auto, den ich im IOT Adapter eingetragen habe, in der Alexa zu finden.
            Was mache ich falsch?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              samsungfreak
              wrote on last edited by samsungfreak
              #646

              Hallo,

              durch die Anleitung hat die Umstellung grundsätzlich gut funktioniert. Ich habe aber drei Probleme:

              1. Ich habe eine Szene die ich steuern möchte (true / false) und habe auch den Typ auf "Szene" gestellt. Leider passiert nichts wenn man die Szene via Alexa triggert. Wenn ich den Typ umstelle auf Steckdose kann bekommt man nur False geschaltet". Woran kann das liegen?

              2. Manchmal kommt egal bei welchem Gerät"der damit verknüpfte Skill ist nicht verbunden". Im IOT Adapter unter "Alexa-Geräte" habe ich die Geräte nicht gelöscht aber in der Alexa App. Woran kann das liegen?

              3. In der Alexa App unter Einstellungen-> Geräteeinstellungen tauchen nur die Geräte welche über V3 verbunden sind auf, gleiches gilt über den Weg Alexa App->Geräte. Bearbeite ich aber eine Gruppe oder will eine neue Gruppe erstellen tauchen die Geräte doppelt auf (also V1 und V3). Woran kann das liegen?

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bavarian
                wrote on last edited by
                #647

                Das mit dem IOT Adapter hat alles gut funktioniert und läuft mit 5.0.7 stabil.
                Ich hatte aber ein paar Sprachausgaben wie zB Anrufer Namen die ich an die Alexa schicken konnte.
                Sprich Telefon klingelt, Alexa sagt" Anruf von XYZ".
                Wie setze ich das nun um?

                A 1 Reply Last reply
                0
                • B Bavarian

                  Das mit dem IOT Adapter hat alles gut funktioniert und läuft mit 5.0.7 stabil.
                  Ich hatte aber ein paar Sprachausgaben wie zB Anrufer Namen die ich an die Alexa schicken konnte.
                  Sprich Telefon klingelt, Alexa sagt" Anruf von XYZ".
                  Wie setze ich das nun um?

                  A Online
                  A Online
                  Ahnungsbefreit
                  wrote on last edited by
                  #648

                  @Bavarian Das geht über den Alexa2 Adapter und hat nichts mit dem iot zu tun.

                  Wenn meine Antwort hilfreich war, dürft Ihr das gerne durch einen "Upvote" (der kleine "^" unten rechts) zum Ausdruck bringen.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    Tortuga
                    wrote on last edited by
                    #649

                    Hallo,
                    ich habe das Problem, daß ich den ioBoker.assistant-Skill nicht aktivieren kann, bzw, nicht mit dem iobroker.pro-Konto verknüpfen kann, da es zu einer Fehlermeldung "Konten konnten nicht verknüpft werden"
                    Ich bin echt ratlos, es war ein weiter Weg bis hier.

                    -Da einige Pakete nicht mehr zur Verfügung standen habe ich den ganzen Pi auf Debian 13 neu aufgebaut.
                    -Backupdaten gelesen und alle Adapter aktualisiert.
                    -iobroker.pro abo ist aktuell und Zugangsdaten i.O. (sogar nochmal neues PW angelegt)
                    -alten Skill deaktiviert, neuer Skill auf Handy wegen alten Android nicht möglich(Alexa-App gelöscht), also über Tablet versucht anzumelden.
                    -Instanz iot ist verbunden, alte Alexa V1 deaktiviert , unter Alexa-Geräte V3 sind alle alten Geräte vorhanden
                    -mehrfach den Botton"IOT-Anmeldeinformationen neu erstellen" gedrückt und Instanzen neu gestartet, ohne Erfolg
                    Screenshot_20260111-164140[1].png
                    Wo steckt hier das Problem ???

                    Vielen Dank im Vorraus

                    Grüße

                    Andreas

                    D 1 Reply Last reply
                    0
                    • A Online
                      A Online
                      australien
                      wrote on last edited by australien
                      #650

                      Hallo,

                      wenn ich in der Instanz auf "Services und FITTT" gehe, dort einen neuen Dienst in die whitelist eintrage, wird in der Objekte Strucktur alles richtig angelegt.
                      Wenn ich nun den Link adaptiere und im Browser teste, bekomme ich {"result":"OK"} aber im DP steht leider noch immer "null"
                      Bei iobroker.pro wird auch der Zähler in der Diagnose für die verwendeten Befehle erhöht. Der Inhalt es links wird nicht übertragen an den IOB.
                      Gibt es dazu einen Workaround?

                      Erledigt: ein reload des IOB brachte die Lösung

                      1 Reply Last reply
                      0
                      • W Offline
                        W Offline
                        Wuschl
                        wrote on last edited by
                        #651

                        Servus, kann man die Schaltbefehle des Alexa Adapters irgendwie überprüfen oder nachvollziehen? Ich habe seit letzter Woche das Problem, daß jeden Abend eine Meldung von iobroker.info kommt, daß die 50 limitierten Schaltbefehle überschritten sind. Habe aber keine Ahnung woher... Ich benutze es eigentlich nur um den Fernseher ein und aus zu schalten. Ich habe auch nichts am Adapter verändert.

                        1 Reply Last reply
                        0
                        • T Tortuga

                          Hallo,
                          ich habe das Problem, daß ich den ioBoker.assistant-Skill nicht aktivieren kann, bzw, nicht mit dem iobroker.pro-Konto verknüpfen kann, da es zu einer Fehlermeldung "Konten konnten nicht verknüpft werden"
                          Ich bin echt ratlos, es war ein weiter Weg bis hier.

                          -Da einige Pakete nicht mehr zur Verfügung standen habe ich den ganzen Pi auf Debian 13 neu aufgebaut.
                          -Backupdaten gelesen und alle Adapter aktualisiert.
                          -iobroker.pro abo ist aktuell und Zugangsdaten i.O. (sogar nochmal neues PW angelegt)
                          -alten Skill deaktiviert, neuer Skill auf Handy wegen alten Android nicht möglich(Alexa-App gelöscht), also über Tablet versucht anzumelden.
                          -Instanz iot ist verbunden, alte Alexa V1 deaktiviert , unter Alexa-Geräte V3 sind alle alten Geräte vorhanden
                          -mehrfach den Botton"IOT-Anmeldeinformationen neu erstellen" gedrückt und Instanzen neu gestartet, ohne Erfolg
                          Screenshot_20260111-164140[1].png
                          Wo steckt hier das Problem ???

                          Vielen Dank im Vorraus

                          Grüße

                          Andreas

                          D Offline
                          D Offline
                          drloksoft
                          wrote on last edited by
                          #652

                          @Tortuga hast Du das Problem lösen können? Ich stehe vor dem gleichen gerade.

                          Samson71S 1 Reply Last reply
                          0
                          • D drloksoft

                            @Tortuga hast Du das Problem lösen können? Ich stehe vor dem gleichen gerade.

                            Samson71S Offline
                            Samson71S Offline
                            Samson71
                            Global Moderator
                            wrote on last edited by
                            #653

                            @drloksoft
                            Seit wann genau tritt das Problem auf und mit welcher Version vom iot-Adapter?

                            Markus

                            Bitte beachten:
                            Hinweise für gute Forenbeiträge
                            Maßnahmen zum Schutz des Forums

                            D 1 Reply Last reply
                            0
                            • Samson71S Samson71

                              @drloksoft
                              Seit wann genau tritt das Problem auf und mit welcher Version vom iot-Adapter?

                              D Offline
                              D Offline
                              drloksoft
                              wrote on last edited by
                              #654

                              @Samson71 Hi,
                              Ich habe den "CREATE IOT CREDENTIALS ANEW" button gedrückt UND beim Login in der Alexa App nicht den voreingestellten Login genommen, sondern die Daten erneut manuell eingegeben. Dann ging es beim dritten Mal heute Nacht und ich habe meine 42 Geräte gefunden und konfiguriert.

                              Heute morgen sagt mir allerdings mein Echo und die Alexa App, dass die Geräte nicht erreichbar sind. In der Instanz sieht alles gut aus und auch die Alexa App sagt im Skill, dass alles konfiguriert ist.

                              Einen echten troubeshooting Ansatz finde ich nicht. Hast du eine Idee?

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                drloksoft
                                wrote on last edited by
                                #655

                                Okay, 24 Stunden später scheinen nun magisch die Geräte wieder verfügbar zu sein. Allerdings funktionieren die Rolladen nicht mehr. Ich habe Rolladenaktoren von Shelly verbaut, die mir im Datenpunkt "Cover0.Position" exakt die prozentuale Position angeben. Diesen Datenpunkt habe ich mit einem Alexa Gerät verbunden und ihm den Typ "Window Blind" gegeben. In der Alexa App sehe ich auch Buttons mit Prozentualen Angaben in 20er Schritten (0-100). Bei egal welchen Button ich drücke, geht das Rollo immer auf 0%.
                                33261393-a5d5-4db4-be0c-930a98fcfacd-image.jpeg
                                Selbst wenn ich im IO Adapter "Silly" logging einstelle, spuckt der Log nichts sachdienliches zum Troubleshooting aus. Hat noch jemand eine Idee?

                                HomoranH 1 Reply Last reply
                                0
                                • D drloksoft

                                  Okay, 24 Stunden später scheinen nun magisch die Geräte wieder verfügbar zu sein. Allerdings funktionieren die Rolladen nicht mehr. Ich habe Rolladenaktoren von Shelly verbaut, die mir im Datenpunkt "Cover0.Position" exakt die prozentuale Position angeben. Diesen Datenpunkt habe ich mit einem Alexa Gerät verbunden und ihm den Typ "Window Blind" gegeben. In der Alexa App sehe ich auch Buttons mit Prozentualen Angaben in 20er Schritten (0-100). Bei egal welchen Button ich drücke, geht das Rollo immer auf 0%.
                                  33261393-a5d5-4db4-be0c-930a98fcfacd-image.jpeg
                                  Selbst wenn ich im IO Adapter "Silly" logging einstelle, spuckt der Log nichts sachdienliches zum Troubleshooting aus. Hat noch jemand eine Idee?

                                  HomoranH Do not disturb
                                  HomoranH Do not disturb
                                  Homoran
                                  Global Moderator Administrators
                                  wrote on last edited by
                                  #656

                                  @drloksoft sagte:

                                  exakt die prozentuale Position angeben.

                                  Echte Prozent?
                                  Oder zB. 0.6 von max 1

                                  kein Support per PN! - Fragen im Forum stellen -
                                  Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                                  Das Forum freut sich über eine Spende. Benutzt dazu den Spendenbutton oben rechts. Danke!
                                  der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

                                  D 1 Reply Last reply
                                  0
                                  • HomoranH Homoran

                                    @drloksoft sagte:

                                    exakt die prozentuale Position angeben.

                                    Echte Prozent?
                                    Oder zB. 0.6 von max 1

                                    D Offline
                                    D Offline
                                    drloksoft
                                    wrote on last edited by drloksoft
                                    #657

                                    @Homoran
                                    Das ist etwas verrückt. In der Alexa App geht es gar nicht einen ordentlichen Stand des Rollos auszuwählen. Somit kann ich Alexa-basierte Szenen schon mal nicht erstellen. Ich habe aktuell ein kleines Script geschrieben, welches mir die Zustände spiegelt. Damit sowohl actual als auch set in die Config ordentlich übernommen werden. Wenn ich nun die Datenpunkte des Scriptes nehme, dann kann ich zumindest per Spracheingabe "Alexa, setze Wohnzimmer Rollo rechts auf 50|40|30(etc)" das Rollo halb hoch fahren. Richtig elegant ist das nicht, funktioniert aber für's erste.

                                    Du bringst mich aber auf eine Idee. Wenn die Alexa App keine Prozentwerte, sondern dezimalwerte übergibt, geht es natürlich so gut wie immer auf 0. Ich teste mal, ob ich irgendwas schlaues mitloggen kann.

                                    /************************************************************
                                     * Shelly Cover -> Alexa V3 Alias (SET / ACTUAL)
                                     * Debug-Version mit ausführlichem Logging
                                     ************************************************************/
                                    
                                    const CONFIG = {
                                        name: 'Wohnzimmer_Rollo_Rechts',
                                    
                                        SHELLY_ACTUAL_ID: 'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.Position',
                                        SHELLY_WRITE_ID:  'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.TargetPosition',
                                    
                                        BASE_PATH: '0_userdata.0.Alexa.blinds.Wohnzimmer_Rollo_Rechts',
                                    
                                        LOG: true,
                                        DEBUG: true
                                    };
                                    
                                    const DP = {
                                        SET:    `${CONFIG.BASE_PATH}.set`,
                                        ACTUAL: `${CONFIG.BASE_PATH}.actual`,
                                        INFO:   `${CONFIG.BASE_PATH}.info.lastCommand`,
                                        DEBUG:  `${CONFIG.BASE_PATH}.info.lastRawEvent`
                                    };
                                    
                                    let suppressActualEchoUntil = 0;
                                    let lastForwardedTarget = null;
                                    let lastForwardedTs = 0;
                                    
                                    function logx(msg, level = 'info') {
                                        if (CONFIG.LOG) log(`[AlexaBlind] ${msg}`, level);
                                    }
                                    
                                    function debugLog(msg) {
                                        if (CONFIG.DEBUG) log(`[AlexaBlind][DEBUG] ${msg}`, 'info');
                                    }
                                    
                                    function clampPercent(val) {
                                        let n = Number(val);
                                        if (isNaN(n)) return null;
                                        if (n < 0) n = 0;
                                        if (n > 100) n = 100;
                                        return Math.round(n);
                                    }
                                    
                                    function fmtState(obj) {
                                        if (!obj || !obj.state) return 'kein state';
                                        return JSON.stringify({
                                            val: obj.state.val,
                                            ack: obj.state.ack,
                                            from: obj.state.from,
                                            ts: obj.state.ts,
                                            lc: obj.state.lc,
                                            user: obj.state.user,
                                            q: obj.state.q
                                        });
                                    }
                                    
                                    // States anlegen
                                    createState(DP.SET, 0, {
                                        name: `${CONFIG.name} SET`,
                                        type: 'number',
                                        role: 'level.blind',
                                        read: true,
                                        write: true,
                                        unit: '%',
                                        min: 0,
                                        max: 100,
                                        def: 0,
                                        desc: 'Sollwert für Alexa / Blind'
                                    }, async () => {
                                    
                                        createState(DP.ACTUAL, 0, {
                                            name: `${CONFIG.name} ACTUAL`,
                                            type: 'number',
                                            role: 'value.blind',
                                            read: true,
                                            write: false,
                                            unit: '%',
                                            min: 0,
                                            max: 100,
                                            def: 0,
                                            desc: 'Istwert für Alexa / Blind'
                                        }, async () => {
                                    
                                            createState(DP.INFO, '', {
                                                name: `${CONFIG.name} Last Command`,
                                                type: 'string',
                                                role: 'text',
                                                read: true,
                                                write: false,
                                                def: ''
                                            }, async () => {
                                    
                                                createState(DP.DEBUG, '', {
                                                    name: `${CONFIG.name} Last Raw Event`,
                                                    type: 'string',
                                                    role: 'text',
                                                    read: true,
                                                    write: false,
                                                    def: ''
                                                }, init);
                                            });
                                        });
                                    });
                                    
                                    function init() {
                                        logx(`Initialisierung für "${CONFIG.name}" gestartet`);
                                        logx(`SET-State: ${DP.SET}`);
                                        logx(`ACTUAL-State: ${DP.ACTUAL}`);
                                        logx(`SHELLY_WRITE_ID: ${CONFIG.SHELLY_WRITE_ID}`);
                                        logx(`SHELLY_ACTUAL_ID: ${CONFIG.SHELLY_ACTUAL_ID}`);
                                    
                                        // Initialen ACTUAL-Wert vom Shelly übernehmen
                                        const current = getState(CONFIG.SHELLY_ACTUAL_ID);
                                        if (current && current.val !== null && current.val !== undefined) {
                                            const pos = clampPercent(current.val);
                                            if (pos !== null) {
                                                setState(DP.ACTUAL, pos, true);
                                                setState(DP.SET, pos, true);
                                                logx(`Initialposition übernommen: ${pos}%`);
                                            }
                                        } else {
                                            logx(`Warnung: ACTUAL-State nicht lesbar: ${CONFIG.SHELLY_ACTUAL_ID}`, 'warn');
                                        }
                                    
                                        /********************************************************
                                         * MONITOR: Alles loggen, was auf dem SET-State passiert
                                         ********************************************************/
                                        on({ id: DP.SET, change: 'any' }, obj => {
                                            const oldVal = obj.oldState ? obj.oldState.val : undefined;
                                            const newVal = obj.state ? obj.state.val : undefined;
                                    
                                            const msg = `RAW EVENT auf SET:
                                    alt=${oldVal}, neu=${newVal}, ack=${obj.state.ack}, from=${obj.state.from}, user=${obj.state.user}, ts=${obj.state.ts}, lc=${obj.state.lc}, q=${obj.state.q}`;
                                    
                                            debugLog(msg);
                                            setState(DP.DEBUG, msg, true);
                                        });
                                    
                                        /********************************************************
                                         * AKTION: Jede echte Wertänderung auf SET verarbeiten
                                         * Wichtig: erstmal OHNE Filter ack:false
                                         ********************************************************/
                                        on({ id: DP.SET, change: 'ne' }, obj => {
                                            const target = clampPercent(obj.state.val);
                                    
                                            debugLog(`Trigger auf DP.SET(change:ne) -> ${fmtState(obj)}`);
                                    
                                            if (target === null) {
                                                logx(`Ungültiger SET-Wert empfangen: ${obj.state.val}`, 'warn');
                                                return;
                                            }
                                    
                                            // Endlosschleifen vermeiden:
                                            // Wenn wir selbst eben genau diesen Wert bestätigt haben, nicht nochmal schreiben
                                            const now = Date.now();
                                            if (
                                                obj.state.ack === true &&
                                                lastForwardedTarget === target &&
                                                (now - lastForwardedTs) < 5000
                                            ) {
                                                debugLog(`Ignoriere Echo auf SET (${target}%), weil es sehr wahrscheinlich von uns selbst kommt.`);
                                                return;
                                            }
                                    
                                            suppressActualEchoUntil = now + 3000;
                                            lastForwardedTarget = target;
                                            lastForwardedTs = now;
                                    
                                            logx(`SET empfangen: ${target}% | ack=${obj.state.ack} | from=${obj.state.from} -> schreibe an Shelly (${CONFIG.SHELLY_WRITE_ID})`);
                                    
                                            setState(DP.INFO, `SET ${target}% | ack=${obj.state.ack} | from=${obj.state.from} @ ${new Date().toISOString()}`, true);
                                    
                                            // SET-State bestätigt zurückschreiben, aber nur wenn noch nicht ack=true
                                            if (obj.state.ack !== true) {
                                                setState(DP.SET, target, true);
                                            }
                                    
                                            // An Shelly schreiben
                                            setState(CONFIG.SHELLY_WRITE_ID, target);
                                        });
                                    
                                        /********************************************************
                                         * Shelly meldet echte Position zurück -> ACTUAL aktualisieren
                                         ********************************************************/
                                        on({ id: CONFIG.SHELLY_ACTUAL_ID, change: 'ne' }, obj => {
                                            const actual = clampPercent(obj.state.val);
                                    
                                            debugLog(`Shelly ACTUAL Event -> ${fmtState(obj)}`);
                                    
                                            if (actual === null) {
                                                logx(`Ungültiger ACTUAL-Wert vom Shelly: ${obj.state.val}`, 'warn');
                                                return;
                                            }
                                    
                                            setState(DP.ACTUAL, actual, true);
                                    
                                            // optional den SET-State nachziehen, aber nur wenn gerade kein frischer Fahrbefehl läuft
                                            if (Date.now() > suppressActualEchoUntil) {
                                                setState(DP.SET, actual, true);
                                            }
                                    
                                            logx(`Shelly ACTUAL aktualisiert: ${actual}%`);
                                        });
                                    
                                        /********************************************************
                                         * Optional: Direktes Logging des Shelly-Target-States
                                         ********************************************************/
                                        on({ id: CONFIG.SHELLY_WRITE_ID, change: 'any' }, obj => {
                                            debugLog(`Shelly WRITE/TARGET Event -> ${fmtState(obj)}`);
                                        });
                                    
                                        logx(`Fertig initialisiert.`);
                                    }
                                    
                                    haselchenH 1 Reply Last reply
                                    0
                                    • D drloksoft

                                      @Homoran
                                      Das ist etwas verrückt. In der Alexa App geht es gar nicht einen ordentlichen Stand des Rollos auszuwählen. Somit kann ich Alexa-basierte Szenen schon mal nicht erstellen. Ich habe aktuell ein kleines Script geschrieben, welches mir die Zustände spiegelt. Damit sowohl actual als auch set in die Config ordentlich übernommen werden. Wenn ich nun die Datenpunkte des Scriptes nehme, dann kann ich zumindest per Spracheingabe "Alexa, setze Wohnzimmer Rollo rechts auf 50|40|30(etc)" das Rollo halb hoch fahren. Richtig elegant ist das nicht, funktioniert aber für's erste.

                                      Du bringst mich aber auf eine Idee. Wenn die Alexa App keine Prozentwerte, sondern dezimalwerte übergibt, geht es natürlich so gut wie immer auf 0. Ich teste mal, ob ich irgendwas schlaues mitloggen kann.

                                      /************************************************************
                                       * Shelly Cover -> Alexa V3 Alias (SET / ACTUAL)
                                       * Debug-Version mit ausführlichem Logging
                                       ************************************************************/
                                      
                                      const CONFIG = {
                                          name: 'Wohnzimmer_Rollo_Rechts',
                                      
                                          SHELLY_ACTUAL_ID: 'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.Position',
                                          SHELLY_WRITE_ID:  'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.TargetPosition',
                                      
                                          BASE_PATH: '0_userdata.0.Alexa.blinds.Wohnzimmer_Rollo_Rechts',
                                      
                                          LOG: true,
                                          DEBUG: true
                                      };
                                      
                                      const DP = {
                                          SET:    `${CONFIG.BASE_PATH}.set`,
                                          ACTUAL: `${CONFIG.BASE_PATH}.actual`,
                                          INFO:   `${CONFIG.BASE_PATH}.info.lastCommand`,
                                          DEBUG:  `${CONFIG.BASE_PATH}.info.lastRawEvent`
                                      };
                                      
                                      let suppressActualEchoUntil = 0;
                                      let lastForwardedTarget = null;
                                      let lastForwardedTs = 0;
                                      
                                      function logx(msg, level = 'info') {
                                          if (CONFIG.LOG) log(`[AlexaBlind] ${msg}`, level);
                                      }
                                      
                                      function debugLog(msg) {
                                          if (CONFIG.DEBUG) log(`[AlexaBlind][DEBUG] ${msg}`, 'info');
                                      }
                                      
                                      function clampPercent(val) {
                                          let n = Number(val);
                                          if (isNaN(n)) return null;
                                          if (n < 0) n = 0;
                                          if (n > 100) n = 100;
                                          return Math.round(n);
                                      }
                                      
                                      function fmtState(obj) {
                                          if (!obj || !obj.state) return 'kein state';
                                          return JSON.stringify({
                                              val: obj.state.val,
                                              ack: obj.state.ack,
                                              from: obj.state.from,
                                              ts: obj.state.ts,
                                              lc: obj.state.lc,
                                              user: obj.state.user,
                                              q: obj.state.q
                                          });
                                      }
                                      
                                      // States anlegen
                                      createState(DP.SET, 0, {
                                          name: `${CONFIG.name} SET`,
                                          type: 'number',
                                          role: 'level.blind',
                                          read: true,
                                          write: true,
                                          unit: '%',
                                          min: 0,
                                          max: 100,
                                          def: 0,
                                          desc: 'Sollwert für Alexa / Blind'
                                      }, async () => {
                                      
                                          createState(DP.ACTUAL, 0, {
                                              name: `${CONFIG.name} ACTUAL`,
                                              type: 'number',
                                              role: 'value.blind',
                                              read: true,
                                              write: false,
                                              unit: '%',
                                              min: 0,
                                              max: 100,
                                              def: 0,
                                              desc: 'Istwert für Alexa / Blind'
                                          }, async () => {
                                      
                                              createState(DP.INFO, '', {
                                                  name: `${CONFIG.name} Last Command`,
                                                  type: 'string',
                                                  role: 'text',
                                                  read: true,
                                                  write: false,
                                                  def: ''
                                              }, async () => {
                                      
                                                  createState(DP.DEBUG, '', {
                                                      name: `${CONFIG.name} Last Raw Event`,
                                                      type: 'string',
                                                      role: 'text',
                                                      read: true,
                                                      write: false,
                                                      def: ''
                                                  }, init);
                                              });
                                          });
                                      });
                                      
                                      function init() {
                                          logx(`Initialisierung für "${CONFIG.name}" gestartet`);
                                          logx(`SET-State: ${DP.SET}`);
                                          logx(`ACTUAL-State: ${DP.ACTUAL}`);
                                          logx(`SHELLY_WRITE_ID: ${CONFIG.SHELLY_WRITE_ID}`);
                                          logx(`SHELLY_ACTUAL_ID: ${CONFIG.SHELLY_ACTUAL_ID}`);
                                      
                                          // Initialen ACTUAL-Wert vom Shelly übernehmen
                                          const current = getState(CONFIG.SHELLY_ACTUAL_ID);
                                          if (current && current.val !== null && current.val !== undefined) {
                                              const pos = clampPercent(current.val);
                                              if (pos !== null) {
                                                  setState(DP.ACTUAL, pos, true);
                                                  setState(DP.SET, pos, true);
                                                  logx(`Initialposition übernommen: ${pos}%`);
                                              }
                                          } else {
                                              logx(`Warnung: ACTUAL-State nicht lesbar: ${CONFIG.SHELLY_ACTUAL_ID}`, 'warn');
                                          }
                                      
                                          /********************************************************
                                           * MONITOR: Alles loggen, was auf dem SET-State passiert
                                           ********************************************************/
                                          on({ id: DP.SET, change: 'any' }, obj => {
                                              const oldVal = obj.oldState ? obj.oldState.val : undefined;
                                              const newVal = obj.state ? obj.state.val : undefined;
                                      
                                              const msg = `RAW EVENT auf SET:
                                      alt=${oldVal}, neu=${newVal}, ack=${obj.state.ack}, from=${obj.state.from}, user=${obj.state.user}, ts=${obj.state.ts}, lc=${obj.state.lc}, q=${obj.state.q}`;
                                      
                                              debugLog(msg);
                                              setState(DP.DEBUG, msg, true);
                                          });
                                      
                                          /********************************************************
                                           * AKTION: Jede echte Wertänderung auf SET verarbeiten
                                           * Wichtig: erstmal OHNE Filter ack:false
                                           ********************************************************/
                                          on({ id: DP.SET, change: 'ne' }, obj => {
                                              const target = clampPercent(obj.state.val);
                                      
                                              debugLog(`Trigger auf DP.SET(change:ne) -> ${fmtState(obj)}`);
                                      
                                              if (target === null) {
                                                  logx(`Ungültiger SET-Wert empfangen: ${obj.state.val}`, 'warn');
                                                  return;
                                              }
                                      
                                              // Endlosschleifen vermeiden:
                                              // Wenn wir selbst eben genau diesen Wert bestätigt haben, nicht nochmal schreiben
                                              const now = Date.now();
                                              if (
                                                  obj.state.ack === true &&
                                                  lastForwardedTarget === target &&
                                                  (now - lastForwardedTs) < 5000
                                              ) {
                                                  debugLog(`Ignoriere Echo auf SET (${target}%), weil es sehr wahrscheinlich von uns selbst kommt.`);
                                                  return;
                                              }
                                      
                                              suppressActualEchoUntil = now + 3000;
                                              lastForwardedTarget = target;
                                              lastForwardedTs = now;
                                      
                                              logx(`SET empfangen: ${target}% | ack=${obj.state.ack} | from=${obj.state.from} -> schreibe an Shelly (${CONFIG.SHELLY_WRITE_ID})`);
                                      
                                              setState(DP.INFO, `SET ${target}% | ack=${obj.state.ack} | from=${obj.state.from} @ ${new Date().toISOString()}`, true);
                                      
                                              // SET-State bestätigt zurückschreiben, aber nur wenn noch nicht ack=true
                                              if (obj.state.ack !== true) {
                                                  setState(DP.SET, target, true);
                                              }
                                      
                                              // An Shelly schreiben
                                              setState(CONFIG.SHELLY_WRITE_ID, target);
                                          });
                                      
                                          /********************************************************
                                           * Shelly meldet echte Position zurück -> ACTUAL aktualisieren
                                           ********************************************************/
                                          on({ id: CONFIG.SHELLY_ACTUAL_ID, change: 'ne' }, obj => {
                                              const actual = clampPercent(obj.state.val);
                                      
                                              debugLog(`Shelly ACTUAL Event -> ${fmtState(obj)}`);
                                      
                                              if (actual === null) {
                                                  logx(`Ungültiger ACTUAL-Wert vom Shelly: ${obj.state.val}`, 'warn');
                                                  return;
                                              }
                                      
                                              setState(DP.ACTUAL, actual, true);
                                      
                                              // optional den SET-State nachziehen, aber nur wenn gerade kein frischer Fahrbefehl läuft
                                              if (Date.now() > suppressActualEchoUntil) {
                                                  setState(DP.SET, actual, true);
                                              }
                                      
                                              logx(`Shelly ACTUAL aktualisiert: ${actual}%`);
                                          });
                                      
                                          /********************************************************
                                           * Optional: Direktes Logging des Shelly-Target-States
                                           ********************************************************/
                                          on({ id: CONFIG.SHELLY_WRITE_ID, change: 'any' }, obj => {
                                              debugLog(`Shelly WRITE/TARGET Event -> ${fmtState(obj)}`);
                                          });
                                      
                                          logx(`Fertig initialisiert.`);
                                      }
                                      
                                      haselchenH Offline
                                      haselchenH Offline
                                      haselchen
                                      Most Active
                                      wrote on last edited by
                                      #658

                                      @drloksoft

                                      Was ist SlatPos für ein Datenpunkt ?
                                      Der steht bei dir bei Actual im Screenshot .

                                      Synology DS218+ & 2 x Fujitsu Esprimo (VM/Container) + FritzBox7590 + 2 AVM 3000 Repeater & Homematic & HUE & Osram & Xiaomi, NPM 10.9.4, Nodejs 22.21.0 ,JS Controller 7.0.7 ,Admin 7.7.19

                                      D 1 Reply Last reply
                                      0
                                      • haselchenH haselchen

                                        @drloksoft

                                        Was ist SlatPos für ein Datenpunkt ?
                                        Der steht bei dir bei Actual im Screenshot .

                                        D Offline
                                        D Offline
                                        drloksoft
                                        wrote on last edited by
                                        #659

                                        @haselchen Gute Frage. Den Datenpunkt übernimmt der IOT Adapter "SlatPos" automatisch, wenn man nur "position" angibt. Mit meinen neuen Datenpunkten übernimmt der IOT Adapter nur den Set Datenpunkt:
                                        7f3571ba-637c-41ae-b0e7-e22268f52dca-image.jpeg

                                        Unabhängig davon stelle ich fest, dass bei der Auswahl über die Alexa-App wird immer 0 auf den SET-State geschrieben wird, während ich per Spracheingabe tatsächlich numerische Werte bekomme.

                                        Der aus der Alexa-App kommende Wert ist nicht 0.5, 0.6 oder ein anderer Dezimalwert, sondern tatsächlich numerisch 0.

                                        Hier mein Debug Script:

                                        /************************************************************
                                         * Shelly Cover -> Alexa V3 Alias (SET / ACTUAL)
                                         * MAX DEBUG VERSION
                                         ************************************************************/
                                        
                                        const CONFIG = {
                                            name: 'Wohnzimmer_Rollo_Rechts',
                                        
                                            SHELLY_ACTUAL_ID: 'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.Position',
                                            SHELLY_WRITE_ID:  'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.TargetPosition',
                                        
                                            BASE_PATH: '0_userdata.0.Alexa.blinds.Wohnzimmer_Rollo_Rechts',
                                        
                                            LOG: true,
                                            DEBUG: true
                                        };
                                        
                                        const DP = {
                                            SET:    `${CONFIG.BASE_PATH}.set`,
                                            ACTUAL: `${CONFIG.BASE_PATH}.actual`,
                                            INFO:   `${CONFIG.BASE_PATH}.info.lastCommand`,
                                            DEBUG:  `${CONFIG.BASE_PATH}.info.lastRawEvent`
                                        };
                                        
                                        let suppressActualEchoUntil = 0;
                                        let lastForwardedTarget = null;
                                        let lastForwardedTs = 0;
                                        
                                        function logx(msg, level = 'info') {
                                            if (CONFIG.LOG) log(`[AlexaBlind] ${msg}`, level);
                                        }
                                        
                                        function debugLog(msg) {
                                            if (CONFIG.DEBUG) log(`[AlexaBlind][DEBUG] ${msg}`, 'info');
                                        }
                                        
                                        function clampPercent(val) {
                                            let n = Number(val);
                                            if (isNaN(n)) return null;
                                            if (n < 0) n = 0;
                                            if (n > 100) n = 100;
                                            return Math.round(n);
                                        }
                                        
                                        function describeValue(val) {
                                            return `value=${JSON.stringify(val)} | typeof=${typeof val} | Number()=${Number(val)} | parseFloat=${parseFloat(val)}`;
                                        }
                                        
                                        function fmtState(obj) {
                                            if (!obj || !obj.state) return 'kein state';
                                            return JSON.stringify({
                                                val: obj.state.val,
                                                valJson: JSON.stringify(obj.state.val),
                                                typeOfVal: typeof obj.state.val,
                                                numberVal: Number(obj.state.val),
                                                parseFloatVal: parseFloat(obj.state.val),
                                                ack: obj.state.ack,
                                                from: obj.state.from,
                                                ts: obj.state.ts,
                                                lc: obj.state.lc,
                                                user: obj.state.user,
                                                q: obj.state.q,
                                                c: obj.state.c
                                            });
                                        }
                                        
                                        function logObjectInfo(id) {
                                            try {
                                                const obj = getObject(id);
                                                if (!obj) {
                                                    debugLog(`getObject(${id}) -> kein Objekt gefunden`);
                                                    return;
                                                }
                                        
                                                debugLog(`Objektinfo ${id}: ${JSON.stringify({
                                                    type: obj.type,
                                                    common: obj.common,
                                                    native: obj.native
                                                })}`);
                                            } catch (e) {
                                                logx(`Fehler bei getObject(${id}): ${e}`, 'warn');
                                            }
                                        }
                                        
                                        // States anlegen
                                        createState(DP.SET, 0, {
                                            name: `${CONFIG.name} SET`,
                                            type: 'number',
                                            role: 'level.blind',
                                            read: true,
                                            write: true,
                                            unit: '%',
                                            min: 0,
                                            max: 100,
                                            def: 0,
                                            desc: 'Sollwert für Alexa / Blind'
                                        }, async () => {
                                        
                                            createState(DP.ACTUAL, 0, {
                                                name: `${CONFIG.name} ACTUAL`,
                                                type: 'number',
                                                role: 'value.blind',
                                                read: true,
                                                write: false,
                                                unit: '%',
                                                min: 0,
                                                max: 100,
                                                def: 0,
                                                desc: 'Istwert für Alexa / Blind'
                                            }, async () => {
                                        
                                                createState(DP.INFO, '', {
                                                    name: `${CONFIG.name} Last Command`,
                                                    type: 'string',
                                                    role: 'text',
                                                    read: true,
                                                    write: false,
                                                    def: ''
                                                }, async () => {
                                        
                                                    createState(DP.DEBUG, '', {
                                                        name: `${CONFIG.name} Last Raw Event`,
                                                        type: 'string',
                                                        role: 'text',
                                                        read: true,
                                                        write: false,
                                                        def: ''
                                                    }, init);
                                                });
                                            });
                                        });
                                        
                                        function init() {
                                            logx(`Initialisierung für "${CONFIG.name}" gestartet`);
                                            logx(`SET-State: ${DP.SET}`);
                                            logx(`ACTUAL-State: ${DP.ACTUAL}`);
                                            logx(`SHELLY_WRITE_ID: ${CONFIG.SHELLY_WRITE_ID}`);
                                            logx(`SHELLY_ACTUAL_ID: ${CONFIG.SHELLY_ACTUAL_ID}`);
                                        
                                            logObjectInfo(DP.SET);
                                            logObjectInfo(DP.ACTUAL);
                                            logObjectInfo(CONFIG.SHELLY_WRITE_ID);
                                            logObjectInfo(CONFIG.SHELLY_ACTUAL_ID);
                                        
                                            const current = getState(CONFIG.SHELLY_ACTUAL_ID);
                                            if (current && current.val !== null && current.val !== undefined) {
                                                const pos = clampPercent(current.val);
                                                if (pos !== null) {
                                                    setState(DP.ACTUAL, pos, true);
                                                    setState(DP.SET, pos, true);
                                                    logx(`Initialposition übernommen: ${pos}%`);
                                                }
                                            } else {
                                                logx(`Warnung: ACTUAL-State nicht lesbar: ${CONFIG.SHELLY_ACTUAL_ID}`, 'warn');
                                            }
                                        
                                            /********************************************************
                                             * 1) GLOBAL DEBUG auf ganzen Alexa-Zweig
                                             ********************************************************/
                                            on({ id: new RegExp('^' + CONFIG.BASE_PATH.replace(/\./g, '\\.') + '\\..*'), change: 'any' }, obj => {
                                                const oldVal = obj.oldState ? obj.oldState.val : undefined;
                                                const newVal = obj.state ? obj.state.val : undefined;
                                        
                                                const msg =
                                                    `BRANCH EVENT | id=${obj.id} | ` +
                                                    `old=${JSON.stringify(oldVal)} | new=${JSON.stringify(newVal)} | ` +
                                                    `typeof=${typeof newVal} | Number=${Number(newVal)} | parseFloat=${parseFloat(newVal)} | ` +
                                                    `ack=${obj.state.ack} | from=${obj.state.from} | user=${obj.state.user} | ` +
                                                    `ts=${obj.state.ts} | lc=${obj.state.lc} | q=${obj.state.q} | c=${obj.state.c}`;
                                        
                                                debugLog(msg);
                                        
                                                if (obj.id === DP.SET) {
                                                    setState(DP.DEBUG, msg, true);
                                                }
                                            });
                                        
                                            /********************************************************
                                             * 2) Speziell DP.SET überwachen
                                             ********************************************************/
                                            on({ id: DP.SET, change: 'any' }, obj => {
                                                debugLog(`SET RAW -> ${fmtState(obj)}`);
                                            });
                                        
                                            /********************************************************
                                             * 3) Jede echte Wertänderung auf SET verarbeiten
                                             ********************************************************/
                                            on({ id: DP.SET, change: 'ne' }, obj => {
                                                debugLog(`SET Trigger(change:ne) -> ${fmtState(obj)}`);
                                                debugLog(`SET Detail -> ${describeValue(obj.state.val)}`);
                                        
                                                const target = clampPercent(obj.state.val);
                                        
                                                if (target === null) {
                                                    logx(`Ungültiger SET-Wert empfangen: ${JSON.stringify(obj.state.val)}`, 'warn');
                                                    return;
                                                }
                                        
                                                const now = Date.now();
                                                if (
                                                    obj.state.ack === true &&
                                                    lastForwardedTarget === target &&
                                                    (now - lastForwardedTs) < 5000
                                                ) {
                                                    debugLog(`Ignoriere Echo auf SET (${target}%), vermutlich von uns selbst.`);
                                                    return;
                                                }
                                        
                                                suppressActualEchoUntil = now + 3000;
                                                lastForwardedTarget = target;
                                                lastForwardedTs = now;
                                        
                                                logx(`SET empfangen: ${target}% | raw=${JSON.stringify(obj.state.val)} | ack=${obj.state.ack} | from=${obj.state.from} -> schreibe an Shelly (${CONFIG.SHELLY_WRITE_ID})`);
                                        
                                                setState(DP.INFO, `SET ${target}% | raw=${JSON.stringify(obj.state.val)} | ack=${obj.state.ack} | from=${obj.state.from} @ ${new Date().toISOString()}`, true);
                                        
                                                if (obj.state.ack !== true) {
                                                    setState(DP.SET, target, true);
                                                }
                                        
                                                setState(CONFIG.SHELLY_WRITE_ID, target);
                                            });
                                        
                                            /********************************************************
                                             * 4) Shelly ACTUAL
                                             ********************************************************/
                                            on({ id: CONFIG.SHELLY_ACTUAL_ID, change: 'any' }, obj => {
                                                debugLog(`Shelly ACTUAL Event -> ${fmtState(obj)}`);
                                            });
                                        
                                            on({ id: CONFIG.SHELLY_ACTUAL_ID, change: 'ne' }, obj => {
                                                const actual = clampPercent(obj.state.val);
                                        
                                                if (actual === null) {
                                                    logx(`Ungültiger ACTUAL-Wert vom Shelly: ${JSON.stringify(obj.state.val)}`, 'warn');
                                                    return;
                                                }
                                        
                                                setState(DP.ACTUAL, actual, true);
                                        
                                                if (Date.now() > suppressActualEchoUntil) {
                                                    setState(DP.SET, actual, true);
                                                }
                                        
                                                logx(`Shelly ACTUAL aktualisiert: ${actual}%`);
                                            });
                                        
                                            /********************************************************
                                             * 5) Shelly WRITE/TARGET
                                             ********************************************************/
                                            on({ id: CONFIG.SHELLY_WRITE_ID, change: 'any' }, obj => {
                                                debugLog(`Shelly WRITE/TARGET Event -> ${fmtState(obj)}`);
                                            });
                                        
                                            logx(`Fertig initialisiert.`);
                                        }
                                        
                                        HomoranH 1 Reply Last reply
                                        0
                                        • D drloksoft

                                          @haselchen Gute Frage. Den Datenpunkt übernimmt der IOT Adapter "SlatPos" automatisch, wenn man nur "position" angibt. Mit meinen neuen Datenpunkten übernimmt der IOT Adapter nur den Set Datenpunkt:
                                          7f3571ba-637c-41ae-b0e7-e22268f52dca-image.jpeg

                                          Unabhängig davon stelle ich fest, dass bei der Auswahl über die Alexa-App wird immer 0 auf den SET-State geschrieben wird, während ich per Spracheingabe tatsächlich numerische Werte bekomme.

                                          Der aus der Alexa-App kommende Wert ist nicht 0.5, 0.6 oder ein anderer Dezimalwert, sondern tatsächlich numerisch 0.

                                          Hier mein Debug Script:

                                          /************************************************************
                                           * Shelly Cover -> Alexa V3 Alias (SET / ACTUAL)
                                           * MAX DEBUG VERSION
                                           ************************************************************/
                                          
                                          const CONFIG = {
                                              name: 'Wohnzimmer_Rollo_Rechts',
                                          
                                              SHELLY_ACTUAL_ID: 'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.Position',
                                              SHELLY_WRITE_ID:  'shelly.0.shellyplus2pm#e86beae602b0#1.Cover0.TargetPosition',
                                          
                                              BASE_PATH: '0_userdata.0.Alexa.blinds.Wohnzimmer_Rollo_Rechts',
                                          
                                              LOG: true,
                                              DEBUG: true
                                          };
                                          
                                          const DP = {
                                              SET:    `${CONFIG.BASE_PATH}.set`,
                                              ACTUAL: `${CONFIG.BASE_PATH}.actual`,
                                              INFO:   `${CONFIG.BASE_PATH}.info.lastCommand`,
                                              DEBUG:  `${CONFIG.BASE_PATH}.info.lastRawEvent`
                                          };
                                          
                                          let suppressActualEchoUntil = 0;
                                          let lastForwardedTarget = null;
                                          let lastForwardedTs = 0;
                                          
                                          function logx(msg, level = 'info') {
                                              if (CONFIG.LOG) log(`[AlexaBlind] ${msg}`, level);
                                          }
                                          
                                          function debugLog(msg) {
                                              if (CONFIG.DEBUG) log(`[AlexaBlind][DEBUG] ${msg}`, 'info');
                                          }
                                          
                                          function clampPercent(val) {
                                              let n = Number(val);
                                              if (isNaN(n)) return null;
                                              if (n < 0) n = 0;
                                              if (n > 100) n = 100;
                                              return Math.round(n);
                                          }
                                          
                                          function describeValue(val) {
                                              return `value=${JSON.stringify(val)} | typeof=${typeof val} | Number()=${Number(val)} | parseFloat=${parseFloat(val)}`;
                                          }
                                          
                                          function fmtState(obj) {
                                              if (!obj || !obj.state) return 'kein state';
                                              return JSON.stringify({
                                                  val: obj.state.val,
                                                  valJson: JSON.stringify(obj.state.val),
                                                  typeOfVal: typeof obj.state.val,
                                                  numberVal: Number(obj.state.val),
                                                  parseFloatVal: parseFloat(obj.state.val),
                                                  ack: obj.state.ack,
                                                  from: obj.state.from,
                                                  ts: obj.state.ts,
                                                  lc: obj.state.lc,
                                                  user: obj.state.user,
                                                  q: obj.state.q,
                                                  c: obj.state.c
                                              });
                                          }
                                          
                                          function logObjectInfo(id) {
                                              try {
                                                  const obj = getObject(id);
                                                  if (!obj) {
                                                      debugLog(`getObject(${id}) -> kein Objekt gefunden`);
                                                      return;
                                                  }
                                          
                                                  debugLog(`Objektinfo ${id}: ${JSON.stringify({
                                                      type: obj.type,
                                                      common: obj.common,
                                                      native: obj.native
                                                  })}`);
                                              } catch (e) {
                                                  logx(`Fehler bei getObject(${id}): ${e}`, 'warn');
                                              }
                                          }
                                          
                                          // States anlegen
                                          createState(DP.SET, 0, {
                                              name: `${CONFIG.name} SET`,
                                              type: 'number',
                                              role: 'level.blind',
                                              read: true,
                                              write: true,
                                              unit: '%',
                                              min: 0,
                                              max: 100,
                                              def: 0,
                                              desc: 'Sollwert für Alexa / Blind'
                                          }, async () => {
                                          
                                              createState(DP.ACTUAL, 0, {
                                                  name: `${CONFIG.name} ACTUAL`,
                                                  type: 'number',
                                                  role: 'value.blind',
                                                  read: true,
                                                  write: false,
                                                  unit: '%',
                                                  min: 0,
                                                  max: 100,
                                                  def: 0,
                                                  desc: 'Istwert für Alexa / Blind'
                                              }, async () => {
                                          
                                                  createState(DP.INFO, '', {
                                                      name: `${CONFIG.name} Last Command`,
                                                      type: 'string',
                                                      role: 'text',
                                                      read: true,
                                                      write: false,
                                                      def: ''
                                                  }, async () => {
                                          
                                                      createState(DP.DEBUG, '', {
                                                          name: `${CONFIG.name} Last Raw Event`,
                                                          type: 'string',
                                                          role: 'text',
                                                          read: true,
                                                          write: false,
                                                          def: ''
                                                      }, init);
                                                  });
                                              });
                                          });
                                          
                                          function init() {
                                              logx(`Initialisierung für "${CONFIG.name}" gestartet`);
                                              logx(`SET-State: ${DP.SET}`);
                                              logx(`ACTUAL-State: ${DP.ACTUAL}`);
                                              logx(`SHELLY_WRITE_ID: ${CONFIG.SHELLY_WRITE_ID}`);
                                              logx(`SHELLY_ACTUAL_ID: ${CONFIG.SHELLY_ACTUAL_ID}`);
                                          
                                              logObjectInfo(DP.SET);
                                              logObjectInfo(DP.ACTUAL);
                                              logObjectInfo(CONFIG.SHELLY_WRITE_ID);
                                              logObjectInfo(CONFIG.SHELLY_ACTUAL_ID);
                                          
                                              const current = getState(CONFIG.SHELLY_ACTUAL_ID);
                                              if (current && current.val !== null && current.val !== undefined) {
                                                  const pos = clampPercent(current.val);
                                                  if (pos !== null) {
                                                      setState(DP.ACTUAL, pos, true);
                                                      setState(DP.SET, pos, true);
                                                      logx(`Initialposition übernommen: ${pos}%`);
                                                  }
                                              } else {
                                                  logx(`Warnung: ACTUAL-State nicht lesbar: ${CONFIG.SHELLY_ACTUAL_ID}`, 'warn');
                                              }
                                          
                                              /********************************************************
                                               * 1) GLOBAL DEBUG auf ganzen Alexa-Zweig
                                               ********************************************************/
                                              on({ id: new RegExp('^' + CONFIG.BASE_PATH.replace(/\./g, '\\.') + '\\..*'), change: 'any' }, obj => {
                                                  const oldVal = obj.oldState ? obj.oldState.val : undefined;
                                                  const newVal = obj.state ? obj.state.val : undefined;
                                          
                                                  const msg =
                                                      `BRANCH EVENT | id=${obj.id} | ` +
                                                      `old=${JSON.stringify(oldVal)} | new=${JSON.stringify(newVal)} | ` +
                                                      `typeof=${typeof newVal} | Number=${Number(newVal)} | parseFloat=${parseFloat(newVal)} | ` +
                                                      `ack=${obj.state.ack} | from=${obj.state.from} | user=${obj.state.user} | ` +
                                                      `ts=${obj.state.ts} | lc=${obj.state.lc} | q=${obj.state.q} | c=${obj.state.c}`;
                                          
                                                  debugLog(msg);
                                          
                                                  if (obj.id === DP.SET) {
                                                      setState(DP.DEBUG, msg, true);
                                                  }
                                              });
                                          
                                              /********************************************************
                                               * 2) Speziell DP.SET überwachen
                                               ********************************************************/
                                              on({ id: DP.SET, change: 'any' }, obj => {
                                                  debugLog(`SET RAW -> ${fmtState(obj)}`);
                                              });
                                          
                                              /********************************************************
                                               * 3) Jede echte Wertänderung auf SET verarbeiten
                                               ********************************************************/
                                              on({ id: DP.SET, change: 'ne' }, obj => {
                                                  debugLog(`SET Trigger(change:ne) -> ${fmtState(obj)}`);
                                                  debugLog(`SET Detail -> ${describeValue(obj.state.val)}`);
                                          
                                                  const target = clampPercent(obj.state.val);
                                          
                                                  if (target === null) {
                                                      logx(`Ungültiger SET-Wert empfangen: ${JSON.stringify(obj.state.val)}`, 'warn');
                                                      return;
                                                  }
                                          
                                                  const now = Date.now();
                                                  if (
                                                      obj.state.ack === true &&
                                                      lastForwardedTarget === target &&
                                                      (now - lastForwardedTs) < 5000
                                                  ) {
                                                      debugLog(`Ignoriere Echo auf SET (${target}%), vermutlich von uns selbst.`);
                                                      return;
                                                  }
                                          
                                                  suppressActualEchoUntil = now + 3000;
                                                  lastForwardedTarget = target;
                                                  lastForwardedTs = now;
                                          
                                                  logx(`SET empfangen: ${target}% | raw=${JSON.stringify(obj.state.val)} | ack=${obj.state.ack} | from=${obj.state.from} -> schreibe an Shelly (${CONFIG.SHELLY_WRITE_ID})`);
                                          
                                                  setState(DP.INFO, `SET ${target}% | raw=${JSON.stringify(obj.state.val)} | ack=${obj.state.ack} | from=${obj.state.from} @ ${new Date().toISOString()}`, true);
                                          
                                                  if (obj.state.ack !== true) {
                                                      setState(DP.SET, target, true);
                                                  }
                                          
                                                  setState(CONFIG.SHELLY_WRITE_ID, target);
                                              });
                                          
                                              /********************************************************
                                               * 4) Shelly ACTUAL
                                               ********************************************************/
                                              on({ id: CONFIG.SHELLY_ACTUAL_ID, change: 'any' }, obj => {
                                                  debugLog(`Shelly ACTUAL Event -> ${fmtState(obj)}`);
                                              });
                                          
                                              on({ id: CONFIG.SHELLY_ACTUAL_ID, change: 'ne' }, obj => {
                                                  const actual = clampPercent(obj.state.val);
                                          
                                                  if (actual === null) {
                                                      logx(`Ungültiger ACTUAL-Wert vom Shelly: ${JSON.stringify(obj.state.val)}`, 'warn');
                                                      return;
                                                  }
                                          
                                                  setState(DP.ACTUAL, actual, true);
                                          
                                                  if (Date.now() > suppressActualEchoUntil) {
                                                      setState(DP.SET, actual, true);
                                                  }
                                          
                                                  logx(`Shelly ACTUAL aktualisiert: ${actual}%`);
                                              });
                                          
                                              /********************************************************
                                               * 5) Shelly WRITE/TARGET
                                               ********************************************************/
                                              on({ id: CONFIG.SHELLY_WRITE_ID, change: 'any' }, obj => {
                                                  debugLog(`Shelly WRITE/TARGET Event -> ${fmtState(obj)}`);
                                              });
                                          
                                              logx(`Fertig initialisiert.`);
                                          }
                                          
                                          HomoranH Do not disturb
                                          HomoranH Do not disturb
                                          Homoran
                                          Global Moderator Administrators
                                          wrote on last edited by
                                          #660

                                          @drloksoft sagte:

                                          sondern tatsächlich numerisch 0.

                                          Möglicherweise ist das ein 0/1 für false/true

                                          kein Support per PN! - Fragen im Forum stellen -
                                          Benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                                          Das Forum freut sich über eine Spende. Benutzt dazu den Spendenbutton oben rechts. Danke!
                                          der Installationsfixer: curl -fsL https://iobroker.net/fix.sh | bash -

                                          D 1 Reply Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

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

                                          465

                                          Online

                                          32.8k

                                          Users

                                          82.7k

                                          Topics

                                          1.3m

                                          Posts
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Home
                                          • Recent
                                          • Tags
                                          • Unread 0
                                          • Categories
                                          • Unreplied
                                          • Popular
                                          • GitHub
                                          • Docu
                                          • Hilfe