Skip to content
Merged

v4 #5

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions .github/workflows/balena-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: balenapush
on:
create:
tags:
- v*
jobs:
balenapush:
name: Push to Balena.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- run: npm install balena-cli -g --production --unsafe-perm
- run: balena login --token ${secrets.BALENA_API_TOKEN}
- run: balena push ${secrets.BALENA_APPLICATION_NAME}
working-directory: ./backend
64 changes: 64 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on: pull_request

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
54 changes: 3 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,51 +1,3 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

.idea
.idea
.vscode
**/node_modules/**
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
weather.port-tides.com
14 changes: 14 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM balenalib/%%BALENA_MACHINE_NAME%%-debian-node:15.10-buster

RUN install_packages gcc g++ python3 udev build-essential
ENV UDEV=1

WORKDIR /usr/src/app
COPY package.json ./package.json
COPY package-lock.json ./package-lock.json
RUN npm ci --only=production

COPY src/ ./

ENV NODE_ENV=production
CMD ["node", "/usr/src/app/main.js"]
14 changes: 0 additions & 14 deletions InternetAndPowerMonitoring/Dockerfile.template

This file was deleted.

1 change: 0 additions & 1 deletion InternetAndPowerMonitoring/index.html

This file was deleted.

12 changes: 0 additions & 12 deletions InternetAndPowerMonitoring/index.js

This file was deleted.

9 changes: 0 additions & 9 deletions InternetAndPowerMonitoring/main.py

This file was deleted.

11 changes: 0 additions & 11 deletions InternetAndPowerMonitoring/package.json

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017-2021 James Bithell

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.
50 changes: 47 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
http://blog.jbithell.com/post/162480345903/resinio-weather-station-on-the-raspberry-pi
# Porthmadog Sailing Club Weather Station

RESIN_HOST_CONFIG_dtparam "i2c_arm=on","spi=on","audio=on"
Live weather station for the Porthmadog Harbour & Estuary, powered by a Davis Vantage Vue weather station.

RESIN_HOST_CONFIG_enable_uart enabled
## Architecture

A Raspberry Pi Zero W running Balena.io connects to the Davis Vantage Pro2 weather station via a USB cable. The intention was that this would be in a microservices style, but in the end it was easier to just run everything in the same script as it helped the Pi Zero cope!
It uploads it to [windguru](https://windguru.cz) and [windy](https://windy.com)

## Versioning

This project uses [Semantic Versioning](https://semver.org/), paying more attention to them from `v4.0.0` onwards

## Debugging

Run `npm i` and `npm start`

If debugging on Windows you may need these drivers http://www.ftdichip.com/Drivers/VCP.htm to connect to the Vantage Vue over USB

## [Balena.io](https://balena.io) Configuration

### Device Variables

**Config Item**|**Default**
-----|-----
`LOG_LEVEL` | `silly`
`WINDY_API_KEY` | *none*
`WINDY_STATION_ID` | *none*
`WINDGURU_PASSWORD` | *none*
`WINDGURU_UID` | *none*

### Device Configuration Variables

Following config variables are required to get serial working:

**Config Item**|**Value**
-----|-----
`RESIN_HOST_CONFIG_dtparam` | `"i2c_arm=on","spi=on","audio=on"`
`RESIN_HOST_CONFIG_enable_uart` | `enabled`
`BALENA_HOST_CONFIG_dtoverlay` | `pi3-miniuart-bt`

Edit the config.txt in balena-boot partition of the SD card and append the following lines.
```
enable_uart=1
```

## Licence

This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
5 changes: 5 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security Policy

## Reporting a Vulnerability

Please drop me an email at hi@jbithell.com
40 changes: 0 additions & 40 deletions WeatherStationCoreLink/Dockerfile.template

This file was deleted.

Loading