Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outdated .json and to less Information in readme #5

Open
Phil-Rei opened this issue Jul 25, 2018 · 17 comments
Open

Outdated .json and to less Information in readme #5

Phil-Rei opened this issue Jul 25, 2018 · 17 comments

Comments

@Phil-Rei
Copy link

Phil-Rei commented Jul 25, 2018

Hi,
first of all I want to thank Martin Riedl for sharing his code.
I've tried to install it on my system and had several problems, but got pretty far (I guess almost 99%).

My System: Xubuntu 16.04, OwnCloud 10.0.8, Apache 2, Cert via Let's Encrypt

Step one: Alexa Skill on Amazon Dev:
It seems Amazon changed their syntax some time ago. The provided .json is not accepted as it is. I've transformed it to the following which already includes all speech_assets and customSlotTypes... So you basically only need to paste the .json and don't need to add these things manually any more.

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "calexa",
            "intents": [
                {
                    "name": "GetEventsIntent",
                    "slots": [
                        {
                            "name": "Date",
                            "type": "AMAZON.DATE"
                        },
                        {
                            "name": "EndDate",
                            "type": "AMAZON.DATE"
                        },
                        {
                            "name": "EventSynonyms",
                            "type": "LIST_OF_EVENT_SYNONYMS"
                        },
                        {
                            "name": "CalendarSynonyms",
                            "type": "LIST_OF_CALENDAR_SYNONYMS"
                        }
                    ],
                    "samples": []
                },
                {
                    "name": "SetEventIntent",
                    "slots": [
                        {
                            "name": "Date",
                            "type": "AMAZON.DATE"
                        },
                        {
                            "name": "Time",
                            "type": "AMAZON.TIME"
                        },
                        {
                            "name": "Duration",
                            "type": "AMAZON.DURATION"
                        },
                        {
                            "name": "EndDate",
                            "type": "AMAZON.DATE"
                        },
                        {
                            "name": "EventSynonyms",
                            "type": "LIST_OF_EVENT_SYNONYMS"
                        },
                        {
                            "name": "CalendarSynonyms",
                            "type": "LIST_OF_CALENDAR_SYNONYMS"
                        },
                        {
                            "name": "eventtype",
                            "type": "LIST_OF_EVENT_TYPES"
                        }
                    ],
                    "samples": []
                },
                {
                    "name": "AMAZON.HelpIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.StopIntent",
                    "samples": []
                },
                {
                    "name": "AMAZON.CancelIntent",
                    "samples": []
                },
                {
                    "name": "Calexa",
                    "slots": [
                        {
                            "name": "EventSynonyms",
                            "type": "LIST_OF_EVENT_SYNONYMS"
                        },
                        {
                            "name": "Date",
                            "type": "AMAZON.DATE"
                        },
                        {
                            "name": "CalendarSynonyms",
                            "type": "LIST_OF_CALENDAR_SYNONYMS"
                        },
                        {
                            "name": "EndDate",
                            "type": "AMAZON.DATE"
                        },
                        {
                            "name": "eventtype",
                            "type": "LIST_OF_EVENT_TYPES"
                        },
                        {
                            "name": "Time",
                            "type": "AMAZON.TIME"
                        },
                        {
                            "name": "Duration",
                            "type": "AMAZON.DURATION"
                        }
                    ],
                    "samples": [
                        "SetEventIntent einen {eventtype} um {Time} einzutragen",
                        "SetEventIntent ein {eventtype} für den {Date} um {Time} anzusetzen",
                        "SetEventIntent ein {eventtype} für den {Date} um {Time} über {Duration} einzurichten",
                        "SetEventIntent einen {eventtype} für den {Date} um {Time} von {Duration} anzusetzen",
                        "SetEventIntent ein {eventtype} für den {Date} um {Time} für {Duration} einzurichten",
                        "SetEventIntent einen neuen Termin {eventtype} für den {Date} um {Time} für {Duration} hinzuzufügen  ",
                        "SetEventIntent einen neuen Termin {eventtype} für den {Date} um {Time} für {Duration} anzulegen ",
                        "GetEventsIntent Welche Termine habe ich zwischen dem {Date} und dem {EndDate}",
                        "GetEventsIntent Was habe ich für {EventSynonyms}",
                        "GetEventsIntent Was habe ich am {Date} für {EventSynonyms} im {CalendarSynonyms}",
                        "GetEventsIntent Was habe ich am {Date} für {EventSynonyms}",
                        "GetEventsIntent Was habe ich für {EventSynonyms} {Date}",
                        "GetEventsIntent Was habe ich {Date} für {EventSynonyms}",
                        "GetEventsIntent Gib mir die Ereignisse für {Date}",
                        "GetEventsIntent Gib mir die {EventSynonyms} für {Date}",
                        "GetEventsIntent Gib mir die {EventSynonyms} {Date}",
                        "GetEventsIntent Was ist {Date} auf dem {CalendarSynonyms}",
                        "GetEventsIntent Was ist auf dem {CalendarSynonyms}",
                        "GetEventsIntent Welche {EventSynonyms} stehen im {CalendarSynonyms} zwischen dem {Date} und dem {EndDate} ",
                        "GetEventsIntent Welche {EventSynonyms} stehen im {CalendarSynonyms} zwischen dem {Date} und dem {EndDate} an",
                        "GetEventsIntent Welche {EventSynonyms} stehen zwischen dem {Date} und dem {EndDate} an",
                        "GetEventsIntent Welche {EventSynonyms} stehen {Date} an",
                        "GetEventsIntent Welche {EventSynonyms} ich vom {Date} bis zum {EndDate} auf dem {CalendarSynonyms} habe",
                        "GetEventsIntent Welche {EventSynonyms} ich habe ",
                        "GetEventsIntent Welche {EventSynonyms} ich am {Date} habe ",
                        "GetEventsIntent Welche {EventSynonyms} ich am {Date} auf dem {CalendarSynonyms} habe ",
                        "GetEventsIntent nach meinen {EventSynonyms} vom {Date} zum {EndDate}",
                        "GetEventsIntent nach meinen {EventSynonyms} vom {Date} bis zum {EndDate} ",
                        "GetEventsIntent nach meinen {EventSynonyms} zwischen {Date} und {EndDate}",
                        "GetEventsIntent nach meinen {EventSynonyms}",
                        "GetEventsIntent Welche {EventSynonyms} habe ich {Date}",
                        "GetEventsIntent Welche {EventSynonyms} habe ich am {Date} ",
                        "GetEventsIntent Welche {EventSynonyms} habe ich am {Date} auf dem {CalendarSynonyms}"
                    ]
                }
            ],
            "types": [
                {
                    "name": "LIST_OF_EVENT_SYNONYMS",
                    "values": [
                        {
                            "name": {
                                "value": "Termin",
                                "synonyms": [
                                    "Abmachung",
                                    "Verabredung",
                                    "Event",
                                    "Ereignis"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "LIST_OF_CALENDAR_SYNONYMS",
                    "values": [
                        {
                            "name": {
                                "value": "Kalender",
                                "synonyms": [
                                    "Agenda",
                                    "Terminplaner"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "LIST_OF_EVENT_TYPES",
                    "values": [
                        {
                            "name": {
                                "value": "Besprechung",
                                "synonyms": [
                                    "Party",
                                    "Festival",
                                    "Veranstaltung",
                                    "Vortrag",
                                    "Treffen",
                                    "Meeting",
                                    "Lehre",
                                    "Vorlesung",
                                    "Arzttermin"
                                ]
                            }
                        }
                    ]
                }
            ]
        }
    }
}

Step two: Running calexa.py on same server

I've Downloaded calexa.py and conf/config.json
In the config I'm not sure the URL has to be
https://domain.de/remote.php/dav/calendars/USERNAME/default/
or
https://domain.de/remote.php/dav/principals/users/USERNAME/

So I've tried both (first is my default calendar, second one are all of my calendars).

I've also installed the dependencies via:

pip install flask-ask
pip install caldav
pip install cics

When I run python calexa.py this is the output:

/home/USERNAME/.local/lib/python2.7/site-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

So it seems to run. I've ignored the warning cause it only seems to be a speed issue.

Using a local Browser on http://127.0.0.1:5000 I get this:

Method Not Allowed
The method is not allowed for the requested URL.

Since there is no parameter I've expected some error at least.
Calexa.py Output in console add's the following line:
127.0.0.1 - - [25/Jul/2018 10:15:56] "GET / HTTP/1.1" 405 -

Step three: Reach Calexa fom outside
Activated proxy module for Apache

sudo a2enmod proxy
sudo a2enmod proxy_http

VirtualHosts:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerName domain.de
                DocumentRoot /var/www/html

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined


                LimitRequestBody 0

                SSLEngine on
                SSLProxyEngine On


                ProxyPreserveHost On

                ProxyPass / http://localhost:5000

                SSLCertificateFile      /etc/letsencrypt/live/domain.de/cert.pem
                SSLCertificateKeyFile   /etc/letsencrypt/live/domain.de/privkey.pem
                SSLCertificateChainFile   /etc/letsencrypt/live/domain.de/chain.pem
				
        </VirtualHost>
</IfModule>

Of course Port 433 has NAT forwarding to my server. I'm now able to access from outside, getting the same Method Not Allowed message.

Endpoint in Amazon Dev is: https://domain.de

This is what I get when I try to open Calexa with my Echo Dot. (Alexa starte Calexa)

Bei der Antwort des angeforderten Skill ist ein Problem aufgetreten.
Free translated: There was a problem with the answer of the skill.

I can see the requests reaching calexa.py as it outputs the following:

127.0.0.1 - - [25/Jul/2018 10:30:25] "POST / HTTP/1.1" 400 -
127.0.0.1 - - [25/Jul/2018 10:30:26] "POST / HTTP/1.1" 200 -

So it seems I'm almost done. Maybe my conversion of the .json is not correct or the calexa.py is configured wrong. Maybe someone can help and hopefully I can help others with my detailed descriptions.

@nikolauskrismer
Copy link

I am also struggeling with the installation of this skill?
Was there some progress?

Have you tried testing the skill in the alexa developer console?

@nikolauskrismer
Copy link

Ok... I could get it to work somehow (not everything works perfectly... however, I tested basic things and they seem to work)

Have a look at my fork. There you will find a correct json for an interaction model (similar to yours above but without the intent named "Calexa")

@Domi1980
Copy link

Domi1980 commented Sep 3, 2018

Hi all,
did anyone find a solution for the behavior described by @Phil-Rei?
I also receive the same feedback from calexa.py and could not find a solution for this.

127.0.0.1 - - [25/Jul/2018 10:30:25] "POST / HTTP/1.1" 400 -
127.0.0.1 - - [25/Jul/2018 10:30:26] "POST / HTTP/1.1" 200 -

I'm using the fork of @nikolauskrismer

Thanks in advance.

@nikolauskrismer
Copy link

No... I did not experience that problem.
Maybe it is possible to increase the log level somewhere...

BTW:
Did you tried testing within the Amazon console also or are you using alexa directly for your tests?

@Domi1980
Copy link

Domi1980 commented Sep 3, 2018

I tried testing it with the amazon console. the return is an empty body:
{
"body": {}
}

the console shows the above mentioned HTTP requests and status codes.

@Phil-Rei
Copy link
Author

Same here, I've also tried the fork from nikolauskrismer.

* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [11/Sep/2018 11:24:32] "POST / HTTP/1.1" 400 -
127.0.0.1 - - [11/Sep/2018 11:24:32] "POST / HTTP/1.1" 200 -

Alexa Console returns:

{
	"body": {}
}

@Garfonso
Copy link

Same issue here. @nikolauskrismer do you also get the status code 400 line in the console?

@nikolauskrismer
Copy link

No... not that I remember
I also got the empty body and thought that this was a problem... but in fact this seems to be normal

@Garfonso
Copy link

What are you asking exactly? I always get either an error message or the message that there is nothing in my calendar.
Also, I suspect, in the config you set the URL of a specific calendar (which would also disallow multiple calendars, right?).

@polcape
Copy link

polcape commented Mar 11, 2020

Hi, can I take as correct setup all of these settings?
Is calexa still working?

Thanks

@gstlouisgit
Copy link

It looks like this conversation was years ago. I was really looking forward to setting this up on apache as well. Thanks for the comments everyone posted and shared. I hope someone comments more on a resolution here. @Garfonso @nikolauskrismer @Phil-Rei . This would be amazing to get working!!

@polcape
Copy link

polcape commented Jan 23, 2021

Yes, I agree

@polcape
Copy link

polcape commented Jan 24, 2021

Hi, I try to use this repository and confirm it works.

I made some changes to use with docker and put code here https://git.cdp.li/polcape/calexa

@gstlouisgit
Copy link

@polcape thanks for confirming. I do not have docker but I will try following their instructions on this repo and see if it works. I will only have apache. If you have any comments on problems you had to deal with please let me know.

@Garfonso
Copy link

I never got it working... 🙁 Would like to try again. Will see with your setup.

@polcape
Copy link

polcape commented Jan 25, 2021

do not have docker but I will try following their instructions on this repo and see if it works. I will only have apache. If you have any comments on problems you had to deal with please let me know.

Hi @gstlouisgit ,

the only thinghs/problems I found was:

  • translating the text from Detusch to Italian
  • fixing some python packages version

The docker image is based on python 3.6 in requirements.txt you find the compatible packages to install.
If you don't use docker you can try to start the calexa following that requirements using python 3.6

Also pay attention to use ssl connection or ngrock

@Garfonso
Copy link

Garfonso commented May 24, 2021

i, I try to use this repository and confirm it works.

I made some changes to use with docker and put code here https://git.cdp.li/polcape/calexa

Hi,

today I tried to setup your docker. It does not work, I get the following error after the container build and it tried to start:

Successfully built 98d58a166881
Successfully tagged calexa_calexa:latest
WARNING: Image for service calexa was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating calexa ... done
Attaching to calexa
calexa    | Traceback (most recent call last):
calexa    |   File "./src/calexa.py", line 13, in <module>
calexa    |     from flask import Flask
calexa    |   File "/usr/local/lib/python3.6/site-packages/flask/__init__.py", line 7, in <module>
calexa    |     from .app import Flask as Flask
calexa    |   File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 19, in <module>
calexa    |     from werkzeug.local import ContextVar
calexa    | ImportError: cannot import name 'ContextVar'

Could you have a look what is wrong with the container @polcape ?

Did you get it to work @gstlouisgit?

Any help would be appreciated. Thanks.

//Edit:
I googled some more. In pallets/flask#4015 it is recommended to increase version of Werkzeuge to >2. If I do that I get a different error:

calexa    | Traceback (most recent call last):
calexa    |   File "./src/calexa.py", line 14, in <module>
calexa    |     from flask_ask import Ask, statement
calexa    |   File "/usr/local/lib/python3.6/site-packages/flask_ask/__init__.py", line 9, in <module>
calexa    |     from .core import (
calexa    |   File "/usr/local/lib/python3.6/site-packages/flask_ask/core.py", line 10, in <module>
calexa    |     from werkzeug.contrib.cache import SimpleCache
calexa    | ModuleNotFoundError: No module named 'werkzeug.contrib'

It seeems flask currently is completely broken... it's sad that you did not publish your container... :-(

Ok, after fidling a bit, it now works with falsk<2 requirement. Not sure I like that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants