Open Kaldesh84 opened 1 year ago
Ok, please provide more details, show logs or scripts. I only have a rough idea what you mean
Maybe a debug log from iot adapter makes most sense to provide ...
As I'm doing my logic via nore-red, it's somewhat difficult to include scripts, so I'll try with screenshots and added detail:
Here, I
Only then can I decide what dialog logic to execute and how to process the user input
And then have OUT-links to the different logic blocks for the different starting phrases.
That logic is already clunky and unsafe, because during the processing of the latest change in iot/0/lastCommandObject, a new dialog could already have been started on another alexa device, which could have changed the "last changed textCommand". Including the starting phrase for the Custom Skill would make most of this logic obsolete.
And all of the above is only possible, if I set the "textCommand" state of an alexa device myself in ioBroker. If I use a simple routine in the Alexa App that triggers on "Alexa, starte den Staubsauger" to execute the free text command "sage i.o. Broker starte einen Dialog mit Okay, welchen Bereich soll ich säubern?"
then the .../commands/textCommand state of that Alexa device is not changed in ioBroker, which is why this approach above won't work.
Then I need to add further logic: The routine in the Alexa app needs to trigger this virtual switch, that then sets the textCommand to "sage i.o. Broker starte einen Dialog mit Okay, welchen Bereich soll ich säubern?". Then I still need get the alexa device from from alexa2/0/History/serialNumber to set the correct textCommand state, which would work out of the box from the routine in the Alexa app.
Does this clarify things a bit? We can also switch to German, if there's more unclarities ;-)
With the mapping of the lastCommandObj.deviceId to the alexa2 serial number, things could already be simplified quite a bit, but that's not present yet, afaik.
Bump und simplere Anfrage:
aktuell enthält iot.0.lastCommandObj
folgende Werte:
Ich hätte gern noch sowas dazu:
Wo dann drin steht, was Alexa im Rahmen dieser Session zuletzt gesagt hat.
Wenn ich also mit "sage i.o. broker starte Dialog mit Was kann ich für dich tun?" sage, dann sollte in dem neuen JSON Feld lastAlexaDialog eben "Was kann ich für dich tun" drin stehen.
Wenn ich über iot.0.smart.lastResponseObj
einen responseText setze, aber shouldEndSession
auf false ist, dann sollte nach meiner nächsten Antwort eben der vorher gesetzte responseText in lastAlexaDialog drin stehen.
Das hilft, eigene und auch komplexere Logiken zu entwickeln mit mehrstufigen Konversationen.
An sich ist die session is dafür gedacht weil die über mehrere Interaktionen in einer Session gleich ist. Ich muss mich in deine Anfrage mal tiefer reindenken wenn ich dazu Zeit finde.
Please include the phrase used to start the ioBroker custom skill into the lastCommandObj.
My scenario: I wanted to trigger a dialog with a simpler phrase (wife approval factor), so I created a routine On Voice command "Alexa, start den Staubsauger" I then executed the command "Alexa, sage i. o. broker starte einen dialog mit "Welcher Bereich soll gesäubert werden" to ask for areas on my vacuum robot's map to be cleaned.
But, as I set the textCommand directly though the Alexa routine, the textCommand state in ioBroker is not changed. So, when now iot/0/lastCommandObj is changed, I can't find which "request" to the skill it relates to.
If I start the dialog mode from ioBroker itself, I can scan through alexa2.0.Echo-Devices.*.Commands.textCommand to find the latest changed textCommand state that contains "i.o. broker starte einen dialog" to find it, which is already a little clunky. With just a routine, that's not even possible.
I then have to create a virtual switch that is triggered by that routine, gets the latest used echo via alexa/0/History/serialNumber and set the textCommand state on that device. That is VERY inconvenient and also adds a necessary delay for the alexa/0/History/serialNumber state to be properly updated.
If you could include the start phrase (like "starte einen dialog mit ... ") in lastCommandObj and maybe keep it there for the whole session, this would make this dialog mode a LOT easier to use.