-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpex-docs.html
More file actions
107 lines (107 loc) · 5.77 KB
/
Copy pathpex-docs.html
File metadata and controls
107 lines (107 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>pex-docs.html</TITLE>
<META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
<link href="../../themes/basic/base.css" rel="stylesheet" type="text/css"/>
</HEAD>
<BODY LANG="en-US" BGCOLOR="#ffffff" DIR="LTR" STYLE="border: none; padding: 0in">
<H1><A NAME="pex-plugin-documentation"></A>PEX Plugin
Documentation</H1>
<H2 CLASS="western"><A NAME="about-the-pex-plugin"></A>About the
PEX Plugin</H2>
<P>
The PEX plugin is used to replace the default SIP shift register.
PEX allows up to 128 stations to be controlled by the SIP irrigation controller.
</P>
<P>
<STRONG>Note: Only the MCP23017 has been tested with actual hardware.</STRONG><br>
Supported hardware: pcf8574 (8 ports), pc8575 (16 ports), mcp2308 (8 ports), mcp23017 (16 ports).<BR>
The PEX home page allows you to select the default IC type for your setup. The default
is preset to be the MCP23017 however it can be changed using the PEX configuration
editor on the home page or alternatively it can be set to your needs by editing the
file, SIP/plugins/port_externder/port_extender.py. Search for "create_default_config"
and change the string from u"mcp23017" to any of u"mcp2308", u"pcf8575", or u"pcf8574".
PEX also provides a simulated bus that allows for test/demo of the PEX plugin.
Demo Mode is also selected if the smbus library is missing. This allows you to test the
plugin without having any hardware io extender devices present.<BR>
</P>
<P>
The maximum number of devices (any combination) cannot exceed eight.
</P>
<BR>
<P>
When Autoconfigure is enabled, PEX scans the I2C bus at well known addresses (0x20 through 0x27)
for devices that respond to a bus write with an ACK handshake. All devices found are assumed to be of the
same type. The discovered devices are sequentially mapped to the SIP stations using the span
(8 or 16) of the selected default IC type.
</P>
<BR>
<P>
If Autoconfigure is disabled, PEX uses the last configuration saved to permanent storage to
configure the PEX controller.<BR>
There is no editor to manually configure the device configuration. The following describes a kludgy
workaround:
</P>
<OL>
<LI>On the PEX plugin page select "Demo mode", Autoconfigure, and specify the device type
for your hardware that needs to be manually configured.</LI>
<LI>Click the "SAVE" button. This will create a device configuration that satisfies the
SIP requirements for number of stations.</LI>
<LI>Return to the PEX plugin page and deselect autocofigure, then click the "SAVE" button.
This will save the current device configuration to permanent storage.</LI>
<LI>Using your favorite text editor, open the file SIP/data/pex_config.json. Replace every
occurrence of "SimulatedBus" with the bus id for your controller (either "0" or "1").
Note that this value is a quoted string. Most users will use the value "1" since nearly
all Raspberry Pi's use bus id "1" for the I2C bus. You may need to change the device
address for one or more of the autoconfigured devices if the devices on your system
are not mapped sequentially starting with 0x20. Search for the string, dev_addr and
replace with the address(es) of your device(s).</LI>
<LI> Save the modified file and restart SIP.</LI>
<OL>
<H2 CLASS="western"><A NAME="about-the-pex-files"></A>
The plugin includes the folowing files:</H2>
<UL>
<LI><P STYLE="margin-bottom: 0in"><STRONG>pex.py</STRONG><BR>
This python program provides the entry point for the PEX plugin.
It provides the fiddly bits needed to integrate PEX into the SIP UI.<BR>
Location: <STRONG>SIP/plugins</STRONG></P>
<LI><P STYLE="margin-bottom: 0in"><STRONG>port_extender.py</STRONG><BR>
Python module that creates the model for the PEX controller and
provides the runtime state.<BR>
Location: <STRONG>SIP/plugins/port_extender</STRONG></P>
<LI><P STYLE="margin-bottom: 0in"><STRONG>io_devices.py</STRONG><BR>
Python module used to control the supported devices
attached to the I2C bus. The four supported device types are:<BR>
pcf8574 pcf8575 mcp2308 mcp23017<BR>
Location: <STRONG>SIP/plugins/port_extender</STRONG></P>
<LI><P STYLE="margin-bottom: 0in"><STRONG>pex.html</STRONG><BR>
This file is a web.py template that creates the user interface for the plugin.
It generates the HTML data that is displayed on the PEX plugin page.<BR>
Location: <STRONG>SIP/templates</STRONG></P>
<LI><P STYLE="margin-bottom: 0in"><STRONG>pex-docs.html</STRONG><BR>This file.<BR>
Location: <STRONG>SIP/static/docs/plugins</STRONG></P>
<LI><P STYLE="margin-bottom: 0in"><STRONG>pex_plugin.manifest</STRONG><BR>A
text file containing a list of each of the plugin’s
files with the path to it’s location. The manifest is used by
the plugin manager to install and uninstall the plugin.<BR>
Location: <STRONG>SIP/plugins/manifests</STRONG></P>
<LI><P><STRONG>pex_config.json</STRONG><BR>Configuration file containing
persistant storage of port extender settings. It is created by the plugin
the first time it is run and is not installed with the other files.<BR>
Location: <STRONG>SIP/data</STRONG></P>
</UL>
<H2 CLASS="western"><A NAME="using-the-pex-plugin"></A>Using the
pex plugin</H2>
<P>This plugin is disabled by default. If you are reading this, the
PEX plugin is probably enabled on your system. Otherwise you can
enable it using the plugin manager or by setting the group
permissions of the <STRONG>pex.py</STRONG> file to <STRONG>executable</STRONG>.
Once it is enabled, and the SIP program has been restarted, You can
verify it is working by selecting it from the PLUGINS drop down menu
of the main program’s web interface. You should be taken to the
PEX home page.
</P>
</BODY>
</HTML>