Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
Support API level 2. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Stegeman authored Mar 2, 2018
1 parent 54a8792 commit e4d576b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.swp
*.tgz
SHA256SUMS
node_modules/
19 changes: 16 additions & 3 deletions http-on-off-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@

'use strict';

const Adapter = require('../adapter');
const Device = require('../device');
const Property = require('../property');
const fetch = require('node-fetch');

let Adapter, Device, Property;
try {
Adapter = require('../adapter');
Device = require('../device');
Property = require('../property');
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e;
}

const gwa = require('gateway-addon');
Adapter = gwa.Adapter;
Device = gwa.Device;
Property = gwa.Property;
}

class HttpOnOffProperty extends Property {
constructor(device, name, propertyDescription) {
super(device, name, propertyDescription);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "http-on-off-adapter",
"version": "0.3.0",
"version": "0.3.1",
"description": "Simple HTTP On/Off Switch",
"main": "index.js",
"keywords": [
Expand Down Expand Up @@ -29,7 +29,7 @@
"moziot": {
"api": {
"min": 1,
"max": 1
"max": 2
},
"plugin": true,
"exec": "{nodeLoader} {path}",
Expand Down

0 comments on commit e4d576b

Please sign in to comment.