Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Cloud Dienste
    4. Alexa fragt und verarbeitet die Antwort

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Alexa fragt und verarbeitet die Antwort

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

      Mein Wunsch-Szenario:

      ich sage zu Alexa, schicke mir die Liste und Alexa sagt / fragt "an wen soll ich schicken"?

      Die Antwort von mir würde ich gern im iobroker als Datenpunkt weiterverarbeiten...

      Geht sowas eigentlich?

      VG Alex

      1 Reply Last reply Reply Quote 0
      • R
        Ramses123 last edited by

        Das könnte mit Bespoken funktionieren. Genaues kann ich Dir dazu aber auch nicht sagen, da ich mich da noch nicht eingearbeitet habe.

        1 Reply Last reply Reply Quote 0
        • T
          ticaki Developer last edited by ticaki

          Ausschnitt aus meinem "work in process" "finish sooooon" skript 🙂
          über "on" bekommst du deinen gesprochenen Text.
          mit History.serialNumber bekommst den Echo. Mit Echo-Devices und serialNumber kannst du den angesprochenen Echo steuern.

          Ich kann dir gerne mein Skript bis dato posten, ist aber recht lang, nicht fertig und keine Ahnung ob es der beste Weg ist, das zu machen. Und es ist gedacht um Fragen zu beantworten.

          on({id:'alexa2.0.History.summary'}, function (obj) {
              blabla(obj.state.val);
          });
          //'alexa2.0.History.name'
          //'alexa2.0.Echo-Devices'
          //'alexa2.0.History.serialNumber'
          //'alexa2.0.Echo-Devices.G080SV027434110N.Commands.deviceStop'
          
          function blabla(text) {
          let serial = getState('alexa2.0.History.serialNumber').val;
          setState('alexa2.0.Echo-Devices.'+serial+'.Commands.speak',text);
          }
          
          A 1 Reply Last reply Reply Quote 0
          • A
            Alex975 @ticaki last edited by

            @ticaki Kannst gern das Script schicken / posten...

            T 1 Reply Last reply Reply Quote 0
            • T
              ticaki Developer @Alex975 last edited by ticaki

              @Alex975

              on({id:'alexa2.0.History.summary'}, function (obj) {
                  blabla(obj.state.val);
              });
              //'alexa2.0.History.name'
              //'alexa2.0.Echo-Devices'
              //'alexa2.0.History.serialNumber'
              //'alexa2.0.Echo-Devices.G044SV027432110N.Commands.deviceStop'
              
              function blabla(text) {
                  
                  var a1Token = ['wie','welche','wieviel','wo','ist'];
                  var a2Token= ['warm','kalt','temperatur', 'grad','licht'];
                  var a3Token= ['wohnzimmer','schlafzimmer','bad','badezimmer','küche','balkon','draußen','an','aus']
                  text = text.split(' ');
                  if (!Array.isArray(text)) return;
                  var index1=-1;
                  var index2=-1;
                  var index3=-1;
                  var index4=-1;
                  index1 = a1Token.indexOf(text[0]);
                  if (index1 == -1) index1=a1Token.indexOf(text[1]);
                  if (index1!=-1) {
                      for (let a=1;a<text.length;a++) {
                          index2=a2Token.indexOf(text[a]);
                          if (index2!=-1) {
                              for (a;a<text.length;a++) {
                                  index3=a3Token.indexOf(text[a]);
                                  if (index3!=-1) {
                                      break;
                                  }
                              }
                              break;
                          }           
                      } 
                  }
                  if (index1 == -1) return;
                  var workswith1 = [];
                  var workswith2 = [];
                  var workswith3 = [];
                  switch (index1) { // welche Kombinationen gehen
                      case 0:{
                          workswith1.push(0);
                          workswith1.push(1);
                          workswith1.push(2);
                          workswith1.push(3);
                          workswith2.push(0);
                          workswith2.push(1);
                          workswith2.push(2);
                          workswith2.push(3);
                          workswith2.push(4);
                          workswith2.push(5);
                          workswith2.push(6);
                          break;
                      }
                      case 1:{
                          workswith1.push(0);
                          workswith1.push(1);
                          workswith1.push(2);
                          workswith1.push(3);
                          workswith2.push(0);
                          workswith2.push(1);
                          workswith2.push(2);
                          workswith2.push(3);
                          workswith2.push(4);
                          workswith2.push(5);
                          workswith2.push(6);
                          break;
                      }
                      case 2:{
                          workswith1.push(0);
                          workswith1.push(1);
                          workswith1.push(2);
                          workswith1.push(3);
                          workswith2.push(0);
                          workswith2.push(1);
                          workswith2.push(2);
                          workswith2.push(3);
                          workswith2.push(4);
                          workswith2.push(5);
                          workswith2.push(6);
                          break;
                      }
                      case 3:{
                          workswith1.push(0);
                          workswith1.push(1);
                          workswith1.push(2);
                          workswith1.push(3);
                          workswith2.push(0);
                          workswith2.push(1);
                          workswith2.push(2);
                          workswith2.push(3);
                          workswith2.push(4);
                          workswith2.push(5);
                          workswith2.push(6);
                          break;
                      }
                      case 4:{
                          workswith1.push(4);
                          workswith2.push(7);
                          workswith2.push(8);
                          break;
                      }
                      case 5:{
                          workswith1.push(4);
                          workswith2.push(0);
                          workswith2.push(1);
                          workswith2.push(2);
                          workswith2.push(3);
                          workswith2.push(4);
                          workswith2.push(5);
                          workswith2.push(6);
                          workswith3.push(1);
                          workswith3.push(2);
                          break;
                      }
                  }
                  var value1;
                  var value2;
                  var value3;
                  if (workswith1.indexOf(index2)==-1) return; 
                  if (workswith2.length!=0 && workswith2.indexOf(index3)==-1) return;
                  if (workswith3.length!=0 && workswith3.indexOf(index4)==-1) return; 
                  let serial = getState('alexa2.0.History.serialNumber').val;    
                  if (serial == 'G034LF11740607K3') serial = 'G032SV027432110N';
                  let Speaktext = '';
                  switch (index2) {
                      case 0:
                      case 1:
                      case 2:
                      case 3: { //Temperatur
                          switch (index3) {
                              case 0:{
                                  value1=getState('linkeddevices.0.Haus.Obergeschoss.Wohnzimmer.Temperatur').val;
                                  value2='im Wohnzimmer.';
                                  break;
                              }
                              case 1:{
                                  value1=getState('linkeddevices.0.Haus.Obergeschoss.Schlafzimmer.Temperatur').val;
                                  value2='im Schlafzimmer.';
                                  break;
                              }
                              case 2:
                              case 3:{
                                  value1=getState('linkeddevices.0.Haus.Obergeschoss.Bad.Temperatur').val;
                                  let a=Math.round(Math.random()*1002)%3;
                                  if (a==2) value2='im Badezimmer';
                                  else if (a==1) value2=' auf der Toilette';
                                  else value2='im Bad.';
                                  break;
                              }
                              case 4:{
                                  value1=getState('linkeddevices.0.Haus.Obergeschoss.Kueche.Temperatur').val;
                                  value2='in der Küche.';
                                  break;
                              }
                              case 5:
                              case 6:{
                                  value1=getState('linkeddevices.0.Haus.Balkon.Temperatur').val;
                                  value2='auf dem Balkon.';
                                  break;
                              }
                          }
                          value1 = Math.round(value1*10)/10;
                          let a=Math.round(Math.random()*1000)%10;
                          let speaktext='';
                          switch (a) {
                              case 0:
                              case 1:
                              case 2:
                              case 3:{
                                  speaktext='Es sind '+value1+' Grad '+value2;
                                  break;
                              }
                              case 4:
                              case 5:
                              case 6:
                              case 7:
                              case 8:{
                                  speaktext='Wir haben '+value1+' Grad '+value2;
                                  break;
                              }
                              case 9:{
                                  if (value1<-10) speaktext='Es is bitterkalt '+value2;
                                  else if (value1<0) speaktext='Es friert '+value2;
                                  else if (value1<13) speaktext='Es ziemlich frisch '+value2;
                                  else if (value1<17) speaktext='Es is kühl '+value2;
                                  else if (value1<21) speaktext='Es geht so '+value2;
                                  else if (value1<24) speaktext='Es ist angenehm '+value2;
                                  else if (value1<28) speaktext='Es is warm '+value2;
                                  else if (value1<33) speaktext='Es is sehr warm '+value2;
                                  else speaktext='Boah ist das heiß '+value2;
                                  break;
                              }
              
                          }                    
                          setState('alexa2.0.Echo-Devices.'+serial+'.Commands.speak',speaktext);
                          log('alexa2.0.Echo-Devices.'+serial+'.Commands.speak');
                          log(speaktext);
                          break;
                      }
                      case 4: { // licht wo an.     
                      }
                      case 5: { //Licht an/aus ja/nein
                      }
                      default:
                      return;
                  }
              }
              
              A 1 Reply Last reply Reply Quote 0
              • A
                Alex975 @ticaki last edited by

                @ticaki Danke erstmal..

                T 1 Reply Last reply Reply Quote 0
                • T
                  ticaki Developer @Alex975 last edited by ticaki

                  @Alex975
                  Nun, um deine ursprüngliche Frage zu beantworten, reicht aber eigentlich mein erstes Posting. Über

                  alexa2.0.History.summary
                  

                  erhälst du alles, was du zu Alexa sagst. Ich weiß nur nicht wie man an das kommt was Alexa zu mir sagt.

                  haselchen 1 Reply Last reply Reply Quote 0
                  • haselchen
                    haselchen Most Active @ticaki last edited by

                    @ticaki

                    Könntest du über eine Routine in der Alexa App lösen.

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

                    Support us

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

                    369
                    Online

                    32.0k
                    Users

                    80.4k
                    Topics

                    1.3m
                    Posts

                    alexa
                    4
                    8
                    1189
                    Loading More Posts
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes
                    Reply
                    • Reply as topic
                    Log in to reply
                    Community
                    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                    The ioBroker Community 2014-2023
                    logo