Skip to content
Daenara edited this page Jan 13, 2021 · 3 revisions

Rhasspy Weather has quite a few different output systems to choose from. They can be set in the config file via the output value in the General section.

Table of Contents:

console

Console output is pretty simple. It just dumps the results to the console. This is useful for a custom command script set up in rhasspy for example.

log

Log output is pretty simple, it just dumps the results into the log.

mqtt

The mqtt output option publishes results to an mqtt broker. Here is what mqtt.py looks for in the config file:

[mqtt]
address=
port=
user=
password=
topic=rhasspy_weather/response

rhasspy_tts

This option sends the result as a sentence to the configured rhasspy_instance to be read by tts. This needs to go into the config file for it:

[rhasspy]
address=

return

The return output passes the answering sentence as a return value to the script that ran rhasspy_weather. It needs to be the last output in the config file to work.

add your own

To add your own output simply create a python file in the output package, paste the following template into it, fill out the template and add the file name (without the .py) to the output option in the config file.

Template:

def output_response(output):
    # here goes the logic what to do with the output
    # output is a filled in string template
    # if you return a value here and your custom output is the last one in the config
    # your return value will be passed upwards to the script running rhasspy_weather


def parse_config(config):
    # if you want to add something to be read from the config file, add it here
    # it would be good if this does not throw an error even if something is missing
    # because the program will stop when the config is read and if other outputs are
    # configured then it could still run.
    # check for the config values in output_response and throw the error there
    pass


def get_template():
    # here you can specify a template that is to be used with this output regardless
    # what template is configured in the config file.
    # if you don't need one, just leave this be.
    return None

Clone this wiki locally