-
Notifications
You must be signed in to change notification settings - Fork 0
Home
file containing devices and their access methods.
file containing environmental zones to be managed/monitored.
node index.js
Most objects are of type EventEmitter from the emitter
node Object.
There are essentially 2 layers: the device layer & the application layer (zones).
devices do the real work, and are described in a way that permits access to the device safely. They will emit events as they do their work. A gpio being turned on, or set HIGH
, will emit a state
event with the value being written (usually 1). Turning it off, low, etc, will emit the same state
event with the value being 0.
They are broken down into 3 types - a button
, a dimmer
, and a virtual
. [thanks to the guys at blynk.cc for the concept]
the button only turns on and off. it is analogous to the gpio itself - it only supports a 1 or a 0, and can only switch as fast as the OS allows it (some 100 - 2000Hz, normally). One could logically extend the idea of the button clicking on and off as a form of a protocol, but it would have to be a pretty "loosely" controlled protocol with no tight timings due to the CPU determining the availability (primarily in User Space. However, even a kernel implemented driver would be limited by the scheduler. [this is arguable, but the reality is that anything less than a Real Time OS (RTOS), or a deterministically programed microcontroller will need wide timing tolerances for implementation.]
it provided the base methods, on & off.
the dimmer moves between 0 and 1. It is expressed as a % - as in, dim the lights to 25% of their power. It functions on pwm
. It's not intended as a gpio
toggler - or, "bit banged PWM".
it provides the base methods get & set
virtual devices are devices that implement some time of protocol, or are remote. They describe the driver module to load, and the arguments should be in the form of [for local virtuals] pin, arg1, arg2, ...
. Ideally there are no specific arguments as that would be awesome, but maybe someday.
it provides any number of methods, including things like read, reset, init, or other devices specific commands (e.g. set the gain on a light meter).