Amazon Echo and Alexa

Begonnen von andrejs, 03 Oktober 2015, 23:32:23

Vorheriges Thema - Nächstes Thema

andrejs

Oh, I understand. When you will solve the issue with AVM support let me know to help you further in controling FHEM devices with Alexa.

Regards

Andrej

breezybadger

#16
Hi,

its me again. I managed the IP Problem, and now have a public IPv4 Adress to get access to my FHEM from everywhere. I uploaded a new INDEX File with the AlexaSkill in a ZIP Archive.

When I run test with your environment I got the following results:
{
  "errorMessage": "Unexpected token ILLEGAL",
  "errorType": "SyntaxError",
  "stackTrace": [
    "Module._compile (module.js:439:25)",
    "Object.Module._extensions..js (module.js:474:10)",
    "Module.load (module.js:356:32)",
    "Function.Module._load (module.js:312:12)",
    "Module.require (module.js:364:17)",
    "require (module.js:380:17)"
  ]
}

Or the Logfile says:
/var/task/index.js:4
var APP_ID = "amzn1.echo-sdk-ams.app.XXX"; //
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
START RequestId: a9061cad-9ce2-11e5-8960-1b67a6685eac Version: $LATEST
Syntax error in module 'index': SyntaxError at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17)
END RequestId: a9061cad-9ce2-11e5-8960-1b67a6685eac
REPORT RequestId: a9061cad-9ce2-11e5-8960-1b67a6685eac Duration: 152.76 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 9 MB

Any advice?

Dan

andrejs

Hi,

could you please send me the index.js file which was in zip file uploaded to Amazon?

Andrej

breezybadger

Thanks, I send you a private message. Please keep in mind to post the working file here :)

andrejs

It seems something must be wrong with js file. I am attaching new ones to this post. Please replace in index.js file APP_ID and urlPrefixurl. Now the same error should not be repeated.

Andrej

breezybadger

#20
Man, you made it! It works like a charm!

Thanks it is awesome.

If you got some time left it would be awesome to update your description. If you want I could start a wiki Page for reproduction for others.

Dan

andrejs

Dani,
I upload the attached zip file to this post where APP_ID,urlPrefixurl are not changed. I got the error "errorMessage": "Invalid applicationId". Please upload this zip file and try again. Maybe just one recommendation: after you will click on button "save and test" wait to get error (it will be previous error probably because it runs old js script) and then click button "test" and after that get the errror message for the new uploaded script.

Andrej

breezybadger

Hey,

it just took some time for amazon to update the content. It works awesome now! And I updated my last post.

andrejs

Great to hear that. I am planning to post upgraded ECHO module (next week) where the script automatically create SRset and SRstater attributes for devices.

Andrej

breezybadger

That sounds very good. I got a to simple switch a light on / off, but I don't get it how to ask for status of a differente device.

Could you please give some simple examples with the full FHEM configuration and the Sample Utterances from AAS - this would be helpful to get the full potential of your awesome work.

It is still a little annoying to always use the intend word, but thats why I used a combination with the hue bridge for the simple switches.

Thanks again Dan

andrejs

#25
ZitatI don't get it how to ask for status of a different device
To get the status of the fhem device (actually Alexa can be asked for any value/status of fhem devices readings) you should create attribute SRstater and of course also SRword.

For example CUL_HM  HM-CC-RT-DN is radiator valve and has many readings: desired-temp, measured-temp,motorErr,controlMode,ValvePosition,.....
The current values of these Readings are:
desired-temp 18.5
measured-temp 17.0
motorErr OK
controlMode auto
ValvePosition 10

The attribute SRword of this device is for example Child room.

How should look SRstater attribute for the device in order to ask Alexa for status of fhem device readings (for details see my first post)?

*1 (desired temperature:desired-temp:degrees Celsius),*1 (measured temperature:measured-temp:degrees Celsius),*1 (motor status:motorErr),*1 (control mode status:controlMode),*1 (valve position:ValvePosition)

If you want to get the status/value of fhem device reading you ask: 
Alexa ask smarty for Child room desired temperature. The answer will be  »child room desired temperature is eighteen point five degrees celsius. The last change was made  [date and time of last change of the reading desired-temp]«
Alexa ask smarty for Child room control mode status. The answer will be  »child room control mode status is auto. The last change was made  [date and time of last change of the reading controlmode]«

The sample uterance you will create in FHEM and after copy to Amazon Alexa Skill:

http://fhem-server-ip:port/fhem?cmd=get%20nameofECHOdevice%20uterances&XHR=1

or

use "get uterances" in FHEMWEB of echo device

How the uterances look like?
SRstater {child room|litdev} {desired temperature|litrea}
SRstater {child room|litdev} {measured temperature|litrea}
SRstater {child room|litdev} {motor status|litrea}
SRstater {child room|litdev} {control mode status|litrea}
SRstater {child room|litdev} {valve position|litrea}

ZitatIt is still a little annoying to always use the intend word, but thats why I used a combination with the hue bridge for the simple switches.
Unfortunately I do not have solution for that and every time you must start question with "Alexa ask smarty for..."  or "Alexa tell smarty to....."

Andrej



kimeshan

Zitat von: breezybadger am 05 Dezember 2015, 15:00:56
Hey,

the first lines of my uploaded file looks like :

My FHEM Config looks like:
The Result of the test in Lamda was:
Of course I replaced the ID with the one from my Apps&Services

Any Ideas what I am doing wrong?

Hey,

I just had the same problem, and I found out why. If you still looking for a solution to this, here it is.

The line that is causing your ILLEGAL TOKEN error is:
"amzn1.echo-sdk-ams.app.2a79ae4f-2492-xxxx-a0b6-xxxxx"

Notice your last double quote is " instead of " - it must have changed formatting when you copy and pasted...

Change it and let me know if it works

breezybadger

#27
Hello again

Iam just curious if it is possible to let Alex Read Messages e.g. if the door opens she says welcome. Is this possible to trigger voice output from her?

erw85

Hello Andrej,

Thanks for your great Module, it works like a charm!

Does your module allow to get the actual recognized word (=litval slot) of an utterance from Alexa and use it as input for a FHEM command?

For example, I d'like to use it in combination with the Sonos Speak command, in a way similar to this: 
attr Sonos1 SRSet *1 (speak:Speak 20 de) [phrase:$litval]

Any plans for a syntax like this?

Another great feature would be if you could generate default SRset (and SRstater) utterances for devices by just by setting attr SRset/SRstater to "default".

All the best for 2016,
Erwin

andrejs

ZitatI just curious if it is possible to let Alex Read Messages e.g. if the door opens she says welcome. Is this possible to trigger voice output from her?
Unfortunately Dan Alexa is only supposed to speak when spoken to, so I hope there will some solution given by Amazon in the future.

ZitatDoes your module allow to get the actual recognized word (=litval slot) of an utterance from Alexa and use it as input for a FHEM command?
Erwin, I will need to look at Alexa Skill Interaction Module (there were some changes) to see if this is possible because normally all spoken words must defined in advance in utterance scheme otherwise you get the "error" response from Alexa.     

ZitatAnother great feature would be if you could generate default SRset (and SRstater) utterances for devices by just by setting attr SRset/SRstater to "default".
Yes good idea, I have plans to implement this very soon (actually I made 90% of the changes in the module)...

Andrej