Skip to content

sensor-climate-control/scc-local-server

Repository files navigation

scc-local-server

Equipment

Required Software

Should be pre installed, might need to install manually

Need to have Docker Desktop running if using a Windows machine

Used for testing, should work with other operating systems

Required Hardware

Used for testing, should work with other hardware

Docker Containers:

When "client_sub.py" is modified it is automatically compiled and sent to Docker Hub.

Configuration

Example compose.yml

services:

############################################################ MQTT Broker

  mosquitto:
    image: eclipse-mosquitto
    container_name: mqtt
    ports:
      - 1883:1883
      - 9001:9001
    restart: unless-stopped
    volumes:
      - ./mosquitto/config:/mosquitto/config
      - ./mosquitto/data:/mosquitto/data
      - ./mosquitto/log:/mosquitto/log

############################################################ MQTT Subscriber

  python-app:
    image: redfernj/scc-local-server-docker
    container_name: python
    volumes:
      - ./python/data:/usr/src/app/python/data
    env_file: .env

Example mosquitto.conf

persistence true
persistence_location /mosquitto/data
log_dest file /mosquitto/log/mosquitto.log

listener ??? # Your ip address
listener 1883
allow_anonymous true

Example .env

# Will the data revived from the MQTT server will be
# both - stored locally and uploaded to a web server
# remote - only uploaded to a web server
# local - only stored locally
UPLOAD=both

# IP address the machine the MQTT server will run on
IP=??? # Your ip address

# URL for where to send the data via PUT request
# - By default: https://osuscc-testing.azurewebsites.net
URL=https://osuscc.azurewebsites.net


# Authentication token to upload data to the server
TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2NDQwOTg5MjBiZGIzYjYwYjdkZWNhOGYiLCJpYXQiOjE2ODE5NTUxNTMsImV4cCI6MTcxMzQ5MTE1M30.gILdaaKY6PX7mEdeSkSRGHbnwZzlZG0xWz8678hvZf0

Example File Structure

./mosquitto/config/mosquitto.conf
./mosquitto/data
./mosquitto/log
./python/data
./.env
./compose.yml

Run

Start

docker compose up --build -d

Stop

docker compose down

About

This is the local server repository for the Oregon State University Sensor-Based In-Home Climate Control Capstone Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published