Comments (3)
Hi @sergei202, this project is only an implementation of the protocol, which doesn't have a concept of a device as such. I wrote a bit about it in the readme. This library is what you would use to communicate in order to control a dimmer, but the logic to do that would live elsewhere. It might be worth looking around to see if there are any other users of this library that could be inspiration.
from lutron-leap-js.
For anyone who arrives here looking for the same thing, it's actually very easy to control devices:
Get your device object from bridge.getDeviceInfo()
, it'll look something like this:
{
Name: 'Cans',
DeviceType: 'WallDimmer',
AssociatedArea: { href: '/area/5' },
href: '/device/11',
SerialNumber: 64668928,
FullyQualifiedName: [ 'Office', 'Cans'],
Parent: { href: '/project' },
ModelNumber: 'PD-6WCL-XX',
LocalZones: [ { href: '/zone/8' } ],
LinkNodes: [ { href: '/device/11/linknode/11' } ],
DeviceRules: [ { href: '/devicerule/27' } ],
AddressedState: 'Addressed'
}
Then pass the LocalZones[0].href
to client.request()
:
client.request('CreateRequest', '/zone/8/commandprocessor',
{'Command':{'CommandType':'GoToLevel','Parameter':[{'Type':'Level','Value':50}]}}
).then(r => console.log('response=%o', r));
from lutron-leap-js.
Thank you for documenting that! I've been chewing on it, and I think having a separate abstraction for physical devices, as a place to encode the kind of logic you've written here, is probably a good idea. Given that a few different devices use similar commands, I even think a device-command-protocol MVC-ish style approach would allow a clean implementation.
from lutron-leap-js.
Related Issues (20)
- MultipleLinkDefinition body type HOT 1
- OneAreaStatus body type HOT 9
- MultipleAreaStatus body type HOT 1
- OneAreaSceneDefinition body type HOT 1
- OnePresetDefinition body type HOT 1
- Has this been tested with RadioRA3 Sunnata Dimmers and Keypads? HOT 3
- Support new Homeworks QSX LEAP varient HOT 35
- Support for Sunnata 4 buttton keypad and RA2 fan via the RA3 hub? HOT 4
- Issue with mDNS Queries/Responses HOT 17
- Homeworks QSX support HOT 2
- 3.4.x NPM packages contain code not in repo
- MultipleAreaDefinition body type HOT 1
- Question: Where to get information about LEAP protocol? HOT 1
- OneAreaDefinition body type HOT 1
- OneControlStationDefinition body type HOT 1
- OneProjectDefinition body type HOT 1
- OneLinkNodeDefinition body type HOT 1
- MultipleZoneStatus body type HOT 1
- Support zone subscriptions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lutron-leap-js.