Site Tools


avs-alexa

alexa sample app

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/
~/.pulse/default.pa
[...]
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
/var/lib/avs-alexa-sampleapp/.pulse/client.conf
default-server = 127.0.0.1
pulseaudio -k
pulseaudio -D
systemctl start avs-alexa-sampleapp

anbox alexa app

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 

custom alexa skill

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

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”
{
    "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": []
        }
    }
}
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)
avs-alexa.txt · Last modified: 2021/10/31 10:42 by 127.0.0.1