Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antonfisher/node-logicmachine-api
LogicMachine Remote services API
https://github.com/antonfisher/node-logicmachine-api
logic-machine nodejs
Last synced: about 1 month ago
JSON representation
LogicMachine Remote services API
- Host: GitHub
- URL: https://github.com/antonfisher/node-logicmachine-api
- Owner: antonfisher
- License: mit
- Created: 2015-02-28T23:10:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-20T07:37:56.000Z (over 8 years ago)
- Last Synced: 2024-04-29T19:22:48.558Z (9 months ago)
- Topics: logic-machine, nodejs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/node-logicmachine-api
- Size: 95.7 KB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# node-logicmachine-api
[![build](https://travis-ci.org/antonfisher/node-logicmachine-api.svg)](https://travis-ci.org/antonfisher/node-logicmachine-api)
[![npm](https://img.shields.io/npm/dt/node-logicmachine-api.svg?maxAge=86400)](https://www.npmjs.com/package/node-logicmachine-api)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
![status](https://img.shields.io/badge/status-beta-lightgray.svg)NodeJS API module for LogicMachine Remote services
![Logo](https://raw.githubusercontent.com/antonfisher/node-logicmachine-api/docs/images/node-lm-api.png)
## LogicMahine Versions
Tested on v3 (LogicMachine3 Light).
## Installation
`npm install --save node-logicmachine-api`
## Usage
Module init params:
```javascript
var logicmachineApi = require('node-logicmachine-api')({
host: '10.10.10.10', // {String} default '192.168.0.10:80'
username: 'bob', // {String} default 'remote'
password: 'sponge', // {String} default 'remote'
protocol: 'https', // {String} default 'http'
format: 'json', // {String} default 'json' ['json', 'xml', 'rss']
apiPath: '/secret-path', // {String} default '/cgi-bin/scada-remote/request.cgi'
logger: logger.debug // {Function|Boolean} default console.log
})
``````javascript
var logicmachineApiDefault = require('node-logicmachine-api')();logicmachineApiDefault.setObjectValue('1/1/1/', '1', function (err, data) {
if (err) {
console.log('Error: ' + err);
}
// do stuff
});
``````javascript
var logicmachineApiCustom = require('node-logicmachine-api')({
host: '10.10.10.10:8080',
username: 'bob',
password: 'sponge',
logger: false
});logicmachineApiCustom.getObjects(function (err, data) {
if (err) {
console.log('Error: ' + err);
}
// do stuff
});
```## Methods
All methods with _callback_ will call it with _(err, data)_ params:
`err {Error|undefined}`;
`data {Object|Array|Boolean|undefined}`.
Objects address format:
`1/1/1`.
|Method|Description|
|---|---|
| `getAlerts(callback)` | callback _{Function}_
Returns last 50 alerts |
| `getErrors(callback)` | callback _{Function}_
Returns last 50 errors |
| `getObjects(callback)` | callback _{Function}_
Returns objects marked as _export_ sorted by last update time |
| `findObject(address, callback)` | address _{String}_ __[required]__
callback _{Function}_
Returns object value by address |
| `getObjectValue(address, callback)` | address _{String}_ __[required]__
callback _{Function}_
Returns current object value by address |
| `setObjectValue(address, value, callback)` | address _{String}_ __[required]__
value _{String}_ __[required]__
callback _{Function}_
Set object value by address |
| `setObjectValueWithoutKNX(address, value, callback)` | address _{String}_ __[required]__
value _{String}_ __[required]__
callback _{Function}_
Set object value by address without sending message to KNX |
| `sendResponseToKNXObject(address, value, callback)` | address _{String}_ __[required]__
value _{String}_ __[required]__
callback _{Function}_
Send response to KNX by object address |
| `sendReadToKNXObject(address, value, callback)` | address _{String}_ __[required]__
callback _{Function}_
Send _read_ message to KNX by object address |
| `createUrl(query)` | query _{Object}_ object of URL params
Create custom API url |## Development
Run tests: `npm test`;
Run Grunt watch: `grunt watch`.
## Contributing
Please take care to maintain the existing coding style, unit tests for any changed functionality.
Use `npm run lint` and `npm test` your code.## Release History
* 0.1.2 Migrate to NodeJs v5, update dependencies, use standard code style
* 0.1.1 Update initial params, add logger configuration
* 0.1.0 Initial release## Links:
* [http://evika.ru/](http://evika.ru/)## License
Copyright (c) 2016 Anton FisherMIT License. Free use and change.