Skip to content

Commit

Permalink
Preparing for cloud stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
atbrask committed Nov 21, 2018
1 parent 214d9dc commit c7b2b79
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
7 changes: 4 additions & 3 deletions Backend/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
### Backend for "atbrask's Sensor Nodes v1.0"
Copyright (c) 2014-2017 A.T.Brask <[email protected]> (Except included libs)
Copyright (c) 2014-2018 A.T.Brask <[email protected]> (Except included libs)
All rights reserved

Version history:
* v1.5 (2018-11-21) Upgraded to piCore 9.0.3 and enabled HTTPS support.
* v1.4 (2017-01-16) Upgraded to piCore 8.0 and InfluxDB >=1.0
* v1.3 (2016-01-22) Added support for 433MHz sensors. Lots of refactoring.
* v1.2 (2015-11-11) Fixed compatibility issues
Expand Down Expand Up @@ -39,7 +40,7 @@ called piCore.
* Optional: A 433MHz receiver and a bunch of compatible sensors (see below)
* A bunch of "atbrask's Sensor Nodes"
* A running [InfluxDB](http://influxdb.com) server
* A [disk image of piCore 8.0](http://tinycorelinux.net/8.x/armv6/releases/RPi/piCore-8.0.zip) (+ basic knowledge about how to use it)
* A [disk image of piCore 9.0.3](http://tinycorelinux.net/9.x/armv6/releases/RPi/piCore-9.0.3.zip) (+ basic knowledge about how to use it)
* Knowledge of the python programming language
* An internet connection :-)

Expand Down Expand Up @@ -88,7 +89,7 @@ PiCore exposes on these pins. When this is done, the receiver streams data
to /dev/ttyAMA0 whenever it receives some.

#### Installation
* Install piCore 8.0 onto an SD card using `dd` or similar tool.
* Install piCore 9.0.3 onto an SD card using `dd` or similar tool.
* Plug in the SD card and boot the Pi.
* Log in to the system using SSH (username `tc` and password `piCore`).
* Change the password to something else using `passwd`.
Expand Down
6 changes: 3 additions & 3 deletions Backend/RPIWeather/InfluxDBSender.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RPIWeather Data Gateway
# Copyright (c) 2014-2017 A.T.Brask <[email protected]>
# Copyright (c) 2014-2018 A.T.Brask <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
Expand All @@ -21,8 +21,8 @@
from influxdb import InfluxDBClient

class InfluxDBSender:
def __init__(self, host, port, username, password, database, table, namemap, dataqueue, logger):
self.db = InfluxDBClient(host, port, username, password, database)
def __init__(self, host, port, ssl, verify_ssl, username, password, database, table, namemap, dataqueue, logger):
self.db = InfluxDBClient(host, port, username, password, database, ssl, verify_ssl)
self.table = table
self.namemap = namemap # id -> name
self.dataqueue = dataqueue
Expand Down
20 changes: 11 additions & 9 deletions Backend/rpiweather.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

# RPIWeather Data Gateway
# Copyright (c) 2014-2017 A.T.Brask <[email protected]>
# Copyright (c) 2014-2018 A.T.Brask <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -43,12 +43,14 @@
magicnumber = 0x20130928

# Database settings
host = "192.168.1.251"
port = 8086
username = "gateway"
password = "thomas"
database = "RPIWeather"
table = "sensordata"
host = "192.168.1.251"
port = 8086
ssl = False
verify_ssl = False
username = "gateway"
password = "thomas"
database = "RPIWeather"
table = "sensordata"

# 433 MHz receiver settings
serialPort = '/dev/ttyAMA0'
Expand Down Expand Up @@ -96,7 +98,7 @@
handler.setFormatter(formatter)
logger.addHandler(handler)

logger.info("RPIWeather Data Gateway (c) 2014-2017 atbrask")
logger.info("RPIWeather Data Gateway (c) 2014-2018 atbrask")

# Start data queue
dataqueue = Queue.Queue()
Expand All @@ -107,7 +109,7 @@
BMPSampler.BMPSampler(bmpSampleInterval, heightAboveSeaLevel, dataqueue, logger).start()

# Start data sender
InfluxDBSender.InfluxDBSender(host, port, username, password, database, table, namemap, dataqueue, logger).start()
InfluxDBSender.InfluxDBSender(host, port, ssl, verify_ssl, username, password, database, table, namemap, dataqueue, logger).start()

# Wait forever
logger.info("RPIWeather Data Gateway start-up completed!")
Expand Down
2 changes: 1 addition & 1 deletion Backend/setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name = 'RPIWeather',
version = '1.4.0',
version = '1.5.0',
author = 'A.T.Brask',
author_email = '[email protected]',
description = 'Weather station based on nRF24L01, DHT22, ATtiny84, and a Raspberry Pi',
Expand Down

0 comments on commit c7b2b79

Please sign in to comment.