Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Alexa2 Adapter über RESTapi ansprechen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Alexa2 Adapter über RESTapi ansprechen

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

      Moin zusammen.
      Ich versuche, einen Alexa Wecker über den SimpleAPI-Adapter per PHP-Script zu stellen.

      Grundsätzlich funktioniert es, aber gelegentlich kommt eine Fehlermeldung, die für mich so aussieht, als ob an dem abgesetzten Befehl irgendetwas falsch ist und das stellen des Weckers schlägt fehl.

      Was mich wundert. Wenn der Befehl nicht funktioniert, klappt auch das manuelle Stellen des States über die Admin-Oberfläche nicht mehr.
      Der State wechselt kurz zu true und dann gleich wieder auf false.
      Also ist möglicherweise nix an meinem Script fehlerhaft sondern der Alexa2-Adapter schuld?

      das ist die Meldung im log

      2020-09-27 10:30:39.353 - debug: alexa2.0 (9977) Alexa-Remote: Response: {"message":"Some form of illegal argument exception when trying to update notification id = A3S5BH2HU6VAYF-G090LF0971540JCP-266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8"}
      

      das ist der Befehl der davor vom Alexa2 Adapter gesendet wurde.

      2020-09-27 10:30:38.989 - debug: alexa2.0 (9977) Alexa-Remote: Sending Request with {"host":"alexa.amazon.de","path":"/api/notifications/A3S5BH2HU6VAYF-G090LF0971540JCP-266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","method":"PUT","timeout":10000,"headers":{}} and data={"alarmTime":1601098200783,"automationId":null,"createdDate":1601074052119,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"G090LF0971540JCP","deviceType":"A3S5BH2HU6VAYF","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A3S5BH2HU6VAYF-G090LF0971540JCP-266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"loopCount":null,"mrmGroupContext":null,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","originalDate":"2020-09-27","originalTime":"07:30:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":null,"remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Pulsar","folder":null,"id":"system_alerts_rhythmic_02","isChildDirected":false,"pricing":null,"providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_rhythmic_02.mp3"},"status":"ON","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"19"}
      

      falls noch wichtig, das PHP-Script sendet an den Simple-API-Adapter folgenden Befehl

      echo (executeRESTCall('GET', 'http://192.168.10.3:8087/set/alexa2.0.Echo-Devices.' . $echoID . '.Alarm.New?value=' . $AlarmMicha));
      

      Mit der entsprechenden ID vom Echo und der Zeit im Format HH:mm.

      Die executeRESTCall-Funktion hab ich im Netz gefunden und sieht so aus

      <?php
      function executeRESTCall($methode, $adresse, $daten = false) {
          $curl = curl_init();
          curl_setopt($curl, CURLOPT_URL, $adresse);
          curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $methode);
          if ($daten){
              $head = ['Content-Type: application/text', 
                       'Content-Length: '. strlen($daten)];
              curl_setopt($curl, CURLOPT_HTTPHEADER, $head);
              curl_setopt($curl, CURLOPT_POSTFIELDS, $daten);
          }
          curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
          return curl_exec($curl);
      }
      ?>
      
      1 Reply Last reply Reply Quote 0
      • S
        Supermicha last edited by

        Nachtrag:
        Habe nochmal das Log beobachtet, wenn ich manuell in der Admin-Oberfläche schalte kommt der gleiche Fehler. Hier mal das komplette Log dazu.

        denke es ist ein Problem zwischen Alexa und dem Alexa2 Adapter.

        2020-09-27 10:55:22.196 - debug: alexa2.0 (9977) State changed alexa2.0.Echo-Devices.G090LF0971540JCP.Alarm.266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8.enabled: {"val":true,"ack":false,"ts":1601196922190,"q":0,"from":"system.adapter.admin.0","user":"system.user.admin","lc":1601196922190}
        2020-09-27 10:55:22.197 - debug: alexa2.0 (9977) Alexa-Remote: No authentication check needed (time elapsed 28478)
        2020-09-27 10:55:22.197 - debug: alexa2.0 (9977) Alexa-Remote: Sending Request with {"host":"alexa.amazon.de","path":"/api/notifications/A3S5BH2HU6VAYF-G090LF0971540JCP-266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","method":"PUT","timeout":10000,"headers":{}} and data={"alarmTime":1601098200783,"automationId":null,"createdDate":1601074052119,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"G090LF0971540JCP","deviceType":"A3S5BH2HU6VAYF","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A3S5BH2HU6VAYF-G090LF0971540JCP-266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"loopCount":null,"mrmGroupContext":null,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","originalDate":"2020-09-27","originalTime":"07:30:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":null,"remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Pulsar","folder":null,"id":"system_alerts_rhythmic_02","isChildDirected":false,"pricing":null,"providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_rhythmic_02.mp3"},"status":"ON","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"22"}
        2020-09-27 10:55:22.633 - debug: alexa2.0 (9977) Alexa-Remote: Response: {"message":"Some form of illegal argument exception when trying to update notification id = A3S5BH2HU6VAYF-G090LF0971540JCP-266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8"}
        2020-09-27 10:55:22.722 - debug: alexa2.0 (9977) Alexa-Remote WS-MQTT: Command PUSH_NOTIFICATION_CHANGE: {
        "destinationUserId": "A24BNO562L1YAB",
        "dopplerId": {
        "deviceType": "A3S5BH2HU6VAYF",
        "deviceSerialNumber": "G090LF0971540JCP"
        },
        "notificationId": "266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8",
        "notificationVersion": 23,
        "eventType": "UPDATE"
        }
        2020-09-27 10:55:22.725 - debug: alexa2.0 (9977) notification-change: {"destinationUserId":"A24BNO562L1YAB","deviceSerialNumber":"G090LF0971540JCP","deviceType":"A3S5BH2HU6VAYF","eventType":"UPDATE","notificationId":"266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","notificationVersion":23}
        
        
        1 Reply Last reply Reply Quote 0
        • S
          Supermicha last edited by

          Sorry, noch ein Nachtrag:

          sosieht das Log aus, wenn der Befehl korrekt angenommen wird

          2020-09-27 11:04:39.211 - debug: alexa2.0 (8631) State changed alexa2.0.Echo-Devices.G090LF0971540JCP.Alarm.265b0b37-1a7b-45ac-8823-89edb20ddbc9.enabled: {"val":true,"ack":false,"ts":1601197479206,"q":0,"from":"system.adapter.simple-api.0","user":"system.user.admin","lc":1601197479206}
          2020-09-27 11:04:39.212 - debug: alexa2.0 (8631) Alexa-Remote: No authentication check needed (time elapsed 244144)
          2020-09-27 11:04:39.214 - debug: alexa2.0 (8631) Alexa-Remote: Sending Request with {"host":"alexa.amazon.de","path":"/api/notifications/A3S5BH2HU6VAYF-G090LF0971540JCP-265b0b37-1a7b-45ac-8823-89edb20ddbc9","method":"PUT","timeout":10000,"headers":{}} and data={"alarmTime":1601267400522,"automationId":null,"createdDate":1601071844013,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"G090LF0971540JCP","deviceType":"A3S5BH2HU6VAYF","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A3S5BH2HU6VAYF-G090LF0971540JCP-265b0b37-1a7b-45ac-8823-89edb20ddbc9","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"loopCount":null,"mrmGroupContext":null,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"265b0b37-1a7b-45ac-8823-89edb20ddbc9","originalDate":"2020-09-28","originalTime":"06:30:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":null,"remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Pulsar","folder":null,"id":"system_alerts_rhythmic_02","isChildDirected":false,"pricing":null,"providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_rhythmic_02.mp3"},"status":"ON","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"49"}
          2020-09-27 11:04:39.674 - debug: alexa2.0 (8631) Alexa-Remote WS-MQTT: Command PUSH_NOTIFICATION_CHANGE: {
          "destinationUserId": "A24BNO562L1YAB",
          "dopplerId": {
          "deviceType": "A3S5BH2HU6VAYF",
          "deviceSerialNumber": "G090LF0971540JCP"
          },
          "notificationId": "265b0b37-1a7b-45ac-8823-89edb20ddbc9",
          "notificationVersion": 50,
          "eventType": "UPDATE"
          }
          2020-09-27 11:04:39.675 - debug: alexa2.0 (8631) notification-change: {"destinationUserId":"A24BNO562L1YAB","deviceSerialNumber":"G090LF0971540JCP","deviceType":"A3S5BH2HU6VAYF","eventType":"UPDATE","notificationId":"265b0b37-1a7b-45ac-8823-89edb20ddbc9","notificationVersion":50}
          2020-09-27 11:04:39.727 - debug: alexa2.0 (8631) Alexa-Remote: Response: {"alarmTime":1601267400522,"automationId":null,"createdDate":1601071844013,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"G090LF0971540JCP","deviceType":"A3S5BH2HU6VAYF","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A3S5BH2HU6VAYF-G090LF0971540JCP-265b0b37-1a7b-45ac-8823-89edb20ddbc9","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"loopCount":null,"mrmGroupContext":null,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"265b0b37-1a7b-45ac-8823-89edb20ddbc9","originalDate":"2020-09-28","originalTime":"06:30:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":null,"remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Pulsar","folder":null,"id":"system_alerts_rhythmic_02","isChildDirected":false,"pricing":null,"providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_rhythmic_02.mp3"},"status":"ON","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"51"}
          
          1 Reply Last reply Reply Quote 0
          • S
            Supermicha last edited by

            noch ein Nachtrag:

            Ich denke ich hab den Fehler identifiziert:

            bei dem Wecker der korrekt gestellt wurde stand im Befehl den der Alexa2-Adapter gesendet hat:

            "notificationIndex":"265b0b37-1a7b-45ac-8823-89edb20ddbc9","originalDate":"2020-09-28","originalTime":"06:30:00.000",
            

            also morgen früh um 6:30

            der fehlgeschlagene Befehl sah so aus:

            "notificationIndex":"266ffcbf-1f44-49ba-b0e3-e1c87cd6f1f8","originalDate":"2020-09-27","originalTime":"07:30:00.000",
            

            also HEUTE um 7:30.

            Das kann natürlich nicht klappen, da das in der Vergangenheit liegt.

            Mir ist nur nicht klar, warum der Alexa2 Adapter das so gesendet hat. Weder über die Admin-Oberfläche noch über die API wird irgendwo das Datum übergeben.

            Nachdem ich den Wecker einmal über die Alexa-App aktiviert und deaktiviert habe, ging das Schalten auch über den Alexa2 Adapter wieder wie gewohnt.

            Der Fehler ist leider nicht reproduzierbar. Habe den Wecker gelöscht und von der API wieder neu anlegen lassen und es klappt jetzt problemlos.

            Werde das weiter beobachten...

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

            Support us

            ioBroker
            Community Adapters
            Donate

            824
            Online

            31.8k
            Users

            80.0k
            Topics

            1.3m
            Posts

            javascript
            1
            4
            224
            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