Site Tools


Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
avs-alexa

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
avs-alexa [2019/02/10 11:27] – [anbox alexa app] 2a01:4f8:191:327:9c99:c4ff:fe00:55c2avs-alexa [2021/10/31 10:42] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +===== alexa sample app =====
 +<code bash>
 +aur sync -c avs-alexa-sampleapp
 +pacman -S avs-alexa-sampleapp
 +chown alexa:alexa /var/lib/avs-alexa-sampleapp/config.json 
 +sudo -u alexa /usr/share/avs-device-sdk/genConfig /var/lib/avs-alexa-sampleapp/config.json 123456 /var/lib/avs-alexa-sampleapp /var/lib/avs-alexa-sampleapp /var/lib/avs-alexa-sampleapp/AlexaClientSDKConfig.json
 +cp /etc/pulse/default.pa ~/.pulse/
 +</code>
 +<file - ~/.pulse/default.pa>
 +[...]
 +load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
 +</file>
 +<file - /var/lib/avs-alexa-sampleapp/.pulse/client.conf>
 +default-server = 127.0.0.1
 +</file>
 +<code bash>
 +pulseaudio -k
 +pulseaudio -D
 +systemctl start avs-alexa-sampleapp
 +</code>
 +===== anbox alexa app =====
 +<code bash>
 +aur sync -c anbox-git anbox-modules-dkms-git anbox-image
 +pacman -Sy anbox-git anbox-modules-dkms-git anbox-image
 +modprobe loop
 +systemctl restart systemd-networkd systemd-resolved
 +systemctl restart anbox-container-manager
 +# systemctl --user restart anbox-session-manager
 +anbox session-manager --gles-driver=host
 +anbox launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity
 +adb install 
 +</code>
 +  * anbox-image-gapps, arm support through libhoudini)
 +    * https://www.linuxuprising.com/2018/07/anbox-how-to-install-google-play-store.html
 +  * alexa apk
  
 +===== custom alexa skill =====
 +<code bash>
 +aur sync -c python-flask-ask ngrok
 +pacman -S python-flask-ask ngrok
 +git clone https://git.project-insanity.org/onny/py-control-arch.git
 +cd py-control-arch
 +python main.py
 +ngrok http 5000
 +</code>
 +alexa skill list: https://developer.amazon.com/edw/home.html#/skills/list
 +  * create skill
 +  * Skill name: "Arch control"
 +  * Select "Custom"
 +  * Select "Self hosted"
 +  * Select "Start from scratch"
 +  * JSON-Editor
 +
 +  * Go to https://alexa.amazon.com and login with the same developer account as used by the SampleApp
 +  * Select "Skill" in the left menu
 +  * Select "Your skill" in the upper right corner
 +  * Select "All skills" in the menu below
 +  * Click on "Arch control" and select "Enable skill"
 +<code json>
 +{
 +    "interactionModel": {
 +        "languageModel": {
 +            "invocationName": "arch control",
 +            "intents": [
 +                {
 +                    "name": "YesIntent",
 +                    "slots": [],
 +                    "samples": []
 +                },
 +                {
 +                    "name": "AnswerIntent",
 +                    "slots": [
 +                        {
 +                            "name": "first",
 +                            "type": "AMAZON.NUMBER"
 +                        },
 +                        {
 +                            "name": "second",
 +                            "type": "AMAZON.NUMBER"
 +                        },
 +                        {
 +                            "name": "third",
 +                            "type": "AMAZON.NUMBER"
 +                        }
 +                    ],
 +                    "samples": []
 +                }
 +            ],
 +            "types": []
 +        }
 +    }
 +}
 +</code>
 +<file - tuxtux.py>
 +import logging
 +from flask import Flask
 +from flask_ask import Ask, statement, question, session
 +import subprocess
 +
 +app = Flask(__name__)
 +app.config['ASK_VERIFY_REQUESTS'] = False
 +ask = Ask(app, "/")
 +logging.getLogger("flask_ask").setLevel(logging.DEBUG)
 +
 +@ask.intent("Suspend")
 +def suspend():
 +    subprocess.Popen("systemctl suspend")
 +    return statement("Suspending computer")
 +
 +@ask.intent("Firefox")
 +def suspend():
 +    subprocess.Popen("firefox")
 +    return statement("Launching Firefox")
 +
 +@ask.intent("Screenlock")
 +def suspend():
 +    subprocess.Popen("swaylock")
 +    return statement("Locking screen")
 +
 +if __name__ == '__main__':
 +    app.run(debug=True)
 +</file>
 +  * http://www.jasm.eu/2017/02/22/amazon-alexa-raspberry-pi-jasm-eu-our-first-steps-together/
 +  * https://developer.amazon.com/blogs/post/Tx14R0IYYGH3SKT/flask-ask-a-new-python-framework-for-rapid-alexa-skills-kit-development