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. Skripten / Logik
  4. JavaScript
  5. Spülmaschinen Abfrage mit Ausgabe über Alexa Geräte

NEWS

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

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

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

Spülmaschinen Abfrage mit Ausgabe über Alexa Geräte

Scheduled Pinned Locked Moved JavaScript
10 Posts 3 Posters 414 Views 2 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.
  • D Offline
    D Offline
    d3adycool
    wrote on last edited by
    #1

    Hallo zusammen,

    ich habe ein Script mit Hilfe der Ai erstellt, welche den Status der Tür meiner Spülmaschine und den Programmfortschritt abfrägt. Status Tür (Open, Closed) und 100 als Wert zusammen soll eine Ausgabe Spülmaschine ist fertig ausgeben. Das Script schmeisst keinen Fehler aus aber die Alexas bleiben Stumm. Anbei das Script: Vielleicht hat ja jemand eine Idee. Damit das ganze nicht zu viele Ressourcen braucht soll die Abfrage alle Minute stattfinden erstmal zum testen, später reicht es alle 5-10 minuten.
    Ausserdem soll zwischen 21 und 8 uhr keine nachricht erfolgen.
    Beid er Spülmaschine handelt es sich um eine Siemens IQ300. Der Hintergrund warum ich den Programmfortschritt abgfrage ist da es keinen Wert gibt der mir sagt ob die Spülmaschine fertig ist oder nicht.

    vielen Dank schonmal für die Hilfe von Euch

    // Konfiguration
    const targetDevice = "homeconnect.0.014060394661007096";
    const doorStateId = `${targetDevice}.status.BSH_Common_Status_DoorState`;
    const programProgressId = `${targetDevice}.programs.active.options.BSH_Common_Option_ProgramProgress`;
    const alexaDevices = [
        "alexa2.0.Echo-Devices.G2A0U204838204UE",
        "alexa2.0.Echo-Devices.G090U610902505SE"
    ];
    
    // Zustand speichern, um Änderungen zu erkennen
    let lastDoorState = getState(doorStateId).val;
    
    // Funktion zum Senden einer Nachricht an Alexa
    function sendAlexaMessage(message) {
        try {
            alexa2.setState(alexaDevices, { text: message });
        } catch (error) {
            log.error(`Fehler beim Senden der Nachricht an Alexa: ${error}`);
        }
    }
    
    // Funktion zur Überprüfung der Uhrzeit
    function isBetweenHours(start, end) {
        const now = new Date();
        const hour = now.getHours();
        return hour >= start && hour < end;
    }
    
    // Hauptfunktion
    function checkSpuelmaschine() {
        try {
            const currentDoorState = getState(doorStateId).val;
            const programProgress = getState(programProgressId).val;
    
            // Nur reagieren, wenn sich der Türzustand von geschlossen auf geöffnet ändert und der Programmfortschritt bei 100% liegt
            if (currentDoorState === "Open" && lastDoorState === "Closed" && programProgress === 100) {
                // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                if (!isBetweenHours(21, 8)) {
                    sendAlexaMessage("Spülmaschine ist fertig");
                }
            }
    
            // Aktuellen Türzustand speichern
            lastDoorState = currentDoorState;
        } catch (error) {
            log.error(`Fehler beim Überprüfen der Spülmaschine: ${error}`);
        }
    }
    
    // Skript alle 1 Minuten ausführen
    setInterval(checkSpuelmaschine, 1 * 60 * 1000);
    
    paul53P sigi234S 3 Replies Last reply
    0
    • D d3adycool

      Hallo zusammen,

      ich habe ein Script mit Hilfe der Ai erstellt, welche den Status der Tür meiner Spülmaschine und den Programmfortschritt abfrägt. Status Tür (Open, Closed) und 100 als Wert zusammen soll eine Ausgabe Spülmaschine ist fertig ausgeben. Das Script schmeisst keinen Fehler aus aber die Alexas bleiben Stumm. Anbei das Script: Vielleicht hat ja jemand eine Idee. Damit das ganze nicht zu viele Ressourcen braucht soll die Abfrage alle Minute stattfinden erstmal zum testen, später reicht es alle 5-10 minuten.
      Ausserdem soll zwischen 21 und 8 uhr keine nachricht erfolgen.
      Beid er Spülmaschine handelt es sich um eine Siemens IQ300. Der Hintergrund warum ich den Programmfortschritt abgfrage ist da es keinen Wert gibt der mir sagt ob die Spülmaschine fertig ist oder nicht.

      vielen Dank schonmal für die Hilfe von Euch

      // Konfiguration
      const targetDevice = "homeconnect.0.014060394661007096";
      const doorStateId = `${targetDevice}.status.BSH_Common_Status_DoorState`;
      const programProgressId = `${targetDevice}.programs.active.options.BSH_Common_Option_ProgramProgress`;
      const alexaDevices = [
          "alexa2.0.Echo-Devices.G2A0U204838204UE",
          "alexa2.0.Echo-Devices.G090U610902505SE"
      ];
      
      // Zustand speichern, um Änderungen zu erkennen
      let lastDoorState = getState(doorStateId).val;
      
      // Funktion zum Senden einer Nachricht an Alexa
      function sendAlexaMessage(message) {
          try {
              alexa2.setState(alexaDevices, { text: message });
          } catch (error) {
              log.error(`Fehler beim Senden der Nachricht an Alexa: ${error}`);
          }
      }
      
      // Funktion zur Überprüfung der Uhrzeit
      function isBetweenHours(start, end) {
          const now = new Date();
          const hour = now.getHours();
          return hour >= start && hour < end;
      }
      
      // Hauptfunktion
      function checkSpuelmaschine() {
          try {
              const currentDoorState = getState(doorStateId).val;
              const programProgress = getState(programProgressId).val;
      
              // Nur reagieren, wenn sich der Türzustand von geschlossen auf geöffnet ändert und der Programmfortschritt bei 100% liegt
              if (currentDoorState === "Open" && lastDoorState === "Closed" && programProgress === 100) {
                  // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                  if (!isBetweenHours(21, 8)) {
                      sendAlexaMessage("Spülmaschine ist fertig");
                  }
              }
      
              // Aktuellen Türzustand speichern
              lastDoorState = currentDoorState;
          } catch (error) {
              log.error(`Fehler beim Überprüfen der Spülmaschine: ${error}`);
          }
      }
      
      // Skript alle 1 Minuten ausführen
      setInterval(checkSpuelmaschine, 1 * 60 * 1000);
      
      paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by paul53
      #2

      @d3adycool sagte: Alexas bleiben Stumm.

      Man kann an setState(id, val) kein ID-Array übergeben, sondern man muss zwei setState() verwenden. Die Funktion alexa2.setState() kenne ich nicht, mit Alexa kenne ich mich allerdings nicht aus.

      Es wird geprüft, ob die Tür geöffnet wurde. Dafür verwendet man einen Trigger auf doorStateId anstelle eines Intervalls.

      Es gibt eine Funktion compareTime() des Javascript-Adapters.

      Bei "homeconnect" sind die Werte nicht "Open" und "Closed", sondern viel längere Strings. Schau die OBJEKTDATEN des Datenpunktes "Doorstate" an.

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      D 1 Reply Last reply
      0
      • paul53P paul53

        @d3adycool sagte: Alexas bleiben Stumm.

        Man kann an setState(id, val) kein ID-Array übergeben, sondern man muss zwei setState() verwenden. Die Funktion alexa2.setState() kenne ich nicht, mit Alexa kenne ich mich allerdings nicht aus.

        Es wird geprüft, ob die Tür geöffnet wurde. Dafür verwendet man einen Trigger auf doorStateId anstelle eines Intervalls.

        Es gibt eine Funktion compareTime() des Javascript-Adapters.

        Bei "homeconnect" sind die Werte nicht "Open" und "Closed", sondern viel längere Strings. Schau die OBJEKTDATEN des Datenpunktes "Doorstate" an.

        D Offline
        D Offline
        d3adycool
        wrote on last edited by
        #3

        @paul53 Danke für diene schnelle Antwort aber ich setze ja nirgends einen Status ich frage diese ja nur mit einem getState ab.
        Du meinst also das ich den gesamten String (BSH.Common.EnumType.DoorState.Open)
        respektive
        (BSH.Common.EnumType.DoorState.Closed) im Code Abfragen muss.
        Sorry für die laienhaften Fragen aber bin da echt ein Noob auf dem Gebiet ;-)

        paul53P 1 Reply Last reply
        0
        • D d3adycool

          @paul53 Danke für diene schnelle Antwort aber ich setze ja nirgends einen Status ich frage diese ja nur mit einem getState ab.
          Du meinst also das ich den gesamten String (BSH.Common.EnumType.DoorState.Open)
          respektive
          (BSH.Common.EnumType.DoorState.Closed) im Code Abfragen muss.
          Sorry für die laienhaften Fragen aber bin da echt ein Noob auf dem Gebiet ;-)

          paul53P Offline
          paul53P Offline
          paul53
          wrote on last edited by paul53
          #4

          @d3adycool sagte: Du meinst also das ich den gesamten String (BSH.Common.EnumType.DoorState.Open) respektive (BSH.Common.EnumType.DoorState.Closed) im Code Abfragen muss.

          Ja, das ist der Wert des Datenpunktes. Etwa so:

          // Konfiguration
          const targetDevice = "homeconnect.0.014060394661007096";
          const doorStateId = `${targetDevice}.status.BSH_Common_Status_DoorState`;
          const programProgressId = `${targetDevice}.programs.active.options.BSH_Common_Option_ProgramProgress`;
          const alexaDevice1 = "alexa2.0.Echo-Devices.G2A0U204838204UE";
          const alexaDevice2 = "alexa2.0.Echo-Devices.G090U610902505SE";
          
          // Funktion zum Senden einer Nachricht an Alexa
          function sendAlexaMessage(message) {
              setState(alexaDevice1 + '.Commands.speak', message);
              setState(alexaDevice2 + '.Commands.speak', message);
          }
           
          // Hauptfunktion
          on(doorStateId, function(dp) {
              const programProgress = getState(programProgressId).val;
              if (dp.state.val === "BSH.Common.EnumType.DoorState.Open" && programProgress === 100) {
                  // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                      if (compareTime('8:00', '21:00', 'between')) {
                          sendAlexaMessage("Spülmaschine ist fertig");
                      }
                  }
          });
          

          Enthält "ProgramProgress" einen Prozentwert und ist vom Typ "Zahl" (number).

          Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
          Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

          D 1 Reply Last reply
          0
          • paul53P paul53

            @d3adycool sagte: Du meinst also das ich den gesamten String (BSH.Common.EnumType.DoorState.Open) respektive (BSH.Common.EnumType.DoorState.Closed) im Code Abfragen muss.

            Ja, das ist der Wert des Datenpunktes. Etwa so:

            // Konfiguration
            const targetDevice = "homeconnect.0.014060394661007096";
            const doorStateId = `${targetDevice}.status.BSH_Common_Status_DoorState`;
            const programProgressId = `${targetDevice}.programs.active.options.BSH_Common_Option_ProgramProgress`;
            const alexaDevice1 = "alexa2.0.Echo-Devices.G2A0U204838204UE";
            const alexaDevice2 = "alexa2.0.Echo-Devices.G090U610902505SE";
            
            // Funktion zum Senden einer Nachricht an Alexa
            function sendAlexaMessage(message) {
                setState(alexaDevice1 + '.Commands.speak', message);
                setState(alexaDevice2 + '.Commands.speak', message);
            }
             
            // Hauptfunktion
            on(doorStateId, function(dp) {
                const programProgress = getState(programProgressId).val;
                if (dp.state.val === "BSH.Common.EnumType.DoorState.Open" && programProgress === 100) {
                    // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                        if (compareTime('8:00', '21:00', 'between')) {
                            sendAlexaMessage("Spülmaschine ist fertig");
                        }
                    }
            });
            

            Enthält "ProgramProgress" einen Prozentwert und ist vom Typ "Zahl" (number).

            D Offline
            D Offline
            d3adycool
            wrote on last edited by
            #5

            @paul53 said in Spülmaschinen Abfrage mit Ausgabe über Alexa Geräte:

            on(doorStateId, function(dp) { const programProgress = getState(programProgressId).val; if (dp.state.val === "BSH.Common.EnumType.DoorState.Open" && dp.oldState.val === "BSH.Common.EnumType.DoorState.Closed" && programProgress === 100) { // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt if (compareTime('8:00', '21:00', 'not between')) { sendAlexaMessage("Spülmaschine ist fertig"); } }

            sofern ich das sehen kann ist das ein reiner Zahlenwert.

            Verstehe ich das richtig, dass ich den Codeschnippsel

            // Hauptfunktion
            function checkSpuelmaschine() {
                try {
                    const currentDoorState = getState(doorStateId).val;
                    const programProgress = getState(programProgressId).val;
            
                    // Nur reagieren, wenn sich der Türzustand von geschlossen auf geöffnet ändert und der Programmfortschritt bei 100% liegt
                    if (currentDoorState === "Open" && lastDoorState === "Closed" && programProgress === 100) {
                        // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                        if (!isBetweenHours(21, 8)) {
                            sendAlexaMessage("Spülmaschine ist fertig");
                        }
                    }
            
                    // Aktuellen Türzustand speichern
                    lastDoorState = currentDoorState;
                } catch (error) {
                    log.error(`Fehler beim Überprüfen der Spülmaschine: ${error}`);
                }
            }
            

            mit deinem hier ersetzen soll, damit es läuft ?!

            Das ist der Wert aus den Objekten
            2024-09-12 19_33_02-objects - raspberrypi.png

            paul53P 1 Reply Last reply
            0
            • D d3adycool

              @paul53 said in Spülmaschinen Abfrage mit Ausgabe über Alexa Geräte:

              on(doorStateId, function(dp) { const programProgress = getState(programProgressId).val; if (dp.state.val === "BSH.Common.EnumType.DoorState.Open" && dp.oldState.val === "BSH.Common.EnumType.DoorState.Closed" && programProgress === 100) { // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt if (compareTime('8:00', '21:00', 'not between')) { sendAlexaMessage("Spülmaschine ist fertig"); } }

              sofern ich das sehen kann ist das ein reiner Zahlenwert.

              Verstehe ich das richtig, dass ich den Codeschnippsel

              // Hauptfunktion
              function checkSpuelmaschine() {
                  try {
                      const currentDoorState = getState(doorStateId).val;
                      const programProgress = getState(programProgressId).val;
              
                      // Nur reagieren, wenn sich der Türzustand von geschlossen auf geöffnet ändert und der Programmfortschritt bei 100% liegt
                      if (currentDoorState === "Open" && lastDoorState === "Closed" && programProgress === 100) {
                          // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                          if (!isBetweenHours(21, 8)) {
                              sendAlexaMessage("Spülmaschine ist fertig");
                          }
                      }
              
                      // Aktuellen Türzustand speichern
                      lastDoorState = currentDoorState;
                  } catch (error) {
                      log.error(`Fehler beim Überprüfen der Spülmaschine: ${error}`);
                  }
              }
              

              mit deinem hier ersetzen soll, damit es läuft ?!

              Das ist der Wert aus den Objekten
              2024-09-12 19_33_02-objects - raspberrypi.png

              paul53P Offline
              paul53P Offline
              paul53
              wrote on last edited by
              #6

              @d3adycool sagte: ersetzen soll, damit es läuft ?!

              Ja, nur hab ich keine Ahnung, ob die Alexa-Funktion so funktioniert.

              Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
              Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

              D 1 Reply Last reply
              0
              • paul53P paul53

                @d3adycool sagte: ersetzen soll, damit es läuft ?!

                Ja, nur hab ich keine Ahnung, ob die Alexa-Funktion so funktioniert.

                D Offline
                D Offline
                d3adycool
                wrote on last edited by
                #7

                @paul53 wie müsste man es denn machen das sie spricht.
                Vermutlich alles ummodeln

                1 Reply Last reply
                0
                • D d3adycool

                  Hallo zusammen,

                  ich habe ein Script mit Hilfe der Ai erstellt, welche den Status der Tür meiner Spülmaschine und den Programmfortschritt abfrägt. Status Tür (Open, Closed) und 100 als Wert zusammen soll eine Ausgabe Spülmaschine ist fertig ausgeben. Das Script schmeisst keinen Fehler aus aber die Alexas bleiben Stumm. Anbei das Script: Vielleicht hat ja jemand eine Idee. Damit das ganze nicht zu viele Ressourcen braucht soll die Abfrage alle Minute stattfinden erstmal zum testen, später reicht es alle 5-10 minuten.
                  Ausserdem soll zwischen 21 und 8 uhr keine nachricht erfolgen.
                  Beid er Spülmaschine handelt es sich um eine Siemens IQ300. Der Hintergrund warum ich den Programmfortschritt abgfrage ist da es keinen Wert gibt der mir sagt ob die Spülmaschine fertig ist oder nicht.

                  vielen Dank schonmal für die Hilfe von Euch

                  // Konfiguration
                  const targetDevice = "homeconnect.0.014060394661007096";
                  const doorStateId = `${targetDevice}.status.BSH_Common_Status_DoorState`;
                  const programProgressId = `${targetDevice}.programs.active.options.BSH_Common_Option_ProgramProgress`;
                  const alexaDevices = [
                      "alexa2.0.Echo-Devices.G2A0U204838204UE",
                      "alexa2.0.Echo-Devices.G090U610902505SE"
                  ];
                  
                  // Zustand speichern, um Änderungen zu erkennen
                  let lastDoorState = getState(doorStateId).val;
                  
                  // Funktion zum Senden einer Nachricht an Alexa
                  function sendAlexaMessage(message) {
                      try {
                          alexa2.setState(alexaDevices, { text: message });
                      } catch (error) {
                          log.error(`Fehler beim Senden der Nachricht an Alexa: ${error}`);
                      }
                  }
                  
                  // Funktion zur Überprüfung der Uhrzeit
                  function isBetweenHours(start, end) {
                      const now = new Date();
                      const hour = now.getHours();
                      return hour >= start && hour < end;
                  }
                  
                  // Hauptfunktion
                  function checkSpuelmaschine() {
                      try {
                          const currentDoorState = getState(doorStateId).val;
                          const programProgress = getState(programProgressId).val;
                  
                          // Nur reagieren, wenn sich der Türzustand von geschlossen auf geöffnet ändert und der Programmfortschritt bei 100% liegt
                          if (currentDoorState === "Open" && lastDoorState === "Closed" && programProgress === 100) {
                              // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                              if (!isBetweenHours(21, 8)) {
                                  sendAlexaMessage("Spülmaschine ist fertig");
                              }
                          }
                  
                          // Aktuellen Türzustand speichern
                          lastDoorState = currentDoorState;
                      } catch (error) {
                          log.error(`Fehler beim Überprüfen der Spülmaschine: ${error}`);
                      }
                  }
                  
                  // Skript alle 1 Minuten ausführen
                  setInterval(checkSpuelmaschine, 1 * 60 * 1000);
                  
                  paul53P Offline
                  paul53P Offline
                  paul53
                  wrote on last edited by paul53
                  #8

                  @d3adycool sagte: Der Hintergrund warum ich den Programmfortschritt abgfrage ist da es keinen Wert gibt der mir sagt ob die Spülmaschine fertig ist oder nicht.

                  Genügt der Programmfortschritt nicht, um "Spülmaschine ist fertig" festzustellen?

                  on({id: programProgressId, change: 'gt', val: 100}, function() {
                      if (compareTime('8:00', '21:00', 'between')) {
                          sendAlexaMessage("Spülmaschine ist fertig");
                      }
                  });
                  

                  Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
                  Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

                  1 Reply Last reply
                  0
                  • paul53P Offline
                    paul53P Offline
                    paul53
                    wrote on last edited by paul53
                    #9

                    @d3adycool sagte: wie müsste man es denn machen das sie spricht.

                    Wie bereits geschrieben: Von Alexa habe ich keine Ahnung. Es gibt eine Beschreibung zum Adapter.
                    Habe oben den Programm-Code angepasst.

                    Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
                    Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

                    1 Reply Last reply
                    0
                    • D d3adycool

                      Hallo zusammen,

                      ich habe ein Script mit Hilfe der Ai erstellt, welche den Status der Tür meiner Spülmaschine und den Programmfortschritt abfrägt. Status Tür (Open, Closed) und 100 als Wert zusammen soll eine Ausgabe Spülmaschine ist fertig ausgeben. Das Script schmeisst keinen Fehler aus aber die Alexas bleiben Stumm. Anbei das Script: Vielleicht hat ja jemand eine Idee. Damit das ganze nicht zu viele Ressourcen braucht soll die Abfrage alle Minute stattfinden erstmal zum testen, später reicht es alle 5-10 minuten.
                      Ausserdem soll zwischen 21 und 8 uhr keine nachricht erfolgen.
                      Beid er Spülmaschine handelt es sich um eine Siemens IQ300. Der Hintergrund warum ich den Programmfortschritt abgfrage ist da es keinen Wert gibt der mir sagt ob die Spülmaschine fertig ist oder nicht.

                      vielen Dank schonmal für die Hilfe von Euch

                      // Konfiguration
                      const targetDevice = "homeconnect.0.014060394661007096";
                      const doorStateId = `${targetDevice}.status.BSH_Common_Status_DoorState`;
                      const programProgressId = `${targetDevice}.programs.active.options.BSH_Common_Option_ProgramProgress`;
                      const alexaDevices = [
                          "alexa2.0.Echo-Devices.G2A0U204838204UE",
                          "alexa2.0.Echo-Devices.G090U610902505SE"
                      ];
                      
                      // Zustand speichern, um Änderungen zu erkennen
                      let lastDoorState = getState(doorStateId).val;
                      
                      // Funktion zum Senden einer Nachricht an Alexa
                      function sendAlexaMessage(message) {
                          try {
                              alexa2.setState(alexaDevices, { text: message });
                          } catch (error) {
                              log.error(`Fehler beim Senden der Nachricht an Alexa: ${error}`);
                          }
                      }
                      
                      // Funktion zur Überprüfung der Uhrzeit
                      function isBetweenHours(start, end) {
                          const now = new Date();
                          const hour = now.getHours();
                          return hour >= start && hour < end;
                      }
                      
                      // Hauptfunktion
                      function checkSpuelmaschine() {
                          try {
                              const currentDoorState = getState(doorStateId).val;
                              const programProgress = getState(programProgressId).val;
                      
                              // Nur reagieren, wenn sich der Türzustand von geschlossen auf geöffnet ändert und der Programmfortschritt bei 100% liegt
                              if (currentDoorState === "Open" && lastDoorState === "Closed" && programProgress === 100) {
                                  // Prüfe, ob die Uhrzeit zwischen 21:00 und 08:00 Uhr liegt
                                  if (!isBetweenHours(21, 8)) {
                                      sendAlexaMessage("Spülmaschine ist fertig");
                                  }
                              }
                      
                              // Aktuellen Türzustand speichern
                              lastDoorState = currentDoorState;
                          } catch (error) {
                              log.error(`Fehler beim Überprüfen der Spülmaschine: ${error}`);
                          }
                      }
                      
                      // Skript alle 1 Minuten ausführen
                      setInterval(checkSpuelmaschine, 1 * 60 * 1000);
                      
                      sigi234S Online
                      sigi234S Online
                      sigi234
                      Forum Testing Most Active
                      wrote on last edited by
                      #10

                      @d3adycool

                      Nimm mal diesen DP als Ansage:

                      alexa2.0.Echo-Devices.XXXXXXXXXXXX.Commands.speak
                      

                      Bitte benutzt das Voting rechts unten im Beitrag wenn er euch geholfen hat.
                      Immer Daten sichern!

                      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

                      753

                      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