Skip to content

Commit 594fedc

Browse files
committed
Add server code to project. Make client compatible with Edge and IE 11. Modify animation for better performance on Raspberry Pi. Add license and versioning. Add noise suppression to temperature/humidity readings. Add Reload button for reloading the client while it's in kiosk mode. Set up appropriate polyfills. Update README.
1 parent 3d7effa commit 594fedc

27 files changed

Lines changed: 1646 additions & 104 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# dependencies
1010
/node_modules
11+
/server/node_modules
1112

1213
# IDEs and editors
1314
/.idea

LICENSE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Astronomy/Weather Clock
2+
3+
Copyright © 2018 Kerry Shetline, kerry@shetline.com
4+
5+
### MIT
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
##Astronomy/Weather Clock
2+
3+
To test and build the web client project, you can use the following commands:
4+
- "`npm run build`" to build.
5+
- "`npm test`" to run unit tests.
6+
- "`npm start`" to serve the app using webpack-dev-server.
7+
- "`npm run e2e`" to run Protractor.
8+
9+
To run the weather server, use "`npm start`" from within the server directory.
10+
11+
The server requires a Dark Sky API key to function. Use the environment variable `DARK_SKY_API_KEY`
12+
to set the key. (See https://darksky.net/ for further details.)
13+
14+
To deploy the server along with the web client, use `npm run build` as described above, then copy the
15+
contents of the `dist` directory into the server's `public` directory.
16+
17+
If you are running the server on a Raspberry Pi, you have the option to provide indoor temperature and
18+
humidity data using a DHT22/AM2302 sensor, as seen here: https://www.amazon.com/HiLetgo-Temperature-Humidity-Electronic-Practice/dp/B01N9BA0O4/.
19+
The wiring I will describe is specifically for the AM2302 version of the DHT22, with the built-in pull-up
20+
resistor.
21+
22+
First, you must install the BCM 2835 library as described here: http://www.airspayce.com/mikem/bcm2835/
23+
24+
Then delete the file in the server directory named `package.json`, followed by renaming the file `package.json.for-dht-sensor.json`
25+
to `package.json`. Next run `npm install` from within the server directory.
26+
27+
With your Raspberry Pi shut down, and disconnected from power, connect the DHT22/AM2302 sensor.
28+
The code defaults to assuming the signal lead ("out") of the sensor is connected to GPIO 4 (pin 7 on the GPIO
29+
header). You can use the environment variable `SENSOR_GPIO` to set a different GPIO number.
30+
The + lead from the sensor needs to be connect to 5V (I chose pin 2 on the GPIO header) and
31+
the - lead needs to be connected to ground (I chose pin 6).
32+
33+
![Picture of wiring](http://shetline.com/misc/rpi-dht22-wiring.jpg)
34+
35+
The web client only displays the indoor temperature and humidity values when connected to the
36+
web server on `localhost:8080`.

package-lock.json

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "my-app",
3-
"version": "0.0.0",
2+
"name": "aw-clock",
3+
"version": "1.0.0",
44
"license": "MIT",
55
"scripts": {
66
"start": "webpack-dev-server --port=4200",
@@ -12,13 +12,13 @@
1212
},
1313
"private": true,
1414
"dependencies": {
15-
"core-js": "^2.4.1",
15+
"classlist-polyfill": "^1.2.0",
16+
"es6-shim": "^0.35.3",
1617
"jquery": "^3.3.1",
1718
"js-cookie": "^2.2.0",
1819
"ks-astronomy": "^1.0.1",
1920
"ks-date-time-zone": "^1.4.0",
20-
"rxjs": "^6.1.0",
21-
"zone.js": "^0.8.19"
21+
"rxjs": "^6.1.0"
2222
},
2323
"devDependencies": {
2424
"@types/jasmine": "~2.8.3",

rpi-dht22-wiring.jpg

77.3 KB
Loading

0 commit comments

Comments
 (0)