Skip to content

Latest commit

 

History

History
97 lines (65 loc) · 3.07 KB

README.md

File metadata and controls

97 lines (65 loc) · 3.07 KB

PowerPi - Voice Assistant

PowerPi service which provides Amazon Alexa voice support to PowerPi. Amazon can access this service via the Kubernetes ingress rules when a port forwarding rule is applied on your router, as well as an SSL certificate using Let's Encrypt.

The service is built using typescript, with dependencies using yarn workspaces. It is also dependant on a local common library @powerpi/common, a common API library @powerpi/common-api and a common testing library @powerpi/common-test, all of which need to be compiled before use.

An example to turn the device "BedroomLight" on would be:

User: alexa start power pi
Alexa: What would you like to do?
User: turn bedroom light on
Alexa: Turning Bedroom Light on

Building

Locally

The service can be built locally with the following commands, which will generate the bundles in the voice-assistant/dist directory.

# From the root of your PowerPi checkout
# Download the dependencies
yarn

# Build the common libraries
yarn build:lib

# Build the voice-assistant service
yarn build:voice-assistant

Docker

The Docker container can be built utilising buildx as described in the project documentation.

Alexa Model

The code repository already contains the compiled Alexa model for configuring the skill, however this needs to be rebuild (and checked in) if any changes to the model are made. This can be achieved with the following commands. The updated model will be available at voice-assistant/build/platform-alexa.

# Ensure you have the Jovo CLI installed, which will be used to compile the Alexa model
npm install --location=global @jovotech/cli

# From the root of your PowerPi checkout
# Download the dependencies
yarn

# Build the common libraries
yarn build:lib

# Build the voice-assistant Alexa model
yarn build:voice-assistant:alexa

Configuration

Environment

This service expects the following environment variables to be set before it will start successfully. When using kubernetes these are already configured in the helm chart, however when running locally for testing we need to define these:

  • API_ADDRESS - The URI to the API instance to use, (default http://api:3000/api)
  • JOVO_PORT - The port the service runs on (default 3000).
  • MQTT_ADDRESS - The URI to the MQTT instance to use, (default mqtt://POWERPI_URL:1883)

Testing

This service can be tested by executing the following commands.

# From the root of your PowerPi checkout
# Download the dependencies
yarn

# Build the common libraries
yarn build:lib

# Run the service locally
yarn test:voice-assistant

Local Execution

The service can be started locally with the following commands.

# From the root of your PowerPi checkout
# Download the dependencies
yarn

# Build the common libraries
yarn build:lib

# Run the service locally
yarn start:voice-assistant