Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change all require() paths to relative #40

Open
wants to merge 1 commit into
base: sdk-v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ESPEasy extends Homey.App {
// The data source is still HomeyLib
// Note: Only properties 'title', 'type', 'getable', 'setable', 'min', 'max' and 'uiComponent' are included
getCapabilities() {
const defaultCapabilities = require("/assets/json/allCapabilities.json");
const defaultCapabilities = require("./assets/json/allCapabilities.json");
const customCapabilities = this.manifest["capabilities"];

return {
Expand Down
2 changes: 1 addition & 1 deletion drivers/distance/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Distance_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/distance/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Distance_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/dust/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Dust_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/dust/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Dust_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/energy/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Energy_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/energy/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Energy_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/environment/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Environment_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/environment/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Environment_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gasses/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Gasses_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/gasses/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Gasses_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_bool/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODevice = require('/lib/GPIODevice.js');
const GPIODevice = require('../../lib/GPIODevice.js');

module.exports = class GPIO_Bool_Device extends GPIODevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_bool/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODriver = require('/lib/GPIODriver.js');
const GPIODriver = require('../../lib/GPIODriver.js');

module.exports = class GPIO_Bool_Driver extends GPIODriver {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_pulse/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODevice = require('/lib/GPIODevice.js');
const GPIODevice = require('../../lib/GPIODevice.js');
const util = require('util');

module.exports = class GPIO_Pulse_Device extends GPIODevice {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_pulse/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODriver = require('/lib/GPIODriver.js');
const GPIODriver = require('../../lib/GPIODriver.js');

module.exports = class GPIO_Pulse_Driver extends GPIODriver {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_pwm/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODevice = require('/lib/GPIODevice.js');
const GPIODevice = require('../../lib/GPIODevice.js');

module.exports = class GPIO_PWM_Device extends GPIODevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_pwm/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODriver = require('/lib/GPIODriver.js');
const GPIODriver = require('../../lib/GPIODriver.js');

module.exports = class GPIO_PWM_Driver extends GPIODriver {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_rtttl/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODevice = require('/lib/GPIODevice.js');
const GPIODevice = require('../../lib/GPIODevice.js');
const util = require('util');

module.exports = class GPIO_RTTTL_Device extends GPIODevice {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_rtttl/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODriver = require('/lib/GPIODriver.js');
const GPIODriver = require('../../lib/GPIODriver.js');

module.exports = class GPIO_RTTTL_Driver extends GPIODriver {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_tone/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODevice = require('/lib/GPIODevice.js');
const GPIODevice = require('../../lib/GPIODevice.js');
const util = require('util');

module.exports = class GPIO_Tone_Device extends GPIODevice {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpio_output_tone/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GPIODriver = require('/lib/GPIODriver.js');
const GPIODriver = require('../../lib/GPIODriver.js');

module.exports = class GPIO_Tone_Driver extends GPIODriver {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/input_analog/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Input_Analog_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/input_analog/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Input_Analog_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/input_switch/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Input_Switch_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/input_switch/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Input_Switch_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/light/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Light_Device extends SensorDevice {

Expand Down
2 changes: 1 addition & 1 deletion drivers/light/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Light_Driver extends SensorDriver {
Expand Down
4 changes: 2 additions & 2 deletions drivers/p1/device.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

const GeneralDevice = require('/lib/GeneralDevice.js');
const GeneralDevice = require('../../lib/GeneralDevice.js');
const net = require('net');
const Homey = require('homey');
const parsePacket = require('/lib/p1-parsePacket.js');
const parsePacket = require('../../lib/p1-parsePacket.js');

module.exports = class P1_Device extends GeneralDevice {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/p1/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class P1_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/pulse_counter/device.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDevice = require('/lib/SensorDevice.js');
const SensorDevice = require('../../lib/SensorDevice.js');

module.exports = class Pulse_Counter_Device extends SensorDevice {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion drivers/pulse_counter/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const SensorDriver = require('/lib/SensorDriver.js');
const SensorDriver = require('../../lib/SensorDriver.js');
const Homey = require('homey');

module.exports = class Pulse_Counter_Driver extends SensorDriver {
Expand Down
2 changes: 1 addition & 1 deletion drivers/unit/driver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Homey = require('homey');
const http = require('http.min');
const GeneralDriver = require('/lib/GeneralDriver.js');
const GeneralDriver = require('../../lib/GeneralDriver.js');

module.exports = class UnitDriver extends GeneralDriver {
onInit() {
Expand Down
6 changes: 3 additions & 3 deletions lib/ESPEasyUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,13 @@ module.exports = class ESPEasyUnit extends Homey.SimpleClass {
}

getPinList(group = false) {
const board = require("/assets/json/pinlists/boards.json")[this.detectBoardType()];
const board = require("../assets/json/pinlists/boards.json")[this.detectBoardType()];

const boardLabel = " (" + this.app.getI18nString(board.name) + ")";

const pinList = [{
"name": this.app.homey.__("unit.on_board_pins") + boardLabel,
"pins": require(`/assets/json/pinlists/${board.pinlist}.json`)
"pins": require(`../assets/json/pinlists/${board.pinlist}.json`)
}];

if (this.driver) {
Expand Down Expand Up @@ -502,7 +502,7 @@ module.exports = class ESPEasyUnit extends Homey.SimpleClass {
}

for (let p = 1; p < 17; p++) {
const oPin = require("/assets/json/pinlists/mcp23017.json");
const oPin = require("../assets/json/pinlists/mcp23017.json");
const pin = {
...oPin
}
Expand Down
2 changes: 1 addition & 1 deletion lib/GPIODevice.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const Homey = require('homey');
const GeneralDevice = require('/lib/GeneralDevice.js');
const GeneralDevice = require('./GeneralDevice.js');

module.exports = class GPIODevice extends GeneralDevice {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion lib/GPIODriver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GeneralDriver = require('/lib/GeneralDriver.js');
const GeneralDriver = require('./GeneralDriver.js');
const Homey = require('homey');

module.exports = class GPIODriver extends GeneralDriver {
Expand Down
2 changes: 1 addition & 1 deletion lib/SensorDevice.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const Homey = require('homey');
const GeneralDevice = require('/lib/GeneralDevice.js');
const GeneralDevice = require('./GeneralDevice.js');

module.exports = class SensorDevice extends GeneralDevice {
onInit() {
Expand Down
2 changes: 1 addition & 1 deletion lib/SensorDriver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const GeneralDriver = require('/lib/GeneralDriver.js');
const GeneralDriver = require('./GeneralDriver.js');
const Homey = require('homey');

module.exports = class SensorDriver extends GeneralDriver {
Expand Down
6 changes: 3 additions & 3 deletions lib/Telemetry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const Homey = require('homey');
const TelemetryDimensions = require('/assets/json/telemetryDimensions.json');
const TelemetryDimensions = require('../assets/json/telemetryDimensions.json');
const http = require('http.min');
const util = require('util');

Expand Down Expand Up @@ -129,13 +129,13 @@ module.exports = class Telemetry extends Homey.SimpleClass {
_setupDebugging() {
this.env = {};
try {
this.env = require('/env.json');
this.env = require('../env.json');
} catch (e) {}

Homey.SimpleClass.prototype.isDebugging = function() {
let env = {};
try {
env = require('/env.json');
env = require('../env.json');
} catch (e) {}

return this.enableDebugging || env['DEBUG_ALL'] === 'true' || env[`DEBUG_${this.constructor.name.toUpperCase()}`] === 'true';
Expand Down