Code Monkey home page Code Monkey logo

calexa's People

Contributors

martin-riedl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

calexa's Issues

Outdated .json and to less Information in readme

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.

Dead project

Looking at the most recent commits, and the 100% unanswered open issues, I should have realized this was a dead project before I wasted my time.

Shame, I had such high hopes! If it ever gets revived, or anyone cares to fork it and get it up and running again, I would be super keen to give this another go.

Anyway, thanks for the original effort etc. I don't mean to sound like an ingrate.
Github needs some system of flagging dead projects though. Or I just need to be more discerning before delving in to such things.

Such is life.

I feel like Marvyn from Hitchikers today.

Peace out

Traceback (most recent call last):
  File "/CALexa/src/calexa.py", line 13, in <module>
    from flask import Flask
  File "/home/chris/.local/lib/python3.9/site-packages/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/home/chris/.local/lib/python3.9/site-packages/jinja2/__init__.py)

Problems with the self-signed X.509 cert

So I decided to go the self hosted X.509 route. Everything worked well so far. Until I tested the skill and I get the following error on my server:

$(jobs:0)-(9 files, 56Kb)-> python src/calexa.py 
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
[2018-03-21 23:34:25,118] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
  File "/home/ndo/.local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ndo/.local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ndo/.local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ndo/.local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ndo/.local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ndo/.local/lib/python2.7/site-packages/flask_ask/core.py", line 728, in _flask_view_func
    ask_payload = self._alexa_request(verify=self.ask_verify_requests)
  File "/home/ndo/.local/lib/python2.7/site-packages/flask_ask/core.py", line 662, in _alexa_request
    cert = verifier.load_certificate(cert_url)
  File "/home/ndo/.local/lib/python2.7/site-packages/flask_ask/verifier.py", line 21, in load_certificate
    if not _valid_certificate(cert):
  File "/home/ndo/.local/lib/python2.7/site-packages/flask_ask/verifier.py", line 63, in _valid_certificate
    value = str(extension)
  File "/home/ndo/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 779, in __str__
    return self._subjectAltNameString()
  File "/home/ndo/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 740, in _subjectAltNameString
    method = _lib.X509V3_EXT_get(self._extension)
AttributeError: 'module' object has no attribute 'X509V3_EXT_get'
127.0.0.1 - - [21/Mar/2018 23:34:25] "POST / HTTP/1.1" 500 -

On the alexa skills test page I get the following error:

There was an error calling the remote endpoint, which returned HTTP 500 : INTERNAL SERVER ERROR

I made the self signed cert 1:1 following Amazons directions from their page here:

https://developer.amazon.com/docs/custom-skills/test-a-custom-skill.html#create-a-private-key-and-self-signed-certificate-for-testing

Also I'm not using nginx, but apache. My config looks like this:

<VirtualHost *:80>

        ServerName calexa.abcxyz.xyz

        Redirect / https://calexa.abcxyz.xyz

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

</VirtualHost>
<VirtualHost *:443>

        ServerName calexa.abcxyz.xyz

        LimitRequestBody 0

        SSLEngine On
        SSLProxyEngine On

        <Proxy *>
        Order deny,allow
        Allow from all
        </Proxy>

        ProxyRequests Off
        ProxyPreserveHost On

        ProxyPass / http://localhost:5000
        ProxyPassReverse / http://localhost:5000

        SSLCertificateFile /home/ndo/CALexa/certificate1.pem
        SSLCertificateKeyFile /home/ndo/CALexa/private-key.pem

</VirtualHost>

I think that about covers all the info.

Anyone have any idea whats going on here?

Config looks perfectly fine to me..

ImportError: No module named werkzeug.exceptions

I'm trying to install calexa. When starting calexa.py the following error appears:

sudo python /opt/calexa/src/calexa.py
Traceback (most recent call last):
File "/opt/calexa/src/calexa.py", line 13, in
from flask import Flask
File "/usr/local/lib/python2.7/dist-packages/flask/init.py", line 17, in
from werkzeug.exceptions import abort
ImportError: No module named werkzeug.exceptions

flask-aks is allready installed:
sudo pip install flask-ask
Requirement already satisfied (use --upgrade to upgrade): flask-ask in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Any ideas?
Sebastian

Solved it. All dependencies installed as errors thrown by the script. Just straight forward
"sudo pip install xyz..."
Greetings, Sebastian

Issues with understanding how to set it up

Hi there,

thanks for making it possible to use Alexa with a CalDAV calendar. I run an ownCloud server which has an integrated CalDAV server. By reading the README.md I couldn't figure out where CALexa has to be installed. Is it possible to run it on a server in your local network? Does it have to run on the same server as the CalDAV server runs?

Best regards,

Konze

Multiple Issues

Hello,

first of all thank you for this skill! But I have a Problem:

I created the skill until the testing phase without publishing it. Testing on my device is enabled but when I ask it about my calendar, it just responds "You have not setup any calendar. Please view settings in the app"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.