Skip to content

Commit

Permalink
Add API information
Browse files Browse the repository at this point in the history
  • Loading branch information
lbussy committed Sep 28, 2019
1 parent d82638b commit 4a67dc0
Show file tree
Hide file tree
Showing 32 changed files with 475 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"restructuredtext.confPath": "${workspaceFolder}",
"cSpell.words": [
"unweildy"
]
"cSpell.words": []
}
Binary file added _build/doctrees/api/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/automated/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/automated/security.doctree
Binary file not shown.
Binary file modified _build/doctrees/devices/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/environment.pickle
Binary file not shown.
Binary file modified _build/doctrees/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/manual/arduino.doctree
Binary file not shown.
Binary file modified _build/doctrees/manual/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/multi/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/rpi/index.doctree
Binary file not shown.
Binary file modified _build/doctrees/update/index.doctree
Binary file not shown.
Binary file added _build/html/.doctrees/api/index.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/automated/index.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/automated/security.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/devices/index.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/environment.pickle
Binary file not shown.
Binary file modified _build/html/.doctrees/index.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/manual/arduino.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/manual/index.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/rpi/index.doctree
Binary file not shown.
Binary file modified _build/html/.doctrees/update/index.doctree
Binary file not shown.
Binary file added _build/html/_images/api.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions _build/html/_sources/api/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
BrewPi Remix API
================

BrewPi Remix functions via interopeation of three different parts of the project:

- Firmware - This is the compiled application running on the controller
- Scrips - Python and shell scripts designed to receive and make available data from the controller, and send commands back to the controller
- Web Pages - A web application written in PHP and JavaScript

.. image:: api.png

Communication takes place in the following manner:

- Firmware <-> Script: The Python Script on the Raspberry Pi opens serial communications over the USB cable with the Arduino Controller. Two way communication is possible via specially formatted JSON messages.
- Web Server <-> Script: A PHP socket called `BEERSOCKET` is created within the filesystem. This socket allows two-way communications between the web server and the Script via specially formatted messages.
- End User <-> BrewPi Remix - The end user opens a web page served by Apache 2 running on the Raspberry Pi. The web pages are written in PHP and JavaScript. The web server allows commands to be sent to the Script via the `BEERSOCKET` and the Script in turn will communicate with the Controller as needed. Data to display on the web page is sent to the web server throgh `BEERSOCKET` as well as filesystem information.

Arduino Commands
----------------

The following commands are issued by the Script to the Arduino Controller. If desired, these commands may be sent to the Controller through a terminal emulator.

- A - Alarm on
- a - Alarm off
- t - Request temperatures
- C - Set default constants
- S - Set default settings
- s - Request control settings
- c - Request control constants
- v - Request control variables
- n - Request firmware version information
- l - Request LCD contents
- j - Set settings as JSON
- e - Request contents of EEPROM
- E - Initialize EEPROM
- d - Request devices in EEPROM order
- U - Update device
- h - Request hardware
- Z - Zap EEPROM (in DEBUG mode only)
- R - Reset controller

Arduino Message Types
---------------------

The following characters define the JSON message type sent to and returned by the Controller. They are hte first character of the JSON message.

- T - Temperature info
- D - Debug message
- L - LCD content
- C - Control constants
- S - Control settings
- V - Control variables
- N - Version number
- h - Available devices
- d - Installed devices
- U - Device update confirmation

BEERSOCKET Commands
-------------------

The following messages are sent through the `BEERSOCKET` from the web server to the Script. These may also be send manually using the `{web_root}\sockettest.php` page.

- ack - Acknowledge request (test message)
- lcd - Request LCD contents from script
- getMode - Request mode setting from script
- getFridge - Request fridge temperature setting from script
- getBeer - Request beer temperature setting from script
- getControlConstants - Request control constants from script
- getControlSettings - Request control settings from script
- getControlVariables - Request control variables from script
- refreshControlConstants - Request control constants from controller
- refreshControlSettings - Request control settings from controller
- refreshControlVariables - Request control variables from controller
- loadDefaultControlSettings - Reset control settings to default
- loadDefaultControlConstants - Reset control constants to default
- setBeer - Set new beer constant temperature
- setFridge - Set new fridge constant temperature
- setOff - Set mode to OFF
- setParameters -
- stopScript - Stop script, write semaphore
- quit - Quit but do not write semaphore
- eraseLogs - Erase stderr and stdout logs
- interval - Set new logging interval
- startNewBrew - Set new beer name
- pauseLogging - Pause logging, may be resumed
- stopLogging - Stop logging, may not resume
- resumeLogging - Resume logging
- dateTimeFormatDisplay - Change date time format
- setActiveProfile - Set a new beer profile
- programController or programArduino - Reprogram controller
- refreshDeviceList - Request devices from controller
- getDeviceList - Request device list from script
- applyDevice - Create device settings
- writeDevice - Configure a device
- getVersion - Get firmware version from controller
- resetController - Erase EEPROM

Config.cfg Settings
-------------------

These settings control how the application behaves. They are set in the `{app_home}/settings/config.cfg` file. Not all are mandatory.

- altport - Checks this port definition if the controller is not found on "port"
- beerName - Name of the beer currently being logged
- dataLogging - Defined whether data loogging is active, paused, or stopped
- interval - Time period between data points
- iSpindel - Defines use of iSpindel (not currently in use)
- logJson - Log received line if True, False only logs 'New JSON received.', not defined mutes JSON messages
- port - Port at which the script will communicate with the controller. If 'auto' it will connect to the first controller found on the USB bus. May also be explicit such as /dev/ttyACM0 or /dev/chamber1
- scriptPath - Path where the brewpi.py script may be found
- tiltColor - Color of currently connected Tilt
- wwwPath - Path to current chamber's website
- useInetSocket - Windows only, set to true to allow Inet socket use
- socketPort - Windows only, set to port for socket (default 6332)
- socketHost - Windows only, set to IP address for socket (default localhost)
- arduinoHome = Set to location of arduinoHome, defaults to /usr/share/arduino
- avrdudeHome = Set to location of avrdude, defaults to arduinoHome/hardware/tools/
- avrsizeHome = Set to location of avrsize, defaults to empty string because avrsize is in path on Linux
- avrConf = Set to location of avrdude.conf, defaults to avrdudeHome/avrdude.conf
- boardType = Defaults to 'arduino', no longer used
- outputJson - Whether to log every JSON we receive from controller; true = yes, false = short message only, no indication of JSON messages will be logged if not configured
1 change: 1 addition & 0 deletions _build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This documentation is intended for the beginner, who has to find a teenager just
./manual/arduino.rst
./multi/index.rst
./update/index.rst
./api/index.rst

.. Indices and tables
.. ==================
Expand Down
217 changes: 217 additions & 0 deletions _build/html/api/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@


<!doctype html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BrewPi Remix API &#8212; BrewPi Remix 0.5.3 documentation</title>
<link rel="stylesheet" href="../_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/bizstyle.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="nav-item nav-item-0"><a href="../index.html">BrewPi Remix 0.5.3 documentation</a> &#187;</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">BrewPi Remix API</a><ul>
<li><a class="reference internal" href="#arduino-commands">Arduino Commands</a></li>
<li><a class="reference internal" href="#arduino-message-types">Arduino Message Types</a></li>
<li><a class="reference internal" href="#beersocket-commands">BEERSOCKET Commands</a></li>
<li><a class="reference internal" href="#config-cfg-settings">Config.cfg Settings</a></li>
</ul>
</li>
</ul>

<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/api/index.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>

<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">

<div class="section" id="brewpi-remix-api">
<h1>BrewPi Remix API<a class="headerlink" href="#brewpi-remix-api" title="Permalink to this headline"></a></h1>
<p>BrewPi Remix functions via interopeation of three different parts of the project:</p>
<ul class="simple">
<li>Firmware - This is the compiled application running on the controller</li>
<li>Scrips - Python and shell scripts designed to receive and make available data from the controller, and send commands back to the controller</li>
<li>Web Pages - A web application written in PHP and JavaScript</li>
</ul>
<img alt="../_images/api.png" src="../_images/api.png" />
<p>Communication takes place in the following manner:</p>
<ul class="simple">
<li>Firmware &lt;-&gt; Script: The Python Script on the Raspberry Pi opens serial communications over the USB cable with the Arduino Controller. Two way communication is possible via specially formatted JSON messages.</li>
<li>Web Server &lt;-&gt; Script: A PHP socket called <cite>BEERSOCKET</cite> is created within the filesystem. This socket allows two-way communications between the web server and the Script via specially formatted messages.</li>
<li>End User &lt;-&gt; BrewPi Remix - The end user opens a web page served by Apache 2 running on the Raspberry Pi. The web pages are written in PHP and JavaScript. The web server allows commands to be sent to the Script via the <cite>BEERSOCKET</cite> and the Script in turn will communicate with the Controller as needed. Data to display on the web page is sent to the web server throgh <cite>BEERSOCKET</cite> as well as filesystem information.</li>
</ul>
<div class="section" id="arduino-commands">
<h2>Arduino Commands<a class="headerlink" href="#arduino-commands" title="Permalink to this headline"></a></h2>
<p>The following commands are issued by the Script to the Arduino Controller. If desired, these commands may be sent to the Controller through a terminal emulator.</p>
<ul class="simple">
<li>A - Alarm on</li>
<li>a - Alarm off</li>
<li>t - Request temperatures</li>
<li>C - Set default constants</li>
<li>S - Set default settings</li>
<li>s - Request control settings</li>
<li>c - Request control constants</li>
<li>v - Request control variables</li>
<li>n - Request firmware version information</li>
<li>l - Request LCD contents</li>
<li>j - Set settings as JSON</li>
<li>e - Request contents of EEPROM</li>
<li>E - Initialize EEPROM</li>
<li>d - Request devices in EEPROM order</li>
<li>U - Update device</li>
<li>h - Request hardware</li>
<li>Z - Zap EEPROM (in DEBUG mode only)</li>
<li>R - Reset controller</li>
</ul>
</div>
<div class="section" id="arduino-message-types">
<h2>Arduino Message Types<a class="headerlink" href="#arduino-message-types" title="Permalink to this headline"></a></h2>
<p>The following characters define the JSON message type sent to and returned by the Controller. They are hte first character of the JSON message.</p>
<ul class="simple">
<li>T - Temperature info</li>
<li>D - Debug message</li>
<li>L - LCD content</li>
<li>C - Control constants</li>
<li>S - Control settings</li>
<li>V - Control variables</li>
<li>N - Version number</li>
<li>h - Available devices</li>
<li>d - Installed devices</li>
<li>U - Device update confirmation</li>
</ul>
</div>
<div class="section" id="beersocket-commands">
<h2>BEERSOCKET Commands<a class="headerlink" href="#beersocket-commands" title="Permalink to this headline"></a></h2>
<p>The following messages are sent through the <cite>BEERSOCKET</cite> from the web server to the Script. These may also be send manually using the <cite>{web_root}sockettest.php</cite> page.</p>
<ul class="simple">
<li>ack - Acknowledge request (test message)</li>
<li>lcd - Request LCD contents from script</li>
<li>getMode - Request mode setting from script</li>
<li>getFridge - Request fridge temperature setting from script</li>
<li>getBeer - Request beer temperature setting from script</li>
<li>getControlConstants - Request control constants from script</li>
<li>getControlSettings - Request control settings from script</li>
<li>getControlVariables - Request control variables from script</li>
<li>refreshControlConstants - Request control constants from controller</li>
<li>refreshControlSettings - Request control settings from controller</li>
<li>refreshControlVariables - Request control variables from controller</li>
<li>loadDefaultControlSettings - Reset control settings to default</li>
<li>loadDefaultControlConstants - Reset control constants to default</li>
<li>setBeer - Set new beer constant temperature</li>
<li>setFridge - Set new fridge constant temperature</li>
<li>setOff - Set mode to OFF</li>
<li>setParameters -</li>
<li>stopScript - Stop script, write semaphore</li>
<li>quit - Quit but do not write semaphore</li>
<li>eraseLogs - Erase stderr and stdout logs</li>
<li>interval - Set new logging interval</li>
<li>startNewBrew - Set new beer name</li>
<li>pauseLogging - Pause logging, may be resumed</li>
<li>stopLogging - Stop logging, may not resume</li>
<li>resumeLogging - Resume logging</li>
<li>dateTimeFormatDisplay - Change date time format</li>
<li>setActiveProfile - Set a new beer profile</li>
<li>programController or programArduino - Reprogram controller</li>
<li>refreshDeviceList - Request devices from controller</li>
<li>getDeviceList - Request device list from script</li>
<li>applyDevice - Create device settings</li>
<li>writeDevice - Configure a device</li>
<li>getVersion - Get firmware version from controller</li>
<li>resetController - Erase EEPROM</li>
</ul>
</div>
<div class="section" id="config-cfg-settings">
<h2>Config.cfg Settings<a class="headerlink" href="#config-cfg-settings" title="Permalink to this headline"></a></h2>
<p>These settings control how the application behaves. They are set in the <cite>{app_home}/settings/config.cfg</cite> file. Not all are mandatory.</p>
<ul class="simple">
<li>altport - Checks this port definition if the controller is not found on “port”</li>
<li>beerName - Name of the beer currently being logged</li>
<li>dataLogging - Defined whether data loogging is active, paused, or stopped</li>
<li>interval - Time period between data points</li>
<li>iSpindel - Defines use of iSpindel (not currently in use)</li>
<li>logJson - Log received line if True, False only logs ‘New JSON received.’, not defined mutes JSON messages</li>
<li>port - Port at which the script will communicate with the controller. If ‘auto’ it will connect to the first controller found on the USB bus. May also be explicit such as /dev/ttyACM0 or /dev/chamber1</li>
<li>scriptPath - Path where the brewpi.py script may be found</li>
<li>tiltColor - Color of currently connected Tilt</li>
<li>wwwPath - Path to current chamber’s website</li>
<li>useInetSocket - Windows only, set to true to allow Inet socket use</li>
<li>socketPort - Windows only, set to port for socket (default 6332)</li>
<li>socketHost - Windows only, set to IP address for socket (default localhost)</li>
<li>arduinoHome = Set to location of arduinoHome, defaults to /usr/share/arduino</li>
<li>avrdudeHome = Set to location of avrdude, defaults to arduinoHome/hardware/tools/</li>
<li>avrsizeHome = Set to location of avrsize, defaults to empty string because avrsize is in path on Linux</li>
<li>avrConf = Set to location of avrdude.conf, defaults to avrdudeHome/avrdude.conf</li>
<li>boardType = Defaults to ‘arduino’, no longer used</li>
<li>outputJson - Whether to log every JSON we receive from controller; true = yes, false = short message only, no indication of JSON messages will be logged if not configured</li>
</ul>
</div>
</div>


</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="nav-item nav-item-0"><a href="../index.html">BrewPi Remix 0.5.3 documentation</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2019, Lee C. Bussy.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions _build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ <h1>BrewPi Remix Documentation<a class="headerlink" href="#brewpi-remix-document
<li class="toctree-l2"><a class="reference internal" href="update/index.html#updating-multi-chamber">Updating Multi-Chamber</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="api/index.html">BrewPi Remix API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="api/index.html#arduino-commands">Arduino Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/index.html#arduino-message-types">Arduino Message Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/index.html#beersocket-commands">BEERSOCKET Commands</a></li>
<li class="toctree-l2"><a class="reference internal" href="api/index.html#config-cfg-settings">Config.cfg Settings</a></li>
</ul>
</li>
</ul>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion _build/html/objects.inv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
# Project: BrewPi Remix
# Version:
# The remainder of this file is compressed using zlib.
x�mR�n�0��+�Ҩ������K~ ?���5����f<�3�b�F�'~����_��p��S�Wn3O�<J�^�ߖ�r�V��:X��sϙ�l+<��8����1ӎHһ�/�D�n�7��#�a�U/�"98�h?�Ov�y�jAAJ��a�H��4S��+Z�6[��IF�5�E������6�[�$K6һ50e�I宿�D�� ���*H/N��pA�!{6]��[TYq��%(Q��>���N|p��N���c����ں�KX2*�cC,t<��q�O��ZM����&
x�u�Mn�0��>�\ ���.M6Y !P0����6ܾv 
ݡ�x�g쇽8
�� ��n8�N�[畄OKߥ���x©�2 �(��w�k+N�W�<J�^�1�@GM������w<ԣ�8}���v����g���9��`��K������$aRs��>���n�b��H���L�(�hy�,�k'�JkZ�J�s��;a6C,��Y���z� �Y���9��AҸ�
��g!�P�N���c�ܡ��u��w5*�
]E;�*ؽB�?�D'���2�.hfA�9B�t�Ų�Au�Kl���ǎm�^�9uKJ�jl��9-
Expand Down

0 comments on commit 4a67dc0

Please sign in to comment.