Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #232 from DewGew/beta
Browse files Browse the repository at this point in the history
Merge Beta to Master
  • Loading branch information
DewGew authored Nov 27, 2020
2 parents 4cfd8b3 + 151734b commit 9d389f2
Show file tree
Hide file tree
Showing 233 changed files with 57,918 additions and 686 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ FROM jfloff/alpine-python:3.7-slim
RUN mkdir -p config

COPY *.py /
COPY *.html /
COPY templates/ /templates/
COPY static/ /static/
COPY requirements/pip-requirements.txt /requirements.txt

# Create volume
Expand All @@ -15,4 +16,4 @@ VOLUME /config
# Configure Services and Port
CMD ["python3 /__main__.py"]

EXPOSE 3030
EXPOSE 3030
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Travis (.com)](https://img.shields.io/travis/com/dewgew/Domoticz-Google-Assistant?logo=travis)](https://travis-ci.com/DewGew/Domoticz-Google-Assistant) [![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/dewgew/domoticz-google-assistant?logo=docker)](https://hub.docker.com/r/dewgew/domoticz-google-assistant) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/dewgew/Domoticz-Google-Assistant?logo=github) [![Discord](https://img.shields.io/discord/664815298284748830?logo=discord)](https://discordapp.com/invite/AmJV6AC)
# Domoticz-Google-Assistant

<img src="dzga_UI.png" alt="drawing" width="600"/>
<img src="dzga_UI.png" alt="drawing" width="1000"/>

Standalone implementation for [Domoticz Home Automation](https://www.domoticz.com/). It means that you can put this server wherever you want, even on another machine. You need to setup a project in Actions on Google Console. You find instructions below.

Expand Down
2 changes: 1 addition & 1 deletion auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def oauth(self, s):
s.send_message(400, "Something went wrong")

def login(self, s):
template = pkg_resources.resource_string(__name__, 'login.html')
template = pkg_resources.resource_string(__name__, 'templates/login.html')

headers = {"Cache-Control": "no-cache"}
s.send_message(200, template, headers, True)
Expand Down
373 changes: 1 addition & 372 deletions const.py

Large diffs are not rendered by default.

Binary file modified dzga_UI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ def uptime():
if len(string) > 0 or hours > 0:
string += str(hours) + " " + (hours == 1 and "hour" or "hours") + ", "
if len(string) > 0 or minutes > 0:
string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes") + ", "
string += str(seconds) + " " + (seconds == 1 and "second" or "seconds")
string += str(minutes) + " " + (minutes == 1 and "minute" or "minutes")

return string

Expand Down
227 changes: 0 additions & 227 deletions login.html

This file was deleted.

1 change: 1 addition & 0 deletions requirements/pip-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ urllib3>=1.25.7
GitPython>=3.0.5
google-auth>=1.8.1
wheel>=0.34.2
Jinja2==2.11.2
5 changes: 4 additions & 1 deletion scripts/install_synology.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ fi
echo ""
echo " Create virtual enviroment..."
echo ""
python3 -m venv ${INSTALL_DIR}/env
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip install virtualenv
python3 -m virtualenv ${INSTALL_DIR}/env
${INSTALL_DIR}/env/bin/python -m pip install --upgrade pip setuptools wheel
source ${INSTALL_DIR}/env/bin/activate

Expand Down
33 changes: 33 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import http.server
import urllib.parse
from urllib.parse import urlparse
from helpers import FILE_DIR

from smarthome import *
# import cgi
Expand Down Expand Up @@ -54,6 +55,38 @@ def do_POST(self):
self.send_message(404, "Page not found!: %s" % error)

def send_message(self, code, msg, headers=None, b=False):
if self.path.endswith(".jpg"):
f = open(FILE_DIR + self.path, 'rb')
self.send_response(200)
self.send_header('Content-type', 'image/jpg')
self.end_headers()
self.wfile.write(f.read())
f.close()
return
elif self.path.endswith(".png"):
f = open(FILE_DIR + self.path, 'rb')
self.send_response(200)
self.send_header('Content-type', 'image/png')
self.end_headers()
self.wfile.write(f.read())
f.close()
return
elif self.path.endswith(".js"):
f = open(FILE_DIR + self.path, 'rb')
self.send_response(200)
self.send_header('Content-type', 'text/javascript')
self.end_headers()
self.wfile.write(f.read())
f.close()
return
elif self.path.endswith(".css"):
f = open(FILE_DIR + self.path, 'rb')
self.send_response(200)
self.send_header('Content-type', 'text/css')
self.end_headers()
self.wfile.write(f.read())
f.close()
return
self.send_response(code)
self.send_header('Content-type', 'text/html; charset=utf-8')
if headers is not None:
Expand Down
Loading

0 comments on commit 9d389f2

Please sign in to comment.