Skip to content

Commit

Permalink
Directly require manifest and use it
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelKohler committed Feb 7, 2021
1 parent a46b541 commit 77f7683
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module.exports = {
load,
};

async function load(manifest) {
const database = new Database(manifest.name);
async function load(manifestId) {
const database = new Database(manifestId);
await database.open()
const config = await database.loadConfig();
return config;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"manifest_version": 1,
"name": "Simple MQTT Adapter",
"short_name": "MQTT Adapter",
"version": "1.0.1",
"version": "1.0.2",
"options": {
"schema": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-mqtt-adapter",
"version": "1.0.1",
"version": "1.0.2",
"description": "Creates a virtual device with configurable actions/events connected to a MQTT broker.",
"author": "Michael Kohler <me@michaelkohler.info>",
"main": "index.js",
Expand Down
7 changes: 4 additions & 3 deletions simple-mqtt-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
const MQTT = require('async-mqtt');

const config = require('./config');
const manifest = require('./manifest.json');

const DEVICE_ID = 'simple-mqtt-virtual';
const DEVICE_NAME = 'MQTT Broker';
Expand Down Expand Up @@ -66,11 +67,11 @@ class MQTTVirtualDevice extends Device {
}

class SimpleMQTTAdapter extends Adapter {
constructor(addonManager, manifest) {
super(addonManager, 'SimpleMQTTAdapter', manifest.name);
constructor(addonManager) {
super(addonManager, 'SimpleMQTTAdapter', manifest.id);
addonManager.addAdapter(this);

this.create(manifest);
this.create(manifest.id);
}

async create(manifest) {
Expand Down

0 comments on commit 77f7683

Please sign in to comment.