Version information
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
Add this module to your Puppetfile:
mod 'cheasles-rhasspy', '1.0.0'
Learn more about managing modules with a PuppetfileDocumentation
rhasspy
A Puppet module to configure Rhasspy.
Table of Contents
- Description
- Setup - The basics of getting started with rhasspy
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- 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.
Dependencies
- mmckinst/hash2stuff (>= 1.0.0)
- pk/systemd (>= 1.0.0)
- puppetlabs/concat (>= 7.0.0)
- puppetlabs/vcsrepo (>= 5.0.0)