-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from OpenVoiceOS/release-1.0.4a1
Release 1.0.4a1
- Loading branch information
Showing
8 changed files
with
99 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,54 @@ | ||
|
||
# OpenVoiceOS Bus Client | ||
|
||
This module is a simple interface for the mycroft messagebus and can be used to connect to ovos, send messages and react to messages sent by the OpenVoiceOS system. | ||
This module is a simple interface for the OVOS messagebus and can be used to connect to OVOS, send messages and react to messages sent by the OpenVoiceOS system. | ||
|
||
|
||
## MycroftBusClient() | ||
|
||
The `MycroftBusClient()` object can be setup to connect to any host and port as well as any endpont on that host. this makes it quite versitile and will work on the main bus as well as on a gui bus. If no arguments are provided it will try to connect to a local instance of OVOS on the default endpoint and port. | ||
|
||
> NOTE: we kept the original pre-fork class name for compatibility reasons | ||
## Message() | ||
|
||
The `Message` object is a representation of the messagebus message, this will always contain a message type but can also contain data and context. Data is usually real information while the context typically contain information on where the message originated or who the intended recipient is. | ||
|
||
```python | ||
Message('MESSAGE_TYPE', data={'meaning': 42}, context={'origin': 'A.Dent'}) | ||
``` | ||
|
||
## Examples | ||
|
||
Below are some a couple of simple cases for sending a message on the bus as well | ||
as reacting to messages on the bus | ||
|
||
### Sending a message on the bus. | ||
|
||
```python | ||
from ovos_bus_client import MessageBusClient, Message | ||
|
||
print('Setting up client to connect to a local OVOS instance') | ||
client = MessageBusClient() | ||
client.run_in_thread() | ||
|
||
print('Sending speak message...') | ||
client.emit(Message('speak', data={'utterance': 'Hello World'})) | ||
``` | ||
|
||
### Catching a message on the messagebus | ||
|
||
```python | ||
from ovos_bus_client import MessageBusClient, Message | ||
|
||
print('Setting up client to connect to a local OVOS instance') | ||
client = MessageBusClient() | ||
|
||
def print_utterance(message): | ||
print('OVOS said "{}"'.format(message.data.get('utterance'))) | ||
|
||
|
||
print('Registering handler for speak message...') | ||
client.on('speak', print_utterance) | ||
|
||
This module extends the mycroft-messagebus-client with a Session implementation | ||
client.run_forever() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# START_VERSION_BLOCK | ||
VERSION_MAJOR = 1 | ||
VERSION_MINOR = 0 | ||
VERSION_BUILD = 3 | ||
VERSION_ALPHA = 0 | ||
VERSION_BUILD = 4 | ||
VERSION_ALPHA = 1 | ||
# END_VERSION_BLOCK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ovos-config>=0.0.12,<1.0.0 | ||
ovos-utils>=0.3.5,<1.0.0 | ||
websocket-client>=0.54.0 | ||
pyee>=8.1.0, < 12.0.0 | ||
pyee>= 8.1.0, < 13.0.0 | ||
orjson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters