-
Notifications
You must be signed in to change notification settings - Fork 0
API
Class implementing the interface to the Hazyair monitoring tool.
Kind: global class
Extends: EventEmitter
-
Hazyair ⇐
EventEmitter
Create a Hazyair instance.
Param | Type | Description |
---|---|---|
config | Object |
[ { parameter: ('dust'|'temperature'|'pressure'|'humidity'), model: ..., persistent: (true|false), options: {... } }, ...] |
Example
let hazyair = new Hazyair([{
parameter: 'dust',
model: 'PMS7003',
persistent: true,
options: {
device: '/dev/serial0'
}
}]);
Send all sensors data to the ThingSpeak™ service once they are available.
Kind: instance method of Hazyair
Param | Type | Description |
---|---|---|
config | Object |
{ api_key: ..., parameters: { (dust|temperature|pressure|humidity): ({...: 'field1', ...}|('field1'|...)) } } } |
Example
hazyair.thingspeak({
api_key: 'XXXXXXXXXXXXXXXX',
parameters: {
dust: {
concentration_pm10_normal: 'field1'
}
}
});
Send all sensors data to the dweet.io service once they are available.
Kind: instance method of Hazyair
Param | Type | Description |
---|---|---|
config | Object |
{ thing: ..., (key: ...,) parameters: { (dust|temperature|pressure|humidity): ({...: ..., ...}|(...)) } } } |
Example
hazyair.dweet({
thing: 'XXXXXXXXXXXXXXXX',
parameters: {
dust: {
concentration_pm10_normal: 'PM10'
}
}
});
Start monitoring of the specified parameter(s).
Kind: instance method of Hazyair
Emits: Hazyair#event:dust
, Hazyair#event:temperature
, Hazyair#event:pressure
, Hazyair#event:humidity
Example
hazyair.start()
Start http web service.
Kind: instance method of Hazyair
Returns: Promise
- Promise object
Param | Type | Default | Description |
---|---|---|---|
options | Object |
passed to the http server | |
[callback] | function |
|
function passed to the http server |
Example
hazyair.listen({
port: 8081
}).then(() => {
// web service started
});
Close http web server and access to the databases if required.
Kind: instance method of Hazyair
Returns: Promise
- Promise object
Param | Type | Default | Description |
---|---|---|---|
[callback] | function |
|
function executed when action is completed |
Example
hazyair.close().then(() => {
// hazyair closed
});