GitXplorerGitXplorer
b

Theorem-Interview-SmartAC

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
ef52730cc878649ce736c0b12c42f316a74823e0

reeeaaaalll quick and dirty tests

bbrandon-irl committed 4 years ago
Unverified
b12b437ca2d46596ae4a58a7dfe64c605f20747e

made script demo ready

bbrandon-irl committed 4 years ago
Unverified
e0bc4700940ac4daa687bfd52a757d0c6aead7b7

forgot to add new project to sln

bbrandon-irl committed 4 years ago
Unverified
57aabd641e9b649efd534e776fd2f4fc33eb03f9

updated readme and demo script

bbrandon-irl committed 4 years ago
Unverified
7fc55b84af8207acb1af526f5df845f63b64545a

Added demo and web build script and added to the readme

bbrandon-irl committed 4 years ago
Unverified
6492c9392625488befad90930e944019ee21672c

Added custom json serializer so that the scripts run

bbrandon-irl committed 4 years ago

README

The README file for this repository.

Image of air conditioner

Smart AC (Proof of Concept) 🧠

Prototype application written by Brandon Alexander for Theorem, LLC

Overview

Smart AC is a backend system designed to integrate with remote air conditioning units. It is comprised of three main services

  • Registration - handles authentication of remote AC units,provide tokens for the web API, and maintains state of registered devices
  • SensorReadingDataHub - provides API endpoints for air conditioners to report their data readings and supplies them to other services
  • Administration - generates alerts on reported data and allows admins to resolve them

All three services are hosted in an ASP.net app, which also hosts an administration web portal. This web app is the main is the entryway to the application (see "Running the app" below).

Image of services diagrom

Running the app 🖥

Prerequisites

  • .NET SDK 5
  • Any 32-bit encryption key

Steps 🟢

  • Clone the repo and navigate to the Web project in the repo
  • Set the AppSettings__EncryptionKey app setting to your encryption key. You can do this a few ways
  • dotnet build

Docker 🐳

The Web project can also be run in docker

cd /Web/build

build.ps1 -production [False|True] -key YOURENCRYPTIONKEY -certname YOURCERTNAME -certpw YOURCERTPASSWORD

  • Your app will be reachable at http://localhost:8000

⚠ NOTE: to use docker locally with HTTPS, you will need to set up your self-signed certificate and provide it to the container. See the ASP.NET docs

Testing the App ✔

cd ./src

dotnet test ⚠ NOTE: Testing framework is incomplete. Make sure you have the app reachable at https://localhost:8001 or the tests will fail

Endpoints 🌐

The available endpoints are documents with Swagger.

A brief explanation of the available endpoints:

POST ​/Authentication​/Authenticate

Authenticate remote device using device credentials. Returns authentication token

GET ​/Authentication​/Validate

Validate authentication token using the Authentication: Bearer header

POST /Registration/Register

Register a new device using device credentials. Return authentication token.

POST /Sensors/SubmitReading

Submit device sensor readings

ScreenShots 🖼

Notes 📝

Since this is a prototype application, there are some aspects that have been pared down or simulated.

  • Databases is SQLite, which has limitations inherent to it's in-process architecture (e.g. speed)
  • User sources are simulated very loosely
    • In the administration portal, any username/password will grant access
    • In the registration service, device serial numbers and secrets are hard coded on a file on disk
  • All separate services are hosted by the same ASP.Net web application for ease of deployment and configuration
  • There are no data verification or formatting restrictions beyond that of their underlying data type
  • Data views in the web portal are arbitrarily limited to 50 records
  • Common application functions such as error recovery, logging, and monitoring have been foregone
  • The application is standalone and is not supported by other services such as a reverse proxy or container orchestrator
  • There is no defined CI\CD process

made with 💙 by Brandon Alexander