NAME
mcpigdod.conf —
mcpigdod configuration
file
SYNOPSIS
DESCRIPTION
mcpigdod.conf is the configuration file for
mcpigdod(8). It is coupled
directly to hardware I developed for the Raspberry Pi2, and hence much of it
should not be modified.
mcpigdod.conf contains multiple stanzas. Each stanza contains
attributes (name:value pairs) or sub-stanzas. Stanzas are opened with a name
and
{ and closed with a
}. Attribute notation is
name:
value;
Comments start with
# and continue to the end of the line. Empty lines
are ignored.
Syslog stanza
The Syslog stanza contains settings for syslog.
- Facility: name;
- The syslog facility. This may
be one of "user", "daemon", "auth",
"local0", "local1", "local2",
"local3", "local4", "local5",
"local6" or "local7". The default is
"daemon".
- MinimumPriority: priority;
- The lowest priority that will
be logged. This may be "debug", "info",
"notice", "warning", "error",
"critical", "alert" or "emergency". The
default is "info".
- ShowFileLocations: boolean;
- If true, mcblockd will
show file and line number information in each syslog message. This is
typically set to false, but may be set to true during
development or debugging. The default is false.
An example Syslog stanza is shown below.
Syslog {
#--------------------------------------------------------------------
# Syslog facility.
#--------------------------------------------------------------------
Facility: local0;
#--------------------------------------------------------------------
# Minimum priority of log message to syslog.
#--------------------------------------------------------------------
MinimumPriority: info;
#--------------------------------------------------------------------
# Log source file location of syslog calls?
#--------------------------------------------------------------------
ShowFileLocations: true;
}
Location Stanza
The Location stanza is used to set the location of the server. Currently, it is
only used by
mcpigdowww(1), and only to
show a day or night scene when a garage door is open. An example is shown
below.
Location {
Latitude: 42.7907;
Longitude: -83.4177;
}
Server Stanza
The Server stanza is used to configure TCP and multicast parameters. It contains
two sub-stanzas.
- TCP sub-stanza
- The TCP sub-stanza is used to
configure TCP parameters of the
mcpigdod(8) server.
- Port: port_number;
- The port to which we'll
bind for TCP connections.
- Multicast sub-stanza
- The Multicast sub-stanza is
used to configure the multicast group address and port we will use when
sending status messages via multicast.
- Address: ipv4_address;
- The multicast group
address we will use when sending status messages via multicast.
- Port: port_number;
- The UDP port we will use
as the destination port when sending status messages via
multicast.
An example Server stanza is shown below.
#----------------------------------------------------------------------
# Server configuration.
#----------------------------------------------------------------------
Server {
#--------------------------------------------------------------------
# TCP configuration.
#--------------------------------------------------------------------
TCP {
#------------------------------------------------------------------
# Port on which to listen for TCP clients.
#------------------------------------------------------------------
Port: 2121;
}
#--------------------------------------------------------------------
# Multicast configuration.
#--------------------------------------------------------------------
Multicast {
#------------------------------------------------------------------
# Address to which we'll send door status. Clients may join this
# group to monitor garage door status.
#------------------------------------------------------------------
Address: 224.0.0.42;
#------------------------------------------------------------------
# Port to which we'll send door status.
#------------------------------------------------------------------
Port: 2121;
}
}
GarageDoor stanza
A GarageDoor stanza configures various bits of the garage door hardware. Other
than the
Name attribute and the
ClosingDirection attribute of
the
Encoder sub-stanza, this shouldn't be modified since it's directly
coupled to the hardware.
The hardware supports up to two garage doors, hence you may have up to two
GarageDoor stanzas.
- Name: name;
- The name of the door. The name
identifies the door in status queries. It should be a user-identifiable
name. For example, my home has two garage doors, so I name one of them
"North" and the other "South".
- ActivationChannel: channel;
- The GPIO channel used to
activate (close) the relay that will activate the door. On my printed
circuit board, GPIO channel 18 will open/close the circuit between pins 1
and 3 on connector X1. GPIO channel 17 will open/close the circuit between
pins 1 and 3 on connector X2.
- ActivationButton: channel;
- The door activation button's
GPIO channel. On my printed circuit board, pin 1 on connector X6
corresponds to GPIO channel 21 and pin 2 on connector X6 corresponds to
GPIO channel 20. The buttons must be momentary, normally-open type of
buttons, and active low. This is achieved by wiring one of the button
wires to PCB ground (available on pins 5 and 8 of connector X6).
- Encoder sub-stanza
- The Encoder sub-stanza
configures the rotary encoder for the garage door. The rotary encoder
tracks movement of the door.
- ClosingDirection: direction;
- Direction the encoder
moves when the door is closing. This is as seen with the shaft facing
the viewer (you). The value must be Clockwise or
CounterClockwise.
- Device: device;
- The rotary encoder device
associated with the encoder. I wrote the device driver for the rotary
encoders, and I only instantiation two of them. Hence this value must
be gpiorotenc0 or gpiorotenc1. These correspond to ENC0
and ENC1 on the X5 connector on my printed circuit board,
respectively.
- ClosedSwitch sub-stanza
- The ClosedSwitch
configures the magnetic switch that indicates whether or not the door is
closed. The switch is wired to one of CS0 or CS1 on my printed circuit
board.
- Channel: channel;
- The GPIO channel used to
receive the output of the magnetic switch that indicates the door is
closed.
- ClosedIsDoorClosed: bool;
- If the magnetic switch is
open when the door is closed, this should be false. If the
magnetic switch is closed when the door is closed, this should be
true.
- Indicator sub-stanza
- The Indicator
sub-stanza configures the LED indicator for the door.
- Red: channel;
- The GPIO channel for the
anode of the red LED. Must be one of 5, 6, 12 or 13. Channel 5
corresponds to pin 4 on connector X6 on my PCB. Channel 6 corresponds
to pin 7 on connector X6 on my PCB. Channel 12 corresponds to pin 3 on
connector X6 on my PCB. Channel 13 corresponds to pin 6 on connector
X6 on my PCB.
The cathode of the LED should be wired to pin 5 or pin 8 on connector
X6.
- Green: channel;
- The GPIO channel for the
andoe of the green LED. Must be one of 5, 6, 12 or 13. Channel 5
corresponds to pin 4 on connector X6 on my PCB. Channel 6 corresponds
to pin 7 on connector X6 on my PCB. Channel 12 corresponds to pin 3 on
connector X6 on my PCB. Channel 13 corresponds to pin 6 on connector
X6 on my PCB.
The cathode of the LED should be wired to pin 5 or pin 8 on connector
X6.
An example GarageDoor stanza is below.
#----------------------------------------------------------------------
# Configuration for my south garage door.
#----------------------------------------------------------------------
GarageDoor {
#--------------------------------------------------------------------
# The name of this garage door. Must be unique.
#--------------------------------------------------------------------
Name: "South";
#--------------------------------------------------------------------
# The GPIO channel used to activate the garage door opener
# (an output).
#--------------------------------------------------------------------
ActivationChannel: 18; # GPIO 18 is pin 12 on the R. Pi 2 header
#--------------------------------------------------------------------
# The GPIO for the button to activate the garage door opener
# (an input).
#--------------------------------------------------------------------
ActivationButton: 21; # GPIO 21 is pin 40 on the R. Pi 2 header
#--------------------------------------------------------------------
# Encoder configuration.
#--------------------------------------------------------------------
Encoder {
#------------------------------------------------------------------
# Direction the encoder moves when the door is closing. This is
# as seen with the shaft facing the viewer (you).
#------------------------------------------------------------------
ClosingDirection: CounterClockwise;
#------------------------------------------------------------------
# The gpiorotenc device for the garage door.
#------------------------------------------------------------------
Device: "gpiorotenc1";
}
#--------------------------------------------------------------------
# Door closed switch configuration.
#--------------------------------------------------------------------
ClosedSwitch {
#------------------------------------------------------------------
# The GPIO channel used to receive the output of the magnetic
# switch that indicates the door is closed.
#------------------------------------------------------------------
Channel: 19; # GPIO 19 is pin 35 on the R. Pi 2 header
#------------------------------------------------------------------
# If the magnetic switch is open when the door is closed, this
# should be false. If the magnetic switch is closed when the
# door is closed, this should be true.
#------------------------------------------------------------------
ClosedIsDoorClosed: true;
}
#--------------------------------------------------------------------
# Door indicator (LED) configuration.
#--------------------------------------------------------------------
Indicator {
#------------------------------------------------------------------
# The GPIO channel for the red LED.
#------------------------------------------------------------------
Red: 13;
#------------------------------------------------------------------
# The GPIO channel for the green LED.
#------------------------------------------------------------------
Green: 6;
}
}
SEE ALSO
mcpigdod(8),
mcpigdoc(1),
mcpigdowatch(1)
AUTHORS
Copyright (c) 2016 Daniel W. McRobb
dwm@mcplex.net