{"id":25794489,"url":"https://github.com/cblomart/go-hue-bridge","last_synced_at":"2025-10-07T13:09:52.251Z","repository":{"id":65193794,"uuid":"455699501","full_name":"cblomart/go-hue-bridge","owner":"cblomart","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-19T12:32:50.000Z","size":51,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-15T21:33:09.158Z","etag":null,"topics":["domoticz","home-assistant","home-automation","hue-api","hue-bridge"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cblomart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-04T21:18:56.000Z","updated_at":"2023-12-07T13:57:25.000Z","dependencies_parsed_at":"2023-12-22T16:06:53.859Z","dependency_job_id":"ddbaa604-862d-45aa-90cf-e651441aa7e4","html_url":"https://github.com/cblomart/go-hue-bridge","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblomart%2Fgo-hue-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblomart%2Fgo-hue-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblomart%2Fgo-hue-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblomart%2Fgo-hue-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cblomart","download_url":"https://codeload.github.com/cblomart/go-hue-bridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241021579,"owners_count":19895668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["domoticz","home-assistant","home-automation","hue-api","hue-bridge"],"created_at":"2025-02-27T13:59:17.927Z","updated_at":"2025-10-07T13:09:43.705Z","avatar_url":"https://github.com/cblomart.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang Hue Bridge\n\nThe goal of this project is to build a simple golang hue brige implementing basic hue APIs.\n\nIt would mainly translate calls to the hue hub v1 api to calls to swith lights on or off.\n\nIt will support only on off: no colors or gradations.\n\n## Hue Hub API\n\nI don't have a fully docummented HUB API. It has been implemented by many other projects but sometimes fails with Alexa.\n\nDiscovery is done over SSDP responding to SSDP calls\n\n```http\nHTTP/1.1 200 OK\nCACHE-CONTROL: max-age=100\nEXT:\nLOCATION: http://192.168.0.21:80/description.xml\nSERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/0.1\nST: upnp:rootdevice\nUSN: uuid:2fa00080-d000-11e1-9b23-001f80007bbe::upnp:rootdevice\n```\n\nThe discovery will provide a ```/discovery.xml``` url with details of the hub.\n\nRequest:\n```http\nGET /discovery.xml\n```\n\nResponse:\n```xml\n\u003croot xmlns=\"urn:schemas-upnp-org:device-1-0\"\u003e\n    \u003cspecVersion\u003e\n        \u003cmajor\u003e1\u003c/major\u003e\n        \u003cminor\u003e0\u003c/minor\u003e\n    \u003c/specVersion\u003e\n    \u003cURLBase\u003ehttp://{ip}:{port}/\u003c/URLBase\u003e\n    \u003cdevice\u003e\n        \u003cdeviceType\u003eurn:schemas-upnp-org:device:Basic:1\u003c/deviceType\u003e\n        \u003cfriendlyName\u003ePhilips hue ({ip})\u003c/friendlyName\u003e\n        \u003cmanufacturer\u003eRoyal Philips Electronics\u003c/manufacturer\u003e\n        \u003cmanufacturerURL\u003ehttp://www.philips.com\u003c/manufacturerURL\u003e\n        \u003cmodelDescription\u003ePhilips hue Personal Wireless Lighting\u003c/modelDescription\u003e\n        \u003cmodelName\u003ePhilips hue bridge 2015\u003c/modelName\u003e\n        \u003cmodelNumber\u003eBSB002\u003c/modelNumber\u003e\n        \u003cmodelURL\u003ehttp://www.meethue.com\u003c/modelURL\u003e\n        \u003cserialNumber\u003e{serial}\u003c/serialNumber\u003e\n        \u003cUDN\u003euuid:{uuid}\u003c/UDN\u003e\n    \u003c/device\u003e\n\u003c/root\u003e\n```\n\nOnce Alexa has discovered the hub information it will use Hue API (v1) to discover lights.\n\nThe first thing Alexa will do is call the ``/api`` endpoint to associate with the hub and recieve a username.\nThe username will be leveraged in the uri of subsequent api calls to identify the hub. \nThe username is a random hex string of 16bytes.\n\nRequest:\n```http\nGET /api\n```\n\nResponse:\n```json\n[\n    {\n        \"success\": {\n            \"username\": \"{username}\"\n        }\n    }\n]\n```\n\nOnce Alexa is associated to the hub it will query the lights endpoint to list all lights:\nThere i had to find the necessary attributes that needed to be presented. I chose to present OSRAM switches because these where the only on/off switches i could find on.\nI started by adding all the attributes listed on ``Philips`` website but discovery didn't work. Alexa requested the lights endpoint ~10 times and failed to discover anything.\nI found that some emulation softawre added the ``pointsymbol`` attribute. By adding it discovery did work.\nLuckily i created a way to generate unique ids as described on ``Philips`` website as it turns out reverting to simple ids break the discovery too.\n\n\u003e *TODO*: check if exposing a specific device type is alright rather than copying existing ones\n\nRequest:\n```http\nGET /api/{username}/lights\n```\n\nResponse:\n```json\n{\n    \"20\": {\n        \"name\":\"Cave\",\n        \"manufacturername\":\"OSRAM\",\n        \"modelid\":\"Plug 01\",\n        \"swversion\":\"v1.04.12\",\n        \"type\":\"On/off light\",\n        \"uniqueid\":\"00:7d:e8:a0:eb:37:00:f8-a4\",\n        \"state\": {\n            \"on\":false,\n            \"reachable\":true\n        },\n        \"pointsymbol\":{}\n    },\n    \"21\": {\n        \"name\":\"Cave - escalier\",\n        \"manufacturername\":\"OSRAM\",\n        \"modelid\":\"Plug 01\",\n        \"swversion\":\"v1.04.12\",\n        \"type\":\"On/off light\",\n        \"uniqueid\":\"00:b5:64:46:fb:57:38:28-80\",\n        \"state\": {\n            \"on\":false,\n            \"reachable\":true\n        },\n        \"pointsymbol\":{}\n    }\n}\n```\nOnce Alexa have discovered the lights list it will poll to each light to have their status.\n\nRequest:\n```http\nGET /api/{username}/lights/{id}\n```\n\nResponse:\n```json\n{\n        \"name\":\"Cave\",\n        \"manufacturername\":\"OSRAM\",\n        \"modelid\":\"Plug 01\",\n        \"swversion\":\"v1.04.12\",\n        \"type\":\"On/off light\",\n        \"uniqueid\":\"00:7d:e8:a0:eb:37:00:f8-a4\",\n        \"state\": {\n            \"on\":false,\n            \"reachable\":true\n        },\n        \"pointsymbol\":{}\n    }\n```\n\nTo change the state of a light Alexa will send a state request to a light with a put method\n\nRequest:\n```http\nPUT /api/{username}/lights/{id}/state\n```\n\nRequest content:\n```json\n{\n    \"on\":true\n}\n```\n\nResponse:\n```json\n[\n    {\n        \"success\": {\n            \"/lights/20/state/on\": true\n        }\n    }\n]\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcblomart%2Fgo-hue-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcblomart%2Fgo-hue-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcblomart%2Fgo-hue-bridge/lists"}