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

Updates and fixes. #1029

Merged
merged 35 commits into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
23421d0
remove old ui
hendriksen-mark Jun 12, 2024
3ea4d8d
update page-404
hendriksen-mark Jun 12, 2024
db88ded
Merge branch 'diyhue:master' into master
hendriksen-mark Jun 13, 2024
df325bc
Update updateManager.py
hendriksen-mark Jun 13, 2024
9ab2adc
Update configHandler.py
hendriksen-mark Jun 13, 2024
4376f52
Update handlers.py
hendriksen-mark Jun 16, 2024
fd5c196
duplicate import
hendriksen-mark Jun 25, 2024
bb35730
clean up hue-emulator dir
hendriksen-mark Jun 25, 2024
0af9893
clean up update process
hendriksen-mark Jun 25, 2024
3dbf246
Update updater
hendriksen-mark Jun 25, 2024
71fcc0e
Update docker-release.yml
hendriksen-mark Jun 26, 2024
980802f
Update docker-release.yml
hendriksen-mark Jun 26, 2024
7d281ad
Update docker-release.yml
hendriksen-mark Jun 26, 2024
0e599cc
Update docker-release.yml
hendriksen-mark Jun 26, 2024
0d64950
Update docker-release.yml
hendriksen-mark Jun 26, 2024
d696205
Update docker-release.yml
hendriksen-mark Jun 26, 2024
cd9922a
Update docker-release.yml
hendriksen-mark Jun 26, 2024
eb4aca1
Update docker-release.yml
hendriksen-mark Jun 26, 2024
e4c005a
Update docker-release.yml
hendriksen-mark Jun 26, 2024
112ddf8
Update docker-release.yml
hendriksen-mark Jun 26, 2024
0d2024f
Update docker-release.yml
hendriksen-mark Jun 29, 2024
c133992
Update docker-release.yml
hendriksen-mark Jun 29, 2024
7eeca43
Allow name change v2api
hendriksen-mark Jul 22, 2024
88f523c
add line number to logger
hendriksen-mark Jul 22, 2024
ea5e311
Add try for no connection to internet
hendriksen-mark Jul 22, 2024
0f68322
save config after name change
hendriksen-mark Jul 22, 2024
f2aa1fc
Add time zone arg to config init
hendriksen-mark Jul 23, 2024
6a5f8e5
Update restful.py
hendriksen-mark Jul 24, 2024
84097b2
Update configHandler.py
hendriksen-mark Jul 24, 2024
89076cc
Update configHandler.py
hendriksen-mark Jul 24, 2024
3dd2d3d
Update configHandler.py
hendriksen-mark Jul 24, 2024
dfe666c
Update install.sh
hendriksen-mark Jul 27, 2024
56d5ea5
add more time zones
hendriksen-mark Jul 27, 2024
a505027
sw update
hendriksen-mark Jul 27, 2024
5ee0a89
remove ui download sh
hendriksen-mark Jul 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ COPY ./BridgeEmulator/githubInstall.sh /opt/hue-emulator/

## Install the web interface
RUN curl -sL https://github.com/diyhue/diyHueUI/releases/latest/download/DiyHueUI-release.zip -o diyHueUI.zip \
&& unzip -qo diyHueUI.zip \
&& mv index.html flaskUI/templates/ \
&& cp -r static flaskUI/ \
&& rm -r static
&& mkdir diyhueUI \
&& unzip -qo diyHueUI.zip -d diyhueUI \
&& rm diyHueUI.zip \
&& mv diyhueUI/index.html flaskUI/templates/ \
&& cp -r diyhueUI/static flaskUI/ \
&& rm -r diyhueUI

## Copy correct (compiled) C file from previous image
COPY ./BridgeEmulator/genCert.sh ./BridgeEmulator/openssl.conf /opt/hue-emulator/
Expand Down
1 change: 0 additions & 1 deletion BridgeEmulator/HueEmulator3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from flaskUI.v2restapi import AuthV1, ClipV2, ClipV2Resource, ClipV2ResourceId
from flaskUI.espDevices import Switch
from flaskUI.Credits import Credits
from flaskUI.error_pages.handlers import error_pages
from werkzeug.serving import WSGIRequestHandler
from functions.daylightSensor import daylightSensor
from pprint import pprint
Expand Down
11 changes: 10 additions & 1 deletion BridgeEmulator/configManager/argumentHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def process_arguments(configDir, args):

def parse_arguments():
argumentDict = {"BIND_IP": '', "HOST_IP": '', "HTTP_PORT": '', "HTTPS_PORT": '', "FULLMAC": '', "MAC": '', "DEBUG": False, "DOCKER": False,
"IP_RANGE_START": '', "IP_RANGE_END": '', "DECONZ": '', "scanOnHostIP": False, "disableOnlineDiscover": '', "noLinkButton": False, "noServeHttps": False}
"IP_RANGE_START": '', "IP_RANGE_END": '', "DECONZ": '', "scanOnHostIP": False, "disableOnlineDiscover": '', "noLinkButton": False,
"noServeHttps": False, "TZ": ''}
ap = argparse.ArgumentParser()

# Arguements can also be passed as Environment Variables.
Expand All @@ -55,6 +56,7 @@ def parse_arguments():
ap.add_argument("--no-link-button", action='store_true',
help="DANGEROUS! Don't require the link button to be pressed to pair the Hue app, just allow any app to connect")
ap.add_argument("--disable-online-discover", help="Disable Online and Remote API functions")
ap.add_argument("--TZ", help="Set time zone", type=str)

args = ap.parse_args()

Expand Down Expand Up @@ -84,6 +86,13 @@ def parse_arguments():
bind_ip = get_environment_variable('BIND_IP')
argumentDict["BIND_IP"] = bind_ip

tz = "Europe/London"
if args.TZ:
tz = args.TZ
elif get_environment_variable('TZ'):
tz = get_environment_variable('TZ')
argumentDict["TZ"] = tz

if args.ip:
host_ip = args.ip
elif get_environment_variable('IP'):
Expand Down
16 changes: 9 additions & 7 deletions BridgeEmulator/configManager/configHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from configManager.argumentHandler import parse_arguments
from datetime import datetime
import os
import pathlib
import subprocess
import json
import logManager
Expand Down Expand Up @@ -33,6 +34,7 @@ def _write_yaml(path, contents):
class Config:
yaml_config = None
configDir = parse_arguments()["CONFIG_PATH"]
runningDir = str(pathlib.Path(__file__)).replace("/configManager/configHandler.py","")

def __init__(self):
if not os.path.exists(self.configDir):
Expand Down Expand Up @@ -92,9 +94,9 @@ def load_config(self):
}

if int(config["swversion"]) < 1958077010:
config["swversion"] = "1962154010"
config["swversion"] = "1965111030"
if float(config["apiversion"][:3]) < 1.56:
config["apiversion"] = "1.62.0"
config["apiversion"] = "1.65.0"

self.yaml_config["config"] = config
else:
Expand All @@ -107,11 +109,11 @@ def load_config(self):
"alarm":{"enabled": False,"lasttriggered": 0},
"port":{"enabled": False,"ports": [80]},
"apiUsers":{},
"apiversion":"1.62.0",
"apiversion":"1.65.0",
"name":"DiyHue Bridge",
"netmask":"255.255.255.0",
"swversion":"1962154010",
"timezone":"Europe/London",
"swversion":"1965111030",
"timezone":parse_arguments()["TZ"],
"linkbutton":{"lastlinkbuttonpushed": 1599398980},
"users":{"[email protected]":{"password":"pbkdf2:sha256:150000$bqqXSOkI$199acdaf81c18f6ff2f29296872356f4eb78827784ce4b3f3b6262589c788742"}},
"hue": {},
Expand Down Expand Up @@ -293,7 +295,7 @@ def download_config(self):

def download_log(self):
subprocess.run('tar -cvf ' + self.configDir + '/diyhue_log.tar ' +
self.configDir.replace('/config', '') + '/*.log* ',
self.runningDir + '/*.log* ',
shell=True, capture_output=True, text=True)
return self.configDir + "/diyhue_log.tar"

Expand All @@ -314,7 +316,7 @@ def download_debug(self):
_write_yaml(self.configDir + "/system_info.yaml", info)
subprocess.run('tar --exclude=' + "'config.yaml'" + ' -cvf ' + self.configDir + '/config_debug.tar ' +
self.configDir + '/*.yaml ' +
self.configDir.replace('/config', '') + '/*.log* ',
self.runningDir + '/*.log* ',
shell=True, capture_output=True, text=True)
os.popen('rm -r ' + self.configDir + '/config_debug.yaml')
return self.configDir + "/config_debug.tar"
Expand Down
2 changes: 1 addition & 1 deletion BridgeEmulator/flaskUI/error_pages/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def error_404(error):
Error for pages not found.
'''
# Notice how we return a tuple!
return render_template('page-404.html'), 200
return render_template('page-404.html'), 404

@error_pages.app_errorhandler(500)
def error_500(error):
Expand Down
2 changes: 1 addition & 1 deletion BridgeEmulator/flaskUI/restful.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def buildConfig():
result = staticConfig()
config = bridgeConfig["config"]
result.update({"Hue Essentials key": config["Hue Essentials key"], "Remote API enabled": config["Remote API enabled"], "apiversion": config["apiversion"], "bridgeid": config["bridgeid"],
"ipaddress": config["ipaddress"], "netmask": config["netmask"], "gateway": config["gateway"], "mac": config["mac"], "name": config["name"], "swversion": config["swversion"], "swupdate2": config["swupdate2"], "timezone": config["timezone"]})
"ipaddress": config["ipaddress"], "netmask": config["netmask"], "gateway": config["gateway"], "mac": config["mac"], "name": config["name"], "swversion": config["swversion"], "swupdate2": config["swupdate2"], "timezone": config["timezone"], "discovery": config["discovery"]})
result["UTC"] = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S")
result["localtime"] = datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
result["whitelist"] = {}
Expand Down
Loading