Forge Home

rhasspy

A Puppet module to configure Rhasspy

728 downloads

728 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 1.0.0 (latest)
released Aug 4th 2021
This version is compatible with:
  • Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
  • Puppet >= 6.21.0 < 8.0.0
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'cheasles-rhasspy', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add cheasles-rhasspy
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install cheasles-rhasspy --version 1.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

cheasles/rhasspy — version 1.0.0 Aug 4th 2021

rhasspy

A Puppet module to configure Rhasspy.

Table of Contents

  1. Description
  2. Setup - The basics of getting started with rhasspy
  3. Usage - Configuration options and additional functionality
  4. Limitations - OS compatibility, etc.
  5. Development - Guide for contributing to the module

Description

This modules allows you to install and configure Rhasspy from within Puppet. It is largly based on the assumption that you'll be configuring it to interact with Home Assistant, though there's no reason that's a requirement.

Setup

Beginning with rhasspy

To get started, simply include the rhasspy class as follows:

include ::rhasspy

This will install Rhasspy following the same instructions in their documentation to install as a Python virtual environment.

Mosquitto MQTT is not installed by default as there are other Puppet modules that handle that better. If you wish to have mosquitto installed using this module, try the following:

include ::rhasspy
rhasspy::manage_mosquitto: true

You'll likely want to configure some sentences, slots or programs, so take a look at the Usage section to see more.

Usage

This module uses hash2json to convert the rhasspy::config_options value for use with Rhasspy.

The first thing you'll want to do is figure out which of the Rhasspy systems you want to enable.

Systems

Rhasspy systems can be configured through Hiera. For example, to configure the handler system to use Home Assistant, enter the following Hiera:

rhasspy::config_options:
  handle:
    system: hass

This will configure Rhasspy to run only the Home Assistant handler.

The following demonstrates a base and satellite installation on two different machines. On the main server, your Hiera may look like this:

rhasspy::config_options:
  dialogue:
    system: rhasspy
  handle:
    system: hass
  home_assistant:
    url: https://my_home_assistant.com
    access_token: My-access-token
  intent:
    system: fsticuffs
  mqtt:
    enabled: 'true'
    host: my_mqtt_server
    port: 8883
    tls:
      enabled: 'true'
      ca_certs: /etc/ssl/certs/ca-certificates.crt
    site_id: base
  speech_to_text:
    system: kaldi
  text_to_speech:
    system: nanotts

Find out how to create an access token via Home Assistant here.

On a satellite machine, your Hiera may look like this:

rhasspy::config_options:
  mqtt:
    enabled: 'true'
    host: my_mqtt_server
    port: 8883
    tls:
      enabled: 'true'
      ca_certs: /etc/ssl/certs/ca-certificates.crt
    site_id: satellite
  intent:
    system: hermes
  microphone:
    system: pyaudio
  sounds:
    system: aplay
  speech_to_text:
    system: hermes
  text_to_speech:
    system: hermes
  wake:
    system: porcupine

Sentences

Sentences are used to determine intent after speech has been converted to text by Rhasspy. To configure a sentence, try the following Hiera:

rhasspy::sentences:
  GetTemperature:
    lines:
      - 'room = (living room | bedroom | study) {room}'
      - 'whats the temperature in the <room>'
      - 'how (hot | cold) is it in the <room>'

Any changes to sentences will automatically cause Rhasspy to retrain itself.

Slots

Slots are hard-coded lists of data used by sentences. There are three provided by this module:

  • colors: A list of colors supported by Home Assistant.
  • days: The days of the week.
  • months: The months of the year.

To define your own slot, use the following Hiera:

rhasspy::slots:
  'colors':
    source: 'puppet:///modules/rhasspy/slots/hass/colors'

Slot Programs

Slot programs are scripts that can be called by Rhasspy during training. This module provides two programs by default:

  • number: A Python script that prints a list of numbers between an upper and lower bound.
  • hass_entities: A bash script that retrieves a list of entities from Home Assistant using the existing Rhasspy configuration.

To define your own program, use the following Hiera:

rhasspy::slot_programs:
  'hass_entities':
    source: 'puppet:///modules/rhasspy/slot_programs/hass/entities'

You can call these programs from within your sentences like so:

rhasspy::sentences:
  HassTurnOn:
    lines:
      - 'input_booleans = $hass_entities,input_boolean'
      - 'entities = <input_booleans>'
      - 'turn on [the] (<entities>){name}'

Limitations

This module has only been tested with Debian 10.

Development

If you'd like to contribute, fork the repo and make a pull request.