* The allow_timeout value was tested poorly, preventing it from actually doing anything
* Upped the number of arp/ping test failures from 3 to 6 when validating the connection. This makes falsely detecting a wifi setup disconnect pretty unlikely.
Improved the way the button press is handled. Now the listener gives the rest
of the system a moment to consume the button press before it interprets it
as a request to begin listening.
Also replaced the use of the "buttonPress" signal when "expect_response"
was indicated with an utterance. Now the signal "startListening" is
created, differentiating it from a buttonPress.
This implements the handler for the Mark 1 menu item SSH > BLOCK (the inverse of SSH > ALLOW)
* Added handler for "unit.disable-ssh" on the serial line. This turns around and emits "mycroft.disable.ssh" on the messagebus.
* Removed the automatic reboot, just let the user know it will be different after a restart
* Made the spoken message translatable
* Changed mycroft.dialog.get() to not require the "lang" parameter. It will default to the mycroft.conf value.
* Adding localization mechanism for strings embedded in mycroft-core code
Added mycroft.dialog.get() function. This behaves much like the localization
mechanism for dialogs in Skills. So you can do things like this:
lang = "en-us"
str = mycroft.dialog.get("how are you", lang)
Which will look in mycroft/res/text for the dialog file containing strings to
use as templates for the actual output. This depends on the language being
currently used. When operating in English this would be:
mycroft/res/text/en-us/how are you.dialog
This function will pick a random line from that file to assign to str.
A more advanced use is to embed placeholders in the strings within the
template file.
lang = "en-us"
ctx = {"time" : "noon"}
str = mycroft.dialog.get("current time", lang, ctx)
And the random template line picked was "the current time is {{time}} ", then
the output would be:
"the current time is noon"
* BUGFIX: The big bug was calling is_paired() during wake_word_in_audio(). When not paired, that call hit the server, taking about a second. Since it happened multiple times a second, the audio buffers got backed up hugely. This resulted in weird behavior later as the buffers get cleared out.
* Added mycroft.api.has_been_paired(), which just looks for the pairing key (it does not validate it is still active with the server, like is_paired())
* The enclosure now checks for internet connectivity and kicks off the wifisetup process, not the wifisetup client itself.
* During the "onboarding" process, the microphone is muted using the new "mycroft.mic.mute" message. After pairing completes, the "mycroft.mic.unmute" is expected to be sent from the pairing skill. Unmuting again after a re-pairing is harmless.
* mute_and_speak() is smart enough to not unmute itself when complete if muted before
* util.check_for_signal() now accepts -1 as the lifetime. This means it never times out.
* util.stop_speaking() is more intelligent about shutting down the spoken text (including text that has been split at periods) and visemes
* The wifi setup no longer stops after 5 minutes unless already paired (i.e. still onboarding)
* The mouth resets on wifisetup stop (clearing the scrolling home.mycroft.ai)
* Changed several ConfigurationManager.get() calls to ConfigurationManager.instance(). Exactly the same, but .instance() is clearer/preferred.
* Added a mycroft.util.stop_speaking() method. Not perfect, but works for now and can be replaced later when AudioManager is in place.
A forthcoming change to the pairing skill will utilize the stop_speaking method.
* Added a mycroft.api.is_paired() method
* Added mycroft.util.is_speaking and mycroft.util.wait_while_speaking() methods
* RESET now waits for the spoken notice to complete
* Stopped the "Checking for updates" and "Skills updated" prompts (commented out for now, probably will eliminate)
* Wifi setup filters out hidden ("x00") networks
* Visemes should keep up better if they get behind (will skip)
* Mimic is now searched for on the users path
* Onboarding process:
- wifi setup starts automatically
- User is walked through the process
- wake word and button pressing are ignored
- At end, a short tutorial is given
I'm not 100% certain why this is needed, to be honest. Maybe something I don't get about Python and threads? This fixes double-announcements about connecting to the internet.
On the Mark 1 device, there is a sequence of events that produce a guide to the user for getting their device setup and connected to the internet. This process is basically:
* Enclosure client starts up, sending a message to the Arduino
* When/if the Arduino responds, it checks for a live internet connection
* If no connection is found, the user is prompted
However the speech client was sometimes not fully up, so the request to speak the prompt was sent before it was listening.
Additionally, sometimes events would occur that caused the prompt to connect the unit multiple time in a row. This commit limits the prompts to a max of once every 30 seconds.
Finally, I commented the code and renamed some of the methods to clarify this sequence of events. The code:
Timer(5, self.stop).start()
and:
def stop(self):
if not self.started:
self.writer.stop()
Are some of the most confusing lines of code I've ever seen. :)
Major changes:
* The messagebus message "enclosure.start" is now "enclosure.started"
* Enclosure.start() is now Enclosure.on_arduino_responded()
* Enclosure.started is now Enclosure.arduino_responded
* Added Enclosure.last_internet_notification to track notification times
* The notification call to the speech client is now delayed by 5 seconds, providing time for the speech client to come up. (And an additional check is run to verify the connection is still down immediately before the verbal prompt is spoken)
The restores the initial check on bootup for network connectivity,
prompting the user to plug in the network cable or push the button
to start Wifi setup.
NOTE: This will need to be localized and handled by different
enclosures.
Improved the way the button press is handled. Now the listener gives the rest
of the system a moment to consume the button press before it interprets it
as a request to begin listening.
Also replaced the use of the "buttonPress" signal when "expect_response"
was indicated with an utterance. Now the signal "startListening" is
created, differentiating it from a buttonPress.
This implements the handler for the Mark 1 menu item SSH > BLOCK (the inverse of SSH > ALLOW)
* Added handler for "unit.disable-ssh" on the serial line. This turns around and emits "mycroft.disable.ssh" on the messagebus.
* Removed the automatic reboot, just let the user know it will be different after a restart
* Made the spoken message translatable
* Changed mycroft.dialog.get() to not require the "lang" parameter. It will default to the mycroft.conf value.
* Adding localization mechanism for strings embedded in mycroft-core code
Added mycroft.dialog.get() function. This behaves much like the localization
mechanism for dialogs in Skills. So you can do things like this:
lang = "en-us"
str = mycroft.dialog.get("how are you", lang)
Which will look in mycroft/res/text for the dialog file containing strings to
use as templates for the actual output. This depends on the language being
currently used. When operating in English this would be:
mycroft/res/text/en-us/how are you.dialog
This function will pick a random line from that file to assign to str.
A more advanced use is to embed placeholders in the strings within the
template file.
lang = "en-us"
ctx = {"time" : "noon"}
str = mycroft.dialog.get("current time", lang, ctx)
And the random template line picked was "the current time is {{time}} ", then
the output would be:
"the current time is noon"
NOTE: this doesn't check for disk space and doesn't clean up
file stored in /tmp/ called mycroft_wake_sucess<time>.wav
TODO: some cleanup should be considered.
Signed-off-by: Art McGee <amcgee7@jaguarlandrover.com>
Improved the way the button press is handled. Now the listener gives the rest
of the system a moment to consume the button press before it interprets it
as a request to begin listening.
Also replaced the use of the "buttonPress" signal when "expect_response"
was indicated with an utterance. Now the signal "startListening" is
created, differentiating it from a buttonPress.
This implements the handler for the Mark 1 menu item SSH > BLOCK (the inverse of SSH > ALLOW)
* Added handler for "unit.disable-ssh" on the serial line. This turns around and emits "mycroft.disable.ssh" on the messagebus.
* Removed the automatic reboot, just let the user know it will be different after a restart
* Made the spoken message translatable
* Changed mycroft.dialog.get() to not require the "lang" parameter. It will default to the mycroft.conf value.
* Adding localization mechanism for strings embedded in mycroft-core code
Added mycroft.dialog.get() function. This behaves much like the localization
mechanism for dialogs in Skills. So you can do things like this:
lang = "en-us"
str = mycroft.dialog.get("how are you", lang)
Which will look in mycroft/res/text for the dialog file containing strings to
use as templates for the actual output. This depends on the language being
currently used. When operating in English this would be:
mycroft/res/text/en-us/how are you.dialog
This function will pick a random line from that file to assign to str.
A more advanced use is to embed placeholders in the strings within the
template file.
lang = "en-us"
ctx = {"time" : "noon"}
str = mycroft.dialog.get("current time", lang, ctx)
And the random template line picked was "the current time is {{time}} ", then
the output would be:
"the current time is noon"
NOTE: this doesn't check for disk space and doesn't clean up
file stored in /tmp/ called mycroft_wake_sucess<time>.wav
TODO: some cleanup should be considered.
Signed-off-by: Art McGee <amcgee7@jaguarlandrover.com>
* The wake up sound is now played synchronously, thus not included in the recorded audio
* The minimum recorded phrase must be at least 0.5 seconds (instead of 0.1), and must be continuously quiet for that duration
* The silence threshold is reset every time we begin listening for a wakeword
* The silence threshold adjusts upward to just above the ambient sound while waiting for the wake-word
* Reformatted some comments to use Google-style docstrings, and added more comments
* Added log filtering commands to the CLI. So you can do things within the CLI like:
:filter DEBUG (filters out any lines containing "DEBUG")
:filter remove DEBUG (stop filtering "DEBUG")
:filter "not this" (filters out any log lines containing "not this")
:filter list (displays active filters)
:filter clear (removes all filters)
* Added a ~/.mycroft-cli.conf configuration file. It currently contains the last-used filters.
* The mycroft.sh scripts were firing up the "fancy" CLI in the background and logging it constantly. This resulted in huge log files because of the constantly updated microphone level indicator.
* The chat history section now wraps long text strings
* Redesigned the section title to combine the header and underscore lines into a single line to save screen space
* Recolored several screen elements to make more sense. The query and the chat history now retain the cyan color, etc.
* The screen fully refreshes periodically, cleaning up garbage that might have accumulated from outside text being written to the terminal
* The mic meter no longer wraps around the screen when level numbers are too long
if expect_response flag is set to True the stt will be triggered just as if the wakeword has been received or the button on the mycroft enclosure has been pressed.
The utterance is now placed on the bus along with its language code. If not specified, it uses "en-us".
Added a new mycroft.util.parse module. It contains the normalize() function. Normalization currently does two things:
* Expands contractions ("they're" -> "they are", etc)
* Optionally removes articles ("a", "an", "the"). Removing is the default.
* Textual numbers become digits, up to 20. E.g. "What is the weather in four days" becomes "What is weather in 4 days".
NOTE: This is potentially a breaking change! Remove "the", "a" and "an" from your .voc files!
Skill changes:
* I cleaned up the .voc files for the default Skills.
* Split the date_time keyword into an extra entity. Now a "QueryKeyword.voc" exists, with "what|tell" instead of combing that into "what is time" in the TimeKeyword.voc.
* Volume skill now accepts 1-11, e.g. "turn volume to 11"
Main CLI enhancements:
* Microphone meter
* Long log line left/right scrolling
* Eliminated flicker
* VT100 ESC key code support (used by some terms)
In addition, to achieve the meter it was necessary to implement a mechanism for local Inter Process Communication (IPC). This is achieved using the file-system. By default a folder structure is created under /tmp/mycroft/ipc, but it can be directed to somewhere else by setting the config value in mycroft.conf:
"ipc_path" : "/path/to/somewhere"
In the future, Mark 1 and Picroft will get RAM disks to avoid burning out the SD card. This is also a very fast communication mechanism. This is all hidden under util.get_ipc_directory()
Further, the named signal mechanism was changed to use the IPC folder. The signal can have a lifetime now (not just one shot).
NOTE: this doesn't check for disk space and doesn't clean up
file stored in /tmp/ called mycroft_wake_sucess<time>.wav
TODO: some cleanup should be considered.
Signed-off-by: Art McGee <amcgee7@jaguarlandrover.com>
* Added "--simple" mode, to get the old cli behavior
* Rewrote to not use tail (works better with multiple log files)
* Added Ctrl+PgUp/Dn support for scrolling back in logs
* Added filtering
* Refined look and log coloring
* Added :help screen
* Added support for terminal resizing
* Uses curses
* Displays a "chat history" with requests and responses
* Shows filtered logs from mycroft-skills.log, mycroft-voice.log
* Start of framework for special ":" commands (for log searching, etc)
Max recording time is now 10 seconds instead of 30. This deals with cases where a noisy background prevents the listener's silence detection from triggering. 30 seconds was WAAY too long to keep listening -- nobody is going to be saying something that long for now.
This adds several refinements to the listening sound mechanism added by:
* Added a default sound file
* Allowing various ways to override "resource files" for customization
* Moved the sound configuration path from "confirm_ding" to
"sounds" > "start_listening"
* Also added "sounds" > "end_listening" configuration for the future
This submission adds the new mycroft.util.resolve_resource_file(res_name)
method. This method takes a name such as "snd/start_listening.wav" and
looks (in order):
* For an absolute path <res_name>
* For ~/.mycroft/<res_name>
* For /opt/mycroft/<res_name>
* For mycroft/res/<res_name> within the source package
This adds several refinements to the listening sound mechanism added by:
* Added a default sound file
* Allowing various ways to override "resource files" for customization
* Moved the sound configuration path from "confirm_ding" to
"sounds" > "start_listening"
* Also added "sounds" > "end_listening" configuration for the future
This submission adds the new mycroft.util.resolve_resource_file(res_name)
method. This method takes a name such as "snd/start_listening.wav" and
looks (in order):
* For an absolute path <res_name>
* For ~/.mycroft/<res_name>
* For /opt/mycroft/<res_name>
* For mycroft/res/<res_name> within the source package
* Listen confirmation
If enabled, will play a wave file to confirm that Mycroft is listening
* Listen confirmation ding config options
* Rename config option
* Update mycroft.conf
* Type: Rename config option
* Missing imports
Whoops, forgot them (was copying edits since I didn't have my dev environment set up)
* Removing unnecessary import functions
* "Input:" doesn't get intermingled with the output (usually -- long pauses can still cause it to happen)
* "Output:" is now displayed
* Ctrl+C is handled gracefully
This is a bit of a hack for Picroft. The analog audio on a Pi blocks
for 30 seconds fairly often, so we don't want to break on periods
(decreasing the chance of encountering the block). But we will
keep the split for non-Picroft installs since it give user feedback
faster on longer phrases.
The bug was actually fixed by doing a rebase, catching hotfixes which were missing from the dev branch.
The bug exposed this line of code, which was throwing an error without the quotes on the parameter to ping.
* Fixes issue #434. Developers working on both Cerberus and Home during the transition would have to re-pair.
Also bumping enclosure client version.
* Correcting error from when Tarturus code was merged. At startup it was calling Enclosure.system_reset(), which rebooted the Arduino, instead of implementing Enclosure.reset(), which sets the UI to a "ready for input" state.
While in here, I also added docstrings for all Enclosure API methods.
* Increment Arduino code version
* Adding a call to reset the face UI when the enclosure service starts up. This is needed because the enclosure.reset that is posted by the speech service on the messagebus sometimes occurs before the enclosure client is up and listening for it -- especially if there is a Arduino firmware upgrade.
In the future, we may want to consider a core service roll-call that gets triggered whenever any of the core services come up.
* Update dev_setup.sh
- Initialize tts ws and enclosure at the main process
Note:
- This is a minimal change to fix the problem.
- The ultimate goal is to have a totally isolated TTS process which requires its own main and ws initialization to be developed soon.
"enclosure.system.reset" on the messagebus (which was intended to
only reset the enclosure's visual elements) to simply "reset()" and
"enclosure.reset" to avoid confusion with the "system.reset" serial
port message (which resets the Arduino).
'platform' variable in 'enclosure' section, and if not found
the auto-detect will kick off. The mechanism used is issuing
a serial 'system.ping' and listening for the Mycroft Mark 1
Arduino to respond. This is a one-time event, since the
results get saved.
If the system is not a Mycroft Mark 1, it shuts itself down
so the enclosure message bus messages are simply ignored
on a generic Pi.
system_reset() that means the Enclosure appearance should be reset to
its defaults. The implementation of this is now a reset of both the
mouth and the eyes. This command gets sent to the Enclosure once the
speech client has fully opened its connection to the messagebus.
under. For now, only the 'mycroft-mark-1' is auto-detected by
attempting to send out a 'ping' over the serial line. The
auto-detect results are saved as a 'platform' in the
configuration file.
Since the current enclosure is designed to only work with Mark 1,
we shutdown the client in all other platform cases.
* Enhancing the Wifi setup process:
* When no intenet is detected, Mycroft now instructs user
to connect cable or tells how to start wifi setup
* Wifi setup talks user through connection process
* Setup will auto-shutdown after 5 minutes
* Completion screen now goes to cerberus.mycroft.ai to
allow registration immediately
(TODO: custom url/landing page to that will already have the pairing code)
* Changing the wording of the prompt message and slowing down the
rate at which the password is spoken.
* fixed pep8 error
* fixed mroe pep8 in listener.py
* -webkit-user-select: text;
* * Fixed iOS issues with password input
* Added SSID wrapping for unusually long network names
* Fixed need for left/right scrolling on small phone screens (e.g. iPhone 4/5)
* iOS devices now automatically open the screen after connecting to the MYCROFT network
* Tweaked Wifi setup instruction wording to make it easier to understand
* Fixed a potential bug with the flag used to stop the connection monitor
* Removed some temporary debugging code being used to track a very
specific issue with odd network names.
* Various small changes for the code review. Mainly deleting some dead
code and comment changes.
* Made the "not connected" message more Mimic-friendly by using the word
'browse' instead of 'login'.
* Increased the size of the password characters. They felt tiny at 13px on
previously on an iPad.
* - Added an auto-check for unit connection during the first 20 seconds when
a unit is turned on. If no connection to the internet is found, the user
is told how to get connected.
- Added calls to 'ping' to help rebuild the ARP table we previously cleared
in the test for lost connection
- Tweaked some terminology spoken to be more Mimic-friendly and understandable.
- Added automatic announcements every 45 seconds of the next step in the
process.
- Added automatic shutdown after 5 minutes
- Added announcement when the process is complete
- Added documentation and comments throughout
- Made things more "pythonic". Switched functions from camelCase to
python_style_names. Also used some underscore prefixes for private methods
that are really just implementation helpers.
* - The initial check for internet connectivity now happens 5 seconds after the system comes up instead of 20.
- Also added a space to tweak the pronunciation of an announcement
* Changes to the wifi setup portal
- Added a Cancel Setup button (shuts down the process)
- The Register Me button only appears once the browser can
reach cerberus.mycroft.ai. This prevents following the
link while phone is still connected to the temporary
access point or not connected back to the real network.
* Update version.txt
* Several changes related to button pressing on the Mycroft unit:
- Pressing the button when it isn't listening starts it listening
- Pressing the button when listening will stop the listen
- Added a mycroft.util.signal() mechanism for out-of-thread communication
- Pressing the button now creates an "buttonPress" signal from the Enclosure
- The viseme playback and aplay check for the 'buttonPress' signal to abort
- Removed "Sorry I didn't catch that", irritating during false activations
* Fixed spacing that pep8 yelled about
* working on a client for wi-fi setup
* added refactored code, ready to integrate
* client is running, now to handle the rest
* Staring touble in the face
* saved
* added config settings for wifi setup
* add an entry point for wifisetup to mycroft-base-setup.py
* moved SSID sorting into LinkUtils
* I'm now using the new SanAp class throughout
* Cleaning up code. All bash executions use bashThreadHandling class, mycroft's LOGGER
* removed legacy configuration parser
* funneling effort into cleanup
* fixed pep8, see if she builds
* changed entry point for init script
* changed import path to full path
* changed import path to full path for all files
* change ws port to 8080 for now
* pep8 in wifi.py fixed
* fixed a few more pep8 errors
* strange import stuff goign on
* strange import stuff goign on
* renamed wifi.py to prevent import conflict
* freeze pip requirement versions
* changed import path in LinkUtils
* changed import path again
* trying to fix wifi import.. something is wrong
* consumer and producer queues now working
* Consumer & producer API's are coming alogn
* Refactor: developing an API
* add ap up/down procedure to api
* looking googd
* removed some older code, api is nearly written
* success
* Sending conection status to browser is now working
* Fixed pep8 errors again
* removed blank line from file
* fixed entrypoint name
* added shutdown and save upon connect; reducing verbosity
* now disabling and flushing network on connection fail
* fix start.sh
* Corrected amount of arguments passed to wpa_cli_disable_network
* added iface to disable network
* added shutdown on success; restart wpa_supplicant upon ap up
* turning powersave mode off for wlan0
* removed wpa_cli flush
* fix some file restore and exit issues
* re enabled flush networks on fail
* powersave mode was logged but not executed
* stop and start dhcpcd withh ap up
* changed hostapd channel; bring links up and down after successful pair
* removed double quotes from the wpa_supplicant template
* Multiple files combined into util.py
* clean up some comments, added license headers
* what is up
* Ap mode event fires on enclosure event
* added logic for open network
* Changed empty passphrase from bool to empty string
* enclosure version bump
* changed ap down method in WiFiConsumer
* I'm now pulling all configuration from mycroft.ini and grabbing the mac address for ap ssid
* REFACTOR: removed util.py, as it was a bit messy
* REFACTOR: remove pep8 errors again, you would think that I would do this each time
* chagned some logic for open net
* open networks now function properly
* Reboot on success
* changed network save method
* Issues 356 - Setup wifi connection
- Removing tornado dependency
- Merging WS reader with Wifi process
* Issues 356 - Refactoring
- Using PyRIC and WIFI libs
* Issues 356 - Refactoring bash command
* Issues 356 - Refactoring FileUtils
* Issues 356 - WebClient refactoring
* Issues 356 - create password and loading pages
* Issues 356 - connecting
* Issues 356 - parsing data on ws
* Issues 356 - removing fake function on wifisetup
* Issues 356 - connecting on public network
* Issues 356 - show loading page on backbutton
* Issues 356 - sort networks by quality
* Issues 356 - Fixing message type variable
* Issues 356 - Adding more logs to wifi setup
* Issues 356 - network sort by quality
* Issues 356 - Fixing cell ssid param and using correct interface for scheme
* Issues 356 - Ensuring to save scheme before activating
* Issues 356 - Logging bash command
* Issues 356 - Refactoring wifi to P2P
* Issues 356 - Simplifying cli usage and getting results from wpa_cli
* Issues 356 - Parsing ssid and pass
* Issues 356 - Saving wpa configuration
* Issues 356 - Removing postfix in favor of wpa_supplicant config
* Issues 356 - Setting host to 0.0.0.0
* Issues 356 - Fixing parsing for wpa_cli output
* Issues 356 - Ensuring to save wpa config after connected
* Issues 356 - Setting interface for save config
* Issues 356 - Ensuring interfaces in all wpa cli
* Issues 356 - Creating, staring and stopping wifi web server
* Issues 356 - Adding logs to web server
* Issues 356 - create succes page and merge connect page on list page
* Issues 356 - Config.js server addr
* Issues 356 - Adding wifi status and connected control
* Issues 356 - lock margin top wifisetup
* Issues 356 - waiting connection
* Issues 356 - Moving dnsmasq backup logic to main.py
* Issues 356 - Cleaning imports
* Changed the base manifest to reflect new file locations
* fixed indent for pep8
* changed the mycroft-base-setup.py to reference the proper entry point for wifisetup
* Enclosure version bump
* Added the wifi index.html to the base manifest, as it doesn't seem to catch it recursively
* Issues 356 - Updating first setup flag after running the first time
* Issues 356 - Ensure to stop server only if it exists
* Issues 356 - Ensuring to set first setup to false when connected
* Issues 356 - Closing web server after shutdown
* Issues 356 - Running web server as daemon
* Issues 356 - Creating server connection only once at initialization
* Issues 356 - Disconnecting network before connecting and fixing get status
* Issues 356 - Starting web server only once after AP is up
* Issues 356 - Returning empty status if not able to parse
* Issues 356 - Creating web server loop control
* Issues 356 - Performing final request call in order to unblock server
* Issues 356 - Adding GET method to server request
* Issues 356 - Requesting web server to stop on main thread