Skip to content

Commit

Permalink
Add Hue actions to search things
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed Feb 2, 2025
1 parent c3993b5 commit 19c06c7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
21 changes: 15 additions & 6 deletions extensions/hue-v2/hue-v2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,19 @@ function extension:generateKey()
end

function extension:touchlink()
if hueBridge then
return hueBridge:putConfig({touchlink = true}):next(function(response)
return 'OK'
end)
end
return Promise.reject('Bridge not available')
return hueBridge:putConfig({touchlink = true}):next(function(response)
return 'OK'
end)
end

function extension:searchNewLights()
return hueBridge:httpRequestV1('POST', '/lights'):next(function(response)
return 'OK'
end)
end

function extension:searchNewSensors()
return hueBridge:httpRequestV1('POST', '/sensors'):next(function(response)
return 'OK'
end)
end
10 changes: 10 additions & 0 deletions extensions/hue-v2/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
"description": "Generate an API application key, press touchlink first",
"method": "generateKey",
"active": false
}, {
"name": "Search New Lights",
"description": "Starts searching for new lights, the bridge will open the network for 40s",
"method": "searchNewLights",
"active": true
}, {
"name": "Search New Sensors",
"description": "Starts a search for new sensors",
"method": "searchNewSensors",
"active": true
}, {
"name": "Touchlink",
"description": "Adds the closest lamp (within range) to the ZigBee network",
Expand Down
2 changes: 2 additions & 0 deletions extensions/hue-v2/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ The link button on the bridge must be pressed and this action triggered within 3

## Usage

Use the `Search New Lights` or `Search New Sensors` action to find new things.

The JSON mapping defines the how the Hue devices are mapped to things.

0 comments on commit 19c06c7

Please sign in to comment.