Skip to content
/ homepi Public

HomePi is a raspberry-pi open-source project that works with relay boards to control GPIO pins!

Notifications You must be signed in to change notification settings

homepi/homepi

Repository files navigation

      __  __                     ____  _
      / / / /___  ________  ___  / __ \(_)
    / /_/ / __ \/ __  __ \/ _ \/ /_/ / /
  / __  / /_/ / / / / / /  __/ ____/ /
/_/ /_/\____/_/ /_/ /_/\___/_/   /_/

This project is under construction.

About HomePi

HomePI (SmartHome) is a web api application that works with raspberry pi and relay boards to control GPIO pins! This project works with an android app that you can find here https://github.com/HomePi/AndroidKotlin

Postman API Documentation

Features

  • 🚀 Custom accessories support
  • 🎉 Built with Golang

Environment variables

Required environment variables

HPI_SQLITE3_PATH=path/to/homepi.db
HPI_JWT_ACCESS_TOKEN=random-jwt-secret-access-token
HPI_JWT_REFRESH_TOKEN=random-jwt-secret-refresh-token

Optional environment variables

HPI_JWT_ACCESS_TOKEN_EXPIRES_AT=240 # a duration that an access_token could be valid (default "240 minutes")
HPI_JWT_REFRESH_TOKEN_EXPIRES_AT=1440 # a duration that an refresh_token could be valid (default "1440 minutes")

Run the docker image

$ docker run --restart always --device /dev/ttyAMA0:/dev/ttyAMA0 --device /dev/mem:/dev/mem --volume ./db/data:/code/db/data --privileged -dp 55283:55283 homepi/homepi

docker-compose example

version: '3'

services:
  api:
    container_name: homepi
    image: homepi/homepi
    ports:
      - 55283:55283
    environment:
      HPI_DB_DRIVER: "sqlite"
      HPI_DB_PATH: "/db/data/homepi.db"
      HPI_JWT_ACCESS_TOKEN: "random-jwt-secret-access-token"
      HPI_JWT_REFRESH_TOKEN: "random-jwt-secret-refresh-token"
      HPI_JWT_ACCESS_TOKEN_EXPIRES_AT: "240"
      HPI_JWT_REFRESH_TOKEN_EXPIRES_AT: "1440"
    restart: always
    devices:
      - /dev/ttyAMA0:/dev/ttyAMA0
      - /dev/mem:/dev/mem
    privileged: true
    volumes:
      - homepi-db:/db/data/
    networks:
      - homepi

volumes:
  homepi-db:

networks:
  homepi:
    driver: bridge

Contributing

Thank you for considering contributing to the HomePi project!

License

The HomePI is open-source software licensed under the MIT license.