Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server implementation #1

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# GISMo Lab (SLAC Building 27) APIs

**WARNING: THIS REPOSITORY MUST REMAIN STRICTLY PRIVATE**

# System Architecture

![System Architecture](/docs/system_architecture.png)

The server is designed to run either inside or outside the network hosting the
devices. When running outside the network, the server must receiving incoming
device status updates and requests.

# General Commands

## Device Control

### Device Enrollment

Devices in the GISMo Lab must register with the internal server to permit user
access. This is done using the
`GET /device/<device_id>/start?token=device_key` API endpoint, where
`device_id` is the device identifier, and `device_key` is the current device
key. A single device key is used for all devices in a facility, which is
stored in `device_keys.py`.

GET /device/<device-id>/add?key=<device-key>

This request generates a device token to allow devices to access incoming and deliver
outgoing traffic from the facility.



##


# Server Start

Run the following:

~~~
cd source
python3 -m server
~~~

## Check status

Run the following command:

~~~
curl http://localhost:5001/
~~~

## Monitor

Setup the monitor in Marimo

~~~
cd source
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install pip --upgrade -r ../requirements.txt
~~~

Start the server

~~~
python3 server.py > server.log &
~~~

Run the monitor

~~~
marimo run monitor.py
~~~

## Online API docs

Run the following command:

~~~
curl http://localhost:5001/docs
~~~

## Swagger API

TODO

Binary file added docs/API Data Read - SGMP.docx
Binary file not shown.
Binary file added docs/ChargePoint API Updates.pdf
Binary file not shown.
Binary file not shown.
Binary file added docs/General Lab Information.docx
Binary file not shown.
Binary file added docs/PF Data Analytics API.pdf
Binary file not shown.
Binary file added docs/egauge-xml-api.pdf
Binary file not shown.
Binary file added docs/sonnen_API.pdf
Binary file not shown.
Binary file added docs/system_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pandas
flask
marimo
requests
xmltodict
AWSIoTPythonSDK
aiohttp
netifaces
plotly
flask-swagger
flask-request-arg
marshmallow
pyopenssl
1 change: 1 addition & 0 deletions source/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
facility_data.py
Loading