Messages are used to communicate information between Mycroft services and other components. This list of Message types outlines the details and provides sample code for each.
Each Message type listed contains a description outlining it's meaning or purpose. Where relevant, the Message type will also list the specific JSON data packets expected to be emitted with that Message, and the most common producers and consumers of the Message.
See the MessageBus documentation for further information on this service and examples of using Messages.
General
speak
Request to speak utterance
Data:
{"utterance": <wordstobespoken>, "lang": <language code, e.g. en-us>}
Usage:
...definitialize(self): self.add_event('speak', self.handler_speak)defhandler_speak(self,message):# code to excecute when speak message detected......
...defsome_method(self): self.bus.emit(Message('speak', {"utterance": <words to be spoken>,"lang": <language code, e.g. en-us>}))...
python3-mmycroft.messagebus.send'speak''{ "utterance": <words to be spoken>, "lang": <language code, e.g. en-us>}'
mycroft.internet.connected
Internet connection is now available (only generated on initial connection)
Usage:
...definitialize(self): self.add_event('mycroft.internet.connected', self.handler_mycroft_internet_connected)defhandler_mycroft_internet_connected(self,message):# code to excecute when mycroft.internet.connected message detected......
Sent by start-up sequence when everything is ready for user interaction
Producer
Consumer
skills/padatious_service.py
Pairing Skill
Usage:
...definitialize(self): self.add_event('mycroft.ready', self.handler_mycroft_ready)defhandler_mycroft_ready(self,message):# code to excecute when mycroft.ready message detected......
...definitialize(self): self.add_event('mycroft.stop', self.handler_mycroft_stop)defhandler_mycroft_stop(self,message):# code to excecute when mycroft.stop message detected......
Start the pairing process when this event is emitted.
Producer
Consumer
Pairing Skill
Weather Skill
Wolfram Alpha Skill
Pairing Skill
...definitialize(self): self.add_event('mycroft.not.paired', self.handler_mycroft_not_paired)defhandler_mycroft_not_paired(self,message):# code to excecute when mycroft.not.paired message detected......
...definitialize(self): self.add_event('mycroft.paired', self.handler_mycroft_paired)defhandler_mycroft_paired(self,message):# code to excecute when mycroft.paired message detected......
...definitialize(self): self.add_event('mycroft.awoken', self.handler_mycroft_awoken)defhandler_mycroft_awoken(self,message):# code to excecute when mycroft.awoken message detected......
log level can be: "CRITICAL" "ERROR" "WARNING" "INFO" "DEBUG" These correspond to the Python logging object.
The "bus" parameter allows turning the logging of all bus messages on/off.
Data:
{"level" : <loglevel>, "bus": <True/False>}
Usage:
...definitialize(self): self.add_event('mycroft.debug.log', self.handler_mycroft_debug_log)defhandler_mycroft_debug_log(self,message):# code to excecute when mycroft.debug.log message detected......
...definitialize(self): self.add_event('complete_intent_failure', self.handler_complete_intent_failure)defhandler_complete_intent_failure(self,message):# code to excecute when complete_intent_failure message detected......
Notification to services that the configuration has changed and needs reloaded
Usage:
...definitialize(self): self.add_event('configuration.updated', self.handler_configuration_updated)defhandler_configuration_updated(self,message):# code to excecute when configuration.updated message detected......
...definitialize(self): self.add_event('recognizer_loop:wakeword', self.handler_wakeword)defhandler_wakeword(self,message):# code to excecute when recognizer_loop:wakeword message detected......
...definitialize(self): self.add_event('recognizer_loop:record_begin', self.handler_record_begin)defhandler_record_begin(self,message):# code to excecute when recognizer_loop:record_begin message detected......
...definitialize(self): self.add_event('recognizer_loop:record_end', self.handler_record_end)defhandler_record_end(self,message):# code to excecute when recognizer_loop:record_end message detected......
...definitialize(self): self.add_event('recognizer_loop:utterance', self.handler_utterance)defhandler_utterance(self,message):# code to excecute when recognizer_loop:utterance message detected......
...definitialize(self): self.add_event('recognizer_loop:audio_output_start', self.handler_audio_output_start)defhandler_audio_output_start(self,message):# code to excecute when recognizer_loop:audio_output_start message detected......
...definitialize(self): self.add_event('recognizer_loop:audio_output_end', self.handler_audio_output_end)defhandler_audio_output_end(self,message):# code to excecute when recognizer_loop:audio_output_end message detected......
Go into "sleep" mode. Everything except "Hey Mycroft, wake up" will be ignored.
Usage:
...definitialize(self): self.add_event('recognizer_loop:sleep', self.handler_sleep)defhandler_sleep(self,message):# code to excecute when recognizer_loop:sleep message detected......
...definitialize(self): self.add_event('recognizer_loop:wake_up', self.handler_wake_up)defhandler_wake_up(self,message):# code to excecute when recognizer_loop:wake_up message detected......
...definitialize(self): self.add_event('enclosure.notify.no_internet', self.handler_enclosure_notify_no_internet)defhandler_enclosure_notify_no_internet(self,message):# code to excecute when enclosure.notify.no_internet message detected......
start: timestamp for audio starts (unix epoch) END_TIME: time in seconds from "start" until the end of the viseme CODE can be 0 = shape for sounds like 'y' or 'aa' 1 = shape for sounds like 'aw' 2 = shape for sounds like 'uh' or 'r' 3 = shape for sounds like 'th' or 'sh' 4 = neutral shape for no sound 5 = shape for sounds like 'f' or 'v' 6 = shape for sounds like 'oy' or 'ao'
...definitialize(self): self.add_event('enclosure.mouth.viseme_list', self.handler_enclosure_mouth_viseme_list)defhandler_enclosure_mouth_viseme_list(self,message):# code to excecute when enclosure.mouth.viseme_list message detected......
...definitialize(self): self.add_event('mycroft.eyes.default', self.handler_mycroft_eyes_default)defhandler_mycroft_eyes_default(self,message):# code to excecute when mycroft.eyes.default message detected......
...definitialize(self): self.add_event('mycroft.mic.listen', self.handler_mycroft_mic_listen)defhandler_mycroft_mic_listen(self,message):# code to excecute when mycroft.mic.listen message detected......
...definitialize(self): self.add_event('mycroft.mic.mute', self.handler_mycroft_mic_mute)defhandler_mycroft_mic_mute(self,message):# code to excecute when mycroft.mic.mute message detected......
Turn on the mic (enable wakeword and STT processing)
Producer
Consumer
Pairing Skill
client/speech/main.py
Usage:
...definitialize(self): self.add_event('mycroft.mic.unmute', self.handler_mycroft_mic_unmute)defhandler_mycroft_mic_unmute(self,message):# code to excecute when mycroft.mic.unmute message detected......
...definitialize(self): self.add_event('mycroft.audio.service.play', self.handler_mycroft_audio_service_play)defhandler_mycroft_audio_service_play(self,message):# code to excecute when mycroft.audio.service.play message detected......
...definitialize(self): self.add_event('mycroft.audio.service.stop', self.handler_mycroft_audio_service_stop)defhandler_mycroft_audio_service_stop(self,message):# code to excecute when mycroft.audio.service.stop message detected......
...definitialize(self): self.add_event('mycroft.audio.service.pause', self.handler_mycroft_audio_service_pause)defhandler_mycroft_audio_service_pause(self,message):# code to excecute when mycroft.audio.service.pause message detected......
...definitialize(self): self.add_event('mycroft.audio.service.resume', self.handler_mycroft_audio_service_resume)defhandler_mycroft_audio_service_resume(self,message):# code to excecute when mycroft.audio.service.resume message detected......
...definitialize(self): self.add_event('mycroft.audio.service.next', self.handler_mycroft_audio_service_next)defhandler_mycroft_audio_service_next(self,message):# code to excecute when mycroft.audio.service.next message detected......
...definitialize(self): self.add_event('mycroft.audio.service.prev', self.handler_mycroft_audio_service_prev)defhandler_mycroft_audio_service_prev(self,message):# code to excecute when mycroft.audio.service.prev message detected......
...definitialize(self): self.add_event('mycroft.audio.service.track_info', self.handler_mycroft_audio_service_track_info)defhandler_mycroft_audio_service_track_info(self,message):# code to excecute when mycroft.audio.service.track_info message detected......
...definitialize(self): self.add_event('mycroft.audio.service.track_info_reply', self.handler_mycroft_audio_service_track_info_reply)defhandler_mycroft_audio_service_track_info_reply(self,message):# code to excecute when mycroft.audio.service.track_info_reply message detected......
...definitialize(self): self.add_event('mycroft.audio.service.list_backends', self.handler_mycroft_audio_service_list_backends)defhandler_mycroft_audio_service_list_backends(self,message):# code to excecute when mycroft.audio.service.list_backends message detected......
...definitialize(self): self.add_event('mycroft.volume.increase', self.handler_mycroft_volume_increase)defhandler_mycroft_volume_increase(self,message):# code to excecute when mycroft.volume.increase message detected......
...definitialize(self): self.add_event('mycroft.volume.decrease', self.handler_mycroft_volume_decrease)defhandler_mycroft_volume_decrease(self,message):# code to excecute when mycroft.volume.decrease message detected......
...definitialize(self): self.add_event('mycroft.volume.mute', self.handler_mycroft_volume_mute)defhandler_mycroft_volume_mute(self,message):# code to excecute when mycroft.volume.mute message detected......
...definitialize(self): self.add_event('mycroft.volume.unmute', self.handler_mycroft_volume_unmute)defhandler_mycroft_volume_unmute(self,message):# code to excecute when mycroft.volume.unmute message detected......
Set enclosure volume (0.0 = no output, 1.0 = loudest possible)
Data:
{"percent": float}
Producer
Consumer
Volume Skill
Usage:
...definitialize(self): self.add_event('mycroft.volume.set', self.handler_mycroft_volume_set)defhandler_mycroft_volume_set(self,message):# code to excecute when mycroft.volume.set message detected......
...definitialize(self): self.add_event('mycroft.volume.get', self.handler_mycroft_volume_get)defhandler_mycroft_volume_get(self,message):# code to excecute when mycroft.volume.get message detected......
...definitialize(self): self.add_event('mycroft.volume.get.response', self.handler_mycroft_volume_get_response)defhandler_mycroft_volume_get_response(self,message):# code to excecute when mycroft.volume.get.response message detected......
...definitialize(self): self.add_event('mycroft.volume.duck', self.handler_mycroft_volume_duck)defhandler_mycroft_volume_duck(self,message):# code to excecute when mycroft.volume.duck message detected......
...definitialize(self): self.add_event('mycroft.volume.unduck', self.handler_mycroft_volume_unduck)defhandler_mycroft_volume_unduck(self,message):# code to excecute when mycroft.volume.unduck message detected......
...definitialize(self): self.add_event('mycroft.skill.handler.start', self.handler_mycroft_skill_handler_start)defhandler_mycroft_skill_handler_start(self,message):# code to excecute when mycroft.skill.handler.start message detected......
...definitialize(self): self.add_event('mycroft.skill.handler.complete', self.handler_mycroft_skill_handler_complete)defhandler_mycroft_skill_handler_complete(self,message):# code to excecute when mycroft.skill.handler.complete message detected......
...definitialize(self): self.add_event('mycroft.skill.enable_intent', self.handler_mycroft_skill_enable_intent)defhandler_mycroft_skill_enable_intent(self,message):# code to excecute when mycroft.skill.enable_intent message detected......
...definitialize(self): self.add_event('mycroft.skill.disable_intent', self.handler_mycroft_skill_disable_intent)defhandler_mycroft_skill_disable_intent(self,message):# code to excecute when mycroft.skill.disable_intent message detected......
...definitialize(self): self.add_event('mycroft.skills.loaded', self.handler_mycroft_skills_loaded)defhandler_mycroft_skills_loaded(self,message):# code to excecute when mycroft.skills.loaded message detected......
...definitialize(self): self.add_event('mycroft.skills.loading_failure', self.handler_mycroft_skills_loading_failure)defhandler_mycroft_skills_loading_failure(self,message):# code to excecute when mycroft.skills.loading_failure message detected......
...definitialize(self): self.add_event('mycroft.skills.shutdown', self.handler_mycroft_skills_shutdown)defhandler_mycroft_skills_shutdown(self,message):# code to excecute when mycroft.skills.shutdown message detected......
...definitialize(self): self.add_event('mycroft.skills.initialized', self.handler_mycroft_skills_initialized)defhandler_mycroft_skills_initialized(self,message):# code to excecute when mycroft.skills.initialized message detected......
List of loaded skills (response to 'skillmanager.list')
Data:
{"skills": [<listofskillIDs>] }
Producer
Consumer
skills/main.py
Usage:
...definitialize(self): self.add_event('mycroft.skills.list', self.handler_mycroft_skills_list)defhandler_mycroft_skills_list(self,message):# code to excecute when mycroft.skills.list message detected......
...defsome_method(self): self.bus.emit(Message('mycroft.skills.list', {"skills": [<list of skill IDs>] }))...
python3-mmycroft.messagebus.send'mycroft.skills.list''{"skills": [<list of skill IDs>] }'
mycroft.skills.settings.update
Pull new skill settings from the server
Producer
Consumer
Configuration Skill
mycroft/skills/settings.py
Usage:
...definitialize(self): self.add_event('mycroft.skills.settings.update', self.handler_mycroft_skills_settings_update)defhandler_mycroft_skills_settings_update(self,message):# code to excecute when mycroft.skills.settings.update message detected......
...definitialize(self): self.add_event('msm.updating', self.handler_msm_updating)defhandler_msm_updating(self,message):# code to excecute when msm.updating message detected......
...definitialize(self): self.add_event('msm.installing', self.handler_msm_installing)defhandler_msm_installing(self,message):# code to excecute when msm.installing message detected......
...definitialize(self): self.add_event('msm.install.succeeded', self.handler_msm_install_succeeded)defhandler_msm_install_succeeded(self,message):# code to excecute when msm.install.succeeded message detected......
...definitialize(self): self.add_event('msm.install.failed', self.handler_msm_install_failed)defhandler_msm_install_failed(self,message):# code to excecute when msm.install.failed message detected......
...definitialize(self): self.add_event('msm.installed', self.handler_msm_installed)defhandler_msm_installed(self,message):# code to excecute when msm.installed message detected......
...definitialize(self): self.add_event('msm.updated', self.handler_msm_updated)defhandler_msm_updated(self,message):# code to excecute when msm.updated message detected......
...definitialize(self): self.add_event('msm.removing', self.handler_msm_removing)defhandler_msm_removing(self,message):# code to excecute when msm.removing message detected......
...definitialize(self): self.add_event('msm.remove.succeeded', self.handler_msm_remove_succeeded)defhandler_msm_remove_succeeded(self,message):# code to excecute when msm.remove.succeeded message detected......
...definitialize(self): self.add_event('msm.remove.failed', self.handler_msm_remove_failed)defhandler_msm_remove_failed(self,message):# code to excecute when msm.remove.failed message detected......
...definitialize(self): self.add_event('msm.removed', self.handler_msm_removed)defhandler_msm_removed(self,message):# code to excecute when msm.removed message detected......
Deactivate a skill. Activate by typing ":deactivate " in the CLI
Data:
{'skill': <skilldirectoryname>}
Producer
Consumer
CLI (client/text/main.py)
skills/skill_manager.py
Usage:
...definitialize(self): self.add_event('skillmanager.deactivate', self.handler_skillmanager_deactivate)defhandler_skillmanager_deactivate(self,message):# code to excecute when skillmanager.deactivate message detected......
List installed skills. Activate by typing ":list" in the CLI
Producer
Consumer
CLI (client/text/main.py)
skills/skill_manager.py
Usage:
...definitialize(self): self.add_event('skillmanager.list', self.handler_skillmanager_list)defhandler_skillmanager_list(self,message):# code to excecute when skillmanager.list message detected......
...definitialize(self): self.add_event('skillmanager.update', self.handler_skillmanager_update)defhandler_skillmanager_update(self,message):# code to excecute when skillmanager.update message detected......
...definitialize(self): self.add_event('reconnecting', self.handler_reconnecting)defhandler_reconnecting(self,message):# code to excecute when reconnecting message detected......
...definitialize(self): self.add_event('system.wifi.setup', self.handler_system_wifi_setup)defhandler_system_wifi_setup(self,message):# code to excecute when system.wifi.setup message detected......
...definitialize(self): self.add_event('system.wifi.reset', self.handler_system_wifi_reset)defhandler_system_wifi_reset(self,message):# code to excecute when system.wifi.reset message detected......
Force the system clock to synchronize with NTP servers
Producer
Consumer
mycroft-wifi-setup: mycroft_admin_service.py
Usage:
...definitialize(self): self.add_event('system.ntp.sync', self.handler_system_ntp_sync)defhandler_system_ntp_sync(self,message):# code to excecute when system.ntp.sync message detected......
...definitialize(self): self.add_event('system.ssh.enable', self.handler_system_ssh_enable)defhandler_system_ssh_enable(self,message):# code to excecute when system.ssh.enable message detected......
...definitialize(self): self.add_event('system.ssh.disable', self.handler_system_ssh_disable)defhandler_system_ssh_disable(self,message):# code to excecute when system.ssh.disable message detected......
...definitialize(self): self.add_event('system.reboot', self.handler_system_reboot)defhandler_system_reboot(self,message):# code to excecute when system.reboot message detected......
...definitialize(self): self.add_event('system.shutdown', self.handler_system_shutdown)defhandler_system_shutdown(self,message):# code to excecute when system.shutdown message detected......
Force an apt-get update on 'mycroft-mark-1' or 'mycroft-picroft' package (as appropriate)
Producer
Consumer
mycroft-wifi-setup: mycroft_admin_service.py
Usage:
...definitialize(self): self.add_event('system.update', self.handler_system_update)defhandler_system_update(self,message):# code to excecute when system.update message detected......
...definitialize(self): self.add_event('play:query', self.handler_query)defhandler_query(self,message):# code to excecute when play:query message detected......
...defsome_method(self): self.bus.emit(Message('play:query', { "phrase": <something to be played> }))...
python3-mmycroft.messagebus.send'play:query''{ "phrase": <something to be played> }'
play:query.response
There are three responses to a play:query. These are not intended to be consumed directly by a Skill, see the methods available in the CommonPlaySkill Class.
Confirm Search
The initial response confirms that a search is being attempted. It also extends the Skill timeout while it looks for a match.
phrase - the phrase that was queried for this response
id - uniquely identifies the skill, normally the Skill's self.skill_id
callback_data - optional data structure to return in play:start
service_name - the name of the service returning the highest confidence in a speakable format
conf - the confidence it can handle the request, between 0.0 and 1.0
Confidence guidelines:
1.0 = exact command match, e.g. "play npr news"
>0.9 = multi-key match for database entry, e.g. "play madonna's lucky star" or "play artist madona" (matches "artist" and "madonna"). For each additional key over 2, add 0.1 to the confidence, so "play madonna's lucky star on spotify" would be 0.91 for three keywords
>0.8 = single-key match for database title entry, e.g. "play lucky star"
>0.7 = single-key match for database artist or group, e.g. "play madonna"
>0.6 = single-key match for database genre or category, e.g. "play reggae"
>0.5 = generic match, e.g. "play some music" or "play a movie"
...definitialize(self): self.add_event('question:query', self.handler_query)defhandler_query(self,message):# code to excecute when question:query message detected......
...definitialize(self): self.add_event('question:query.response', self.handler_query_response)defhandler_query_response(self,message):# code to excecute when question:query.response message detected......
skill_id -- the unique ID of the skill that is being invoked
phrase -- the original phrase user said, e.g. "some thing" from utterance "how tall was abraham lincoln"
callback_data -- (optional) data the skill can use to take additional actions
Usage:
...definitialize(self): self.add_event('question:action', self.handler_action)defhandler_action(self,message):# code to excecute when question:action message detected......
...definitialize(self): self.add_event('private.mycroftai.has_alarm', self.handler_private_mycroftai_has_alarm)defhandler_private_mycroftai_has_alarm(self,message):# code to excecute when private.mycroftai.has_alarm message detected......