Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel83 committed Jan 8, 2017
2 parents 308a213 + 4032f84 commit b1d8753
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,16 @@ After this you will asked for the MashTun and the Boil kettle of the brew.
![ScreenShot](https://raw.githubusercontent.com/Manuel83/craftbeerpi/master/docs/images/Hardwaresetup.png)
![ScreenShot](https://raw.githubusercontent.com/Manuel83/craftbeerpi/master/docs/images/Hardwaresetup2.png)

## Use with CHIP computer

NextThing Co sells the [C.H.I.P. Computer](https://www.nextthing.co/pages/chip)
which offers similar functionality to a RaspberryPI. It is less expensive however,
and has 4GB storage plus wifi built in. Access to GPIO is available, and 1wire
thermometer devices are supported as well.

The 1wire device must send data in through port LCD-D2.

GPIO pin names can be found at [https://github.com/xtacocorex/CHIP_IO](https://github.com/xtacocorex/CHIP_IO)


## Start CraftBeerPI in Kiosk Mode
Expand Down Expand Up @@ -200,4 +209,4 @@ sudo reboot
![ScreenShot](http://craftbeerpi.com/examples/img6.jpg)
![ScreenShot](http://craftbeerpi.com/examples/img7.jpg)
![ScreenShot](http://craftbeerpi.com/examples/img8.jpg)
![ScreenShot](http://craftbeerpi.com/examples/img9.jpg)
![ScreenShot](http://craftbeerpi.com/examples/img9.jpg)
1 change: 1 addition & 0 deletions brewapp/base/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def initDriver():
'GEMBIRD': gembird.GembirdUSB(),
'PIFACE': piface.PiFace(),
'WIFISOCKET': wifisocket.WifiSocket(),
'CHIP-GPIO': chip_gpio.BrewGPIO()
}

thermometer = {
Expand Down
2 changes: 1 addition & 1 deletion brewapp/base/devices/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__all__ = ["dummygpio", "gembird", "gpio", "piface", "wifisocket"]
__all__ = ["dummygpio", "gembird", "gpio", "piface", "wifisocket", "chip_gpio"]
86 changes: 86 additions & 0 deletions brewapp/base/devices/chip_gpio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
from brewapp import app
from brewapp.base.actor import ActorBase

try:
from CHIP_IO import GPIO
app.logger.info("SETUP GPIO Module Loaded")
except Exception as e:
app.logger.error("SETUP GPIO Module " + str(e))


class BrewGPIO(ActorBase):

def init(self):
app.logger.info("INIT GPIO")
try:
app.logger.info(app.brewapp_hardware_config)
for h, hw in app.brewapp_hardware_config.items():
app.logger.info(hw)

g = hw["config"]["switch"]
app.logger.info(g)

if not g:
continue

app.logger.info("SETUP HARDWARE: " + str(h) + " GPIO: " + str(g))
GPIO.setup(g, GPIO.OUT)

if self.getConfigValue(h, "inverted", False):
app.logger.warning("SETUP INVERTED")
GPIO.output(g, GPIO.HIGH)
else:
app.logger.warning("SETUP NOT INVERTED")
GPIO.output(g, GPIO.LOW)

app.brewapp_gpio = True
self.state = True
app.logger.info("ALL GPIO INITIALIZED")

except Exception as e:
app.logger.error("SETUP GPIO FAILD " + str(e))
app.brewapp_gpio = False
self.state = False

def cleanup(self):
try:
GPIO.cleanup()
except Exception as e:
app.logger.error("CLEAN UP OF GPIO FAILD " + str(e))

def getDevices(self):
return ['U13_{}'.format(u) for u in range(19, 35)]

def switchON(self, device):
app.logger.info("GPIO ON" + str(device))
if not app.brewapp_gpio:
app.logger.warning("GPIO TEST MODE ACTIVE. GPIO is not switched on" + str(device))
return

switch_name = self.getConfigValue(device, "switch", None)
if switch_name is None:
app.logger.warning("SWITCH NOT FOUND IN CONFIG")

if self.getConfigValue(device, "inverted", False):
app.logger.warning("SWITCH ON - Inverted")
GPIO.output(switch_name, GPIO.LOW)
else:
app.logger.warning("SWITCH ON - Not Inverted")
GPIO.output(switch_name, GPIO.HIGH)

def switchOFF(self, device):
app.logger.info("GPIO OFF" + str(device))
if not app.brewapp_gpio:
app.logger.warning("GPIO TEST MODE ACTIVE. GPIO is not switched off" + str(device))
return

switch_name = self.getConfigValue(device, "switch", None)
if switch_name is None:
app.logger.warning("SWITCH NOT FOUND IN CONFIG")

if self.getConfigValue(device, "inverted", False):
app.logger.warning("SWITCH OFF - Inverted")
GPIO.output(switch_name, GPIO.HIGH)
else:
app.logger.warning("SWITCH OFF - Not Inverted")
GPIO.output(switch_name, GPIO.LOW)
1 change: 1 addition & 0 deletions brewapp/base/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def setHardware():
'GPIO': gpio.BrewGPIO(),
'GEMBIRD': gembird.GembirdUSB(),
'PIFACE': piface.PiFace(),
'CHIP-GPIO': chip_gpio.BrewGPIO()
}
app.brewapp_hardware = hardware.get(data["type"], dummygpio.DummyGPIO())
setConfigParameter("SWITCH_TYPE",data["type"] )
Expand Down
10 changes: 10 additions & 0 deletions brewapp/ui/static/partials/setup/actortype.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ <h3>GPIO</h3>
</div>
</div>
</div>
<div class="col-sm-3 ">
<div class="thumbnail ">
<img class="img-responsive" src="static/images/raspi.png"/>
<div class="caption">
<h3>CHIP GPIO</h3>
<p></p>
<button type="button" class="btn btn-primary" ng-click="setHardware('CHIP-GPIO')">Select</button>
</div>
</div>
</div>
<div class="col-sm-3 ">
<div class="thumbnail ">
<img class="img-responsive" src="static/images/piface.png"/>
Expand Down
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ THERMOMETER_TYPE:

SWITCH_TYPE:
value: GPIO
options: ['GPIO','PIFACE','GEMBIRD','WIFISOCKET','DUMMY']
options: ['GPIO','CHIP-GPIO', 'PIFACE','GEMBIRD','WIFISOCKET','DUMMY']
description: 'Actor Type !!!RESTART AFTER CHANGE OF THIS PARAMETER!!!'

SEND_STATS:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Werkzeug==0.11.10
WTForms==2.1
httplib2==0.9.2
Flask-SuperAdmin==1.7.1
CHIP_IO==0.2.6

0 comments on commit b1d8753

Please sign in to comment.