GithubHelp home page GithubHelp logo

aalu1418 / rpi-terminal-hub Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 703 KB

Raspberry Pi server for weather + IR controller for robot vacuum + Nook Simple Touch display

HTML 7.65% Go 92.35%
raspberry-pi eufy ir-emitter-receiver nook weather rpi

rpi-terminal-hub's Introduction

Raspberry Pi Terminal Hub

Turning a RPi into a server hub using Raspian OS Lite.

Credits: Icons created by @erikflowers

The main.go file contains the primary logic of continuously running the code. It handles starting and stopping the various underlying services.

NOTE: PWM usage requires root privleges

Configuration

  • --owm: For passing in the OpenWeatherMap api key. This can also be passed via an OWM environment variable
  • Configuration of variables in the code can be done via -ldflags
go run -ldflags "-X github.com/aalu1418/rpi-terminal-hub/types.WEATHER_LOCATION=hello" main.go
  • build + upload to RPi commands (using SSH)
env GOOS=linux GOARCH=arm GOARM=5 go build
scp rpi-terminal-hub pi@<rpi-ip>:/home/pi/

Modules

Various integrations for controlling / reporting devices and information.

[service] Web Server

The web server module provides an user facing endpoint for the weather panel, controlling the vacuum, and prometheus metrics host.

  • GET /: Main endpoint with a stylized HTML page for weather
  • POST /vacuum: Used for triggering the IR emitter to issue vacuum commands (start, stop, 30min, home)
curl -X POST -d "start" localhost:5000/vacuum
  • GET /metrics: prometheus metrics endpoint

[service] Weather

The weather service polls the OpenWeatherMap API for weather data and provides it in a consumable form to the Web Server.

Learn more here: https://openweathermap.org/api

[service] Vacuum

Uses the IR emitter to control the robotic vacuum and issue commands on a set schedule.

Original inspiration (actual circuit is slightly different): https://www.hackster.io/austin-stanton/creating-a-raspberry-pi-universal-remote-with-lirc-2fd581

[service] Alerts

Polling and parsing various endpoints to monitor for alerts. Currently supported:

  • NOAA/NWS weather alerts for given LAT/LON

[service] Connectivity

Polling a DNS service to determine internet connectivity. Information is reported to the metrics service.

[service] Metrics

Handles various incoming messages from other services and tracks accordingly using prometheus metrics.

Exporting to Grafana: https://grafana.com/oss/prometheus/exporters/node-exporter/

[service] Post Office

Message router for the various services to communicate.

[service] Base

Underlying service that provides base functionality for each services incoming and outgoing messages, frequency of processing, etc.

[GPIO] Infrared

Provides basic utilities for recording and emitting IR PWM signals

  • --emit-ir: flag for testing an IR signal
  • --record-ir: flag for recording an IR signal, prints out golang formatted time durations

Notes

Setting up SSH on RPi

Autorun on RPi using CRON

@reboot sleep 15 && sudo /home/pi/rpi-terminal-hub --owm=<API_KEY> >> ~/cron.log 2>&1

RPi Timezones

Server Inspiration

rpi-terminal-hub's People

Contributors

aalu1418 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

l3rd

rpi-terminal-hub's Issues

rewrite in Go!

The idea is for a cleaner, faster, more efficient code base

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.