Learn to build and integrate custom Abilities in OpenHome, using CapabilityWorker
and example use cases.
CapabilityWorker
for seamless I/O management.main.py
file to define the logic.
main.py
register_capability
: Defines the Ability’s unique_name
and matching_hotwords
.call
: Executes the Ability’s logic when triggered.CapabilityWorker
CapabilityWorker
class simplifies I/O interactions, enabling:
speak
function converts text into speech and streams it to the user via WebSocket.
run_io_loop
orchestrates speaking and listening for responses in a single flow.
msg (str)
: The final transcribed user input after the user has finished speaking.action (str)
: The action to be sent to the Devkit.type (str)
: The type of data being sent.data (dict)
: The structured data to be transmitted.text_to_speech
function converts the provided text into speech using the specified Voice ID and streams it to the user via WebSocket.
text (str)
: The text to be converted into speech.voice_id (str)
: The Voice ID to be used for speech synthesis.speak
: Introduces the advisor and provides the solution.user_response
: Captures user input (e.g., their problem).run_io_loop
: Combines speaking the solution and listening for feedback.resume_normal_flow
: Resumes the agent’s default workflow after interaction.speak
, run_io_loop
, and API integration.Start creating innovative Abilities and push the boundaries of voice AI with OpenHome! 🎉Note: It is recommended to use the
requests
module to call third-party APIs and avoid using other libraries. If any other library is needed for a special case, you can request us to add it.