- A Holiday Happening
- A Life Size Brown Cardboard Bear
- Keenan Zucker
- Patrick Huston
This requires a running Bear server, and a Twilio ⟶ MQTT Gateway.
In class, you were given your Twilio phone number, and the credentials for The Bear server and Twilio gateway.
- Follow the Install instructions below.
- Run
python3 examples/sms_bear_gateway.py
- Send a text message to your Twilio phone number.
Make sure you have a running Python 3.6. Earlier versions of Python 3.x might work too, but haven't been tested. Python 2.x is Right Out.
Copy envrc.template
to .envrc
. On Linux/macOS: cp envrc.template .envrc
.
Replace the strings in .envrc
by your Twilio and MQTT credentials and phone number.
Execute: source .envrc
Or, optionally install direnv. This will prevent you from having to manually source .envrc
each time in the future.
Now continue to the "All Platforms" instructions.
On Windows, set an environment variable from the command line using:
setx MQTT_URL mqtt://…
Repeat for each variable in envrc.template
.
This adds entries to the Windows registry. You only need to do this once.
pip3 install -r requirements.txt
Send a test message. (Replace the number below by your own phone number.)
python3 scripts/send_sms_message.py +16175551010
Send a test message to the bear:
python3 mqtt_json/send_mqtt_message.py "forget about your worries"
Provision a RabbitMQ server. Or, use the same server as the Twilio ⟶ MQTT Gateway.
pip3 install -r requirements.txt
and create .envrc
, as above.
On Linux and Windows, install espeak.
On macOS, the server uses the built-in say
command, which has better quality.
python tts_worker.py
.
pytest
runs the unit tests (currently just of the mqtt_json
package).
pytest-watch
runs the tests in watch mode.
pytest --cov=. --cov-report html:coverage
generates a code coverage report.
Open ./coverage/index.html
to view it.
flake8 .
lints the code.
tox
runs the tests and linter in their own Python virtual environment.
This validates requirements.txt
, and could be used to test the code in
multiple different Python versions.
The SMS ⟶ Bear gateway example depends on the Twilio ⟶ MQTT Gateway.
Together with the Gateway, it looks like this:
Bear-as-a-Service was adapted from Patrick Huston's Holiday Bear, introduced at the Olin College December 2017 Holiday Party.
Jeff Goldenson came up with the “Bear as a Service” idea.
MIT