Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: device111/diyHue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: diyhue/diyHue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Jul 9, 2024

  1. Copy the full SHA
    19c9f7b View commit details

Commits on Jul 27, 2024

  1. Updates and fixes. (diyhue#1029)

    * remove old ui
    
    * update page-404
    
    * Update updateManager.py
    
    * Update configHandler.py
    
    * Update handlers.py
    
    * duplicate import
    
    * clean up hue-emulator dir
    
    * clean up update process
    
    * Update updater
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Update docker-release.yml
    
    * Allow name change v2api
    
    * add line number to logger
    
    * Add try for no connection to internet
    
    * save config after name change
    
    * Add time zone arg to config init
    
    * Update restful.py
    
    * Update configHandler.py
    
    * Update configHandler.py
    
    * Update configHandler.py
    
    * Update install.sh
    
    * add more time zones
    
    * sw update
    
    * remove ui download sh
    hendriksen-mark authored Jul 27, 2024
    Copy the full SHA
    4c7fe4c View commit details

Commits on Jul 28, 2024

  1. Copy the full SHA
    fc81560 View commit details
  2. Add light icons

    hendriksen-mark committed Jul 28, 2024
    Copy the full SHA
    5c3e7ff View commit details

Commits on Jul 29, 2024

  1. Restructure of HueObjects. (diyhue#1031)

    * Update light_types.py
    
    * Update v2restapi.py
    
    * restructure HueObjects
    
    * change hueobject
    
    * move eventStream
    
    * change event to StreamEvent
    
    * add light scan to eventstream
    
    * Update discover.py
    
    * Update discover.py
    
    * eventsteam for bridge name change
    
    * Update Light.py
    
    * Update Light.py
    
    * Update Light.py
    
    * Update Light.py
    
    * Update Light.py
    
    * revert back to old
    hendriksen-mark authored Jul 29, 2024
    Copy the full SHA
    5d54bc9 View commit details

Commits on Aug 2, 2024

  1. Copy the full SHA
    7c757d9 View commit details

Commits on Aug 10, 2024

  1. Fixes

    Fix grouped_light missing owner,
    Fix previously made changes,
    Fix missing update time,
    Update readme
    hendriksen-mark committed Aug 10, 2024
    Copy the full SHA
    4837baa View commit details
  2. Copy the full SHA
    7100277 View commit details

Commits on Aug 16, 2024

  1. Add Smart Scene

    hendriksen-mark committed Aug 16, 2024
    Copy the full SHA
    5b6202c View commit details

Commits on Aug 29, 2024

  1. Copy the full SHA
    c795e3b View commit details

Commits on Aug 30, 2024

  1. Copy the full SHA
    de2b5bc View commit details

Commits on Aug 31, 2024

  1. Copy the full SHA
    52ad547 View commit details

Commits on Sep 2, 2024

  1. updates and fixes

    Remove unused import
    Add .000 to lastupdate
    Add diyhue info to apiV2 response
    Update apiV2 response
    Fix grouped.light error for entertainment diyhue#1032
    Update openwrt install
    hendriksen-mark committed Sep 2, 2024
    Copy the full SHA
    6511864 View commit details
  2. Update v2restapi.py

    hendriksen-mark committed Sep 2, 2024
    Copy the full SHA
    0416ef1 View commit details

Commits on Sep 16, 2024

  1. refactor diyhue#1

    mariusmotea committed Sep 16, 2024
    Copy the full SHA
    269974a View commit details
  2. Revert "refactor diyhue#1"

    This reverts commit 269974a.
    mariusmotea committed Sep 16, 2024
    Copy the full SHA
    0ebb1cd View commit details

Commits on Sep 21, 2024

  1. updates and fixes

    update credits.
    update diyhue response in v2api.
    update time routine.
    add timer routine.
    update mdns name.
    Accessories name change fix,
    update groups and lights event stream.
    update sensor v2api response.
    update openwrt install.
    diyhue#1041
    diyhue#1043
    https://diyhue.discourse.group/t/diyhue-installation-on-openwrt-fails/760
    diyhue#1046
    hendriksen-mark committed Sep 21, 2024
    Copy the full SHA
    0646b2a View commit details

Commits on Sep 25, 2024

  1. Copy the full SHA
    7a0bec2 View commit details
  2. Copy the full SHA
    351766a View commit details
  3. update deprecate

    hendriksen-mark committed Sep 25, 2024
    Copy the full SHA
    5d00e37 View commit details

Commits on Oct 1, 2024

  1. Copy the full SHA
    4117a2a View commit details

Commits on Oct 26, 2024

  1. Add XY light, Fix NoneType

    Add XY light(https://diyhue.discourse.group/t/hue-iris-llc010)
    Fix unsupported operand type(s) for /: 'NoneType' and 'int'
    hendriksen-mark committed Oct 26, 2024
    Copy the full SHA
    58aa81c View commit details

Commits on Nov 17, 2024

  1. Big update

    Add sub-ip-range to light scan.
    Move deprecate command line arguments ip-range, scan-on-host-ip, deconz, disable-online-discover, TZ to bridgeConfig and WebUI.
    Add check if a valid MAC address is provided.
    Make sensitive info privately.
    Move from create-react-app to vite.
    Add the option to remove the certificate.
    Update V1api scan for devices request.
    Add temporary log level change in WebUI.
    Add FPS counter to entertainment.
    hendriksen-mark committed Nov 17, 2024
    Copy the full SHA
    e67e27f View commit details
  2. Copy the full SHA
    e64e613 View commit details

Commits on Nov 24, 2024

  1. Add effect_v2

    Update light effects to effects_v2.
    Add effects to mqtt. diyhue#1053
    hendriksen-mark committed Nov 24, 2024
    Copy the full SHA
    5515247 View commit details

Commits on Dec 1, 2024

  1. Add dummy, update wled.

    Update github workflow.
    Update wled behavior.
    Fix linkbutton in hue essentials.
    Add dummy light.
    Make mdns in line with philips.
    hendriksen-mark committed Dec 1, 2024
    Copy the full SHA
    14008aa View commit details
  2. remove wled scan in load lights

    add new protocol_cfg to discovery.
    rescan lights if error during entertainment `Entertainment Service was syncing and has timed out, stopping server and clearing state'segment_start'`
    hendriksen-mark committed Dec 1, 2024
    Copy the full SHA
    bd11e1c View commit details

Commits on Dec 3, 2024

  1. Update entertainment.py

    update 1 non udp light per frame.diyhue#1057
    hendriksen-mark committed Dec 3, 2024
    Copy the full SHA
    cb65ff8 View commit details

Commits on Dec 17, 2024

  1. fixes

    Fix FPS counter in entertainment.
    Fix non udp lights in entertainment.
    diyhue#1057
    Exclude entertainment groups from scripts.
    Add `LightGroup` as Zone. diyhue#1059
    hendriksen-mark committed Dec 17, 2024
    Copy the full SHA
    c195967 View commit details

Commits on Jan 10, 2025

  1. Copy the full SHA
    a0f1584 View commit details

Commits on Feb 16, 2025

  1. update

    Update run in vscode,
    Add Govee(not tested),
    Update default gateway for non linux machines,
    Change dummy light,
    Update lights discovery,
    Update ssdp,
    Update updateManager,
    hendriksen-mark committed Feb 16, 2025
    Copy the full SHA
    8e902c8 View commit details
  2. update requirements

    hendriksen-mark committed Feb 16, 2025
    Copy the full SHA
    f23c881 View commit details
  3. Copy the full SHA
    a331031 View commit details
  4. add missing /user to govee discovery

    update docker release
    hendriksen-mark committed Feb 16, 2025
    Copy the full SHA
    d25e35f View commit details
  5. Update Dockerfile

    hendriksen-mark committed Feb 16, 2025
    Copy the full SHA
    0813105 View commit details
  6. Copy the full SHA
    01e1683 View commit details
Showing 1,832 changed files with 4,158 additions and 31,612 deletions.
17 changes: 10 additions & 7 deletions .build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# This image just moves the correct bins to a specific folder.
# Can also be used to compile the binaries (for an even better experience)
FROM busybox as binselector
FROM busybox AS binselector
WORKDIR /opt/hue-emulator

# Architecture automatically set by docker eg. linux/amd64, linux/arm/v7, linux/arm64
ARG TARGETPLATFORM

# ============================ Actual image from here ====================
FROM debian:stable-slim as prod
FROM debian:stable-slim AS prod
WORKDIR /opt/hue-emulator
ARG TARGETPLATFORM

COPY requirements.txt ./

## Install requirements
RUN apt update \
&& dpkg --configure -a \
&& apt install --no-install-recommends -y \
curl unzip python3-minimal python3-pip python3-dev python3-setuptools gcc \
curl unzip python3 python3-pip python3-dev python3-setuptools gcc \
openssl nmap psmisc iproute2 bluez bluetooth libcoap3-bin faketime \
&& pip3 install -r requirements.txt --no-cache-dir --break-system-packages \
&& apt purge -y python3-pip python3-setuptools python3-dev gcc \
@@ -37,10 +38,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/dist/index.html flaskUI/templates/ \
&& cp -r diyhueUI/dist/assets flaskUI/ \
&& rm -r diyhueUI

## Copy correct (compiled) C file from previous image
COPY ./BridgeEmulator/genCert.sh ./BridgeEmulator/openssl.conf /opt/hue-emulator/
31 changes: 20 additions & 11 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -20,29 +20,38 @@ jobs:
arch_friendly: armv6
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Create builder instance
run: |
docker buildx create --name mybuilder --use
docker buildx inspect --bootstrap
- name: Enable qemu
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- uses: satackey/action-docker-layer-caching@v0.0.8
continue-on-error: true
- name: Cache Docker layers
uses: actions/cache@v4
with:
key: diyhue-cache-ci-${{ matrix.arch }}-{hash}
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.arch }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
diyhue-cache-ci-${{ matrix.arch }}-
${{ runner.os }}-buildx-${{ matrix.arch }}-
- name: Build docker image
run: |
docker build -t diyhue/diyhue:ci -f ./.build/Dockerfile --platform=${{ matrix.arch }} --build-arg TARGETPLATFORM=${{ matrix.arch }} .
docker buildx build --builder mybuilder --platform=${{ matrix.arch }} --build-arg TARGETPLATFORM=${{ matrix.arch }} --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache -t diyhue/diyhue:ci -f ./.build/Dockerfile --load .
- name: Save tarball
run: |
docker save --output output.tar diyhue/diyhue:ci
- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ci-${{ matrix.arch_friendly }}-${{ github.run_number }}.tar
path: output.tar
@@ -60,7 +69,7 @@ jobs:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Download container artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ci-${{ matrix.arch }}-${{ github.run_number }}.tar

@@ -112,7 +121,7 @@ jobs:
fi
- name: Download container artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ci-${{ matrix.arch }}-${{ github.run_number }}.tar

@@ -163,7 +172,7 @@ jobs:
fi
- name: Download container artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: ci-${{ matrix.arch }}-${{ github.run_number }}.tar

@@ -387,6 +396,6 @@ jobs:
matrix:
arch: [amd64, armv7, arm64, armv6]
steps:
- uses: geekyeggo/delete-artifact@v1
- uses: geekyeggo/delete-artifact@v5
with:
name: ci-${{ matrix.arch }}-${{ github.run_number }}.tar
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -18,3 +18,9 @@ Sensors/*
# Ignore userdata
BridgeEmulator/export/
BridgeEmulator/cert.pem
/config
*.log
*.js
*.css
*.webp
BridgeEmulator/flaskUI/templates/index.html
26 changes: 16 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -4,14 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch diyHue",
"type": "python",
"request": "launch",
"program": "/opt/hue-emulator/HueEmulator3.py",
"args" : ["--docker"],
"pythonPath": "/usr/bin/python3",
"console": "integratedTerminal"
}
{
"name": "Launch diyHue",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/BridgeEmulator/HueEmulator3.py",
"args": [
"--docker",
"--mac",
"xx:xx:xx:xx:xx:xx",
"--config_path",
"${workspaceFolder}/config",
"--debug"
],
"console": "integratedTerminal"
}
]
}
}
5 changes: 1 addition & 4 deletions BridgeEmulator/HueEmulator3.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python
from flask import Flask
from flask.json import jsonify
from flask_cors import CORS
from flask_restful import Api
from threading import Thread
@@ -13,16 +12,14 @@
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

bridgeConfig = configManager.bridgeConfig.yaml_config
logging = logManager.logger.get_logger(__name__)
_ = logManager.logger.get_logger("werkzeug")
WSGIRequestHandler.protocol_version = "HTTP/1.1"
app = Flask(__name__, template_folder='flaskUI/templates',static_url_path="/static", static_folder='flaskUI/static')
app = Flask(__name__, template_folder='flaskUI/templates',static_url_path="/assets", static_folder='flaskUI/assets')
api = Api(app)
cors = CORS(app, resources={r"*": {"origins": "*"}})

15 changes: 15 additions & 0 deletions BridgeEmulator/HueObjects/ApiUser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from datetime import datetime, timezone

class ApiUser():
def __init__(self, username, name, client_key, create_date=datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S"), last_use_date=datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%S")):
self.username = username
self.name = name
self.client_key = client_key
self.create_date = create_date
self.last_use_date = last_use_date

def getV1Api(self):
return {"name": self.name, "create date": self.create_date, "last use date": self.last_use_date}

def save(self):
return {"name": self.name, "client_key": self.client_key, "create_date": self.create_date, "last_use_date": self.last_use_date}
86 changes: 86 additions & 0 deletions BridgeEmulator/HueObjects/BehaviorInstance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import uuid
import logManager
from HueObjects import genV2Uuid, StreamEvent
from datetime import datetime, timezone

logging = logManager.logger.get_logger(__name__)

class BehaviorInstance():
def __init__(self, data):
self.id_v2 = data["id"] if "id" in data else genV2Uuid()
self.id_v1 = self.id_v2 # used for config save
self.name = data["metadata"]["name"] if "name" in data["metadata"] else None
self.configuration = data["configuration"]
self.enabled = data["enabled"] if "enabled" in data else False
self.active = data["active"] if "active" in data else False
self.script_id = data["script_id"] if "script_id" in data else ""

streamMessage = {"creationtime": datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
"data": [self.getV2Api()],
"id": str(uuid.uuid4()),
"type": "add"
}
StreamEvent(streamMessage)

def __del__(self):
streamMessage = {"creationtime": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
"data": [{"id": self.id_v2, "type": "behavior_instance"}],
"id": str(uuid.uuid4()),
"type": "delete"
}
StreamEvent(streamMessage)
logging.info(self.name + " behaviour instance was destroyed.")

def getV2Api(self):
result = {"configuration": self.configuration,
"dependees": [],
"enabled": self.enabled,
"id": self.id_v2,
"last_error": "",
"metadata": {
"name": "noname"
},
"script_id": self.script_id,
"status": "running" if self.enabled else "disabled",
"type": "behavior_instance"
}

if self.name != None:
result["metadata"]["name"] = self.name

for resource in self.configuration["where"]:
result["dependees"].append({"level": "critical",
"target": {
"rid": resource[list(resource.keys())[0]]["rid"],
"rtype": resource[list(resource.keys())[0]]["rtype"]
},
"type": "ResourceDependee"
})

return result

def update_attr(self, newdata):
for key, value in newdata.items():
if key == "metadata" and "name" in value:
self.name = value["name"]
continue
updateAttribute = getattr(self, key)
if isinstance(updateAttribute, dict):
updateAttribute.update(value)
setattr(self, key, updateAttribute)
else:
setattr(self, key, value)
streamMessage = {"creationtime": datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ"),
"data": [self.getV2Api()],
"id": str(uuid.uuid4()),
"type": "update"
}
StreamEvent(streamMessage)

def save(self):
result = {"id": self.id_v2, "metadata": {"name": self.name}, "configuration": self.configuration, "enabled": self.enabled, "active": self.active,
"script_id": self.script_id}
if self.name != None:
result["metadata"] = {"name": self.name}

return result
Loading