Skip to content

Commit

Permalink
Merge branch 'master' into URL-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ttherbrink authored Jun 10, 2024
2 parents efafcf0 + 9b05993 commit 33cde0b
Show file tree
Hide file tree
Showing 1,351 changed files with 2,879 additions and 79,597 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
end_of_line = lf
insert_final_newline = true
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"extends": "athom"
"extends": "athom",
"ignorePatterns": ["**/*.min.js"]
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.js text eol=lf
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"trailingComma": "none",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"arrowParens": "always"
}
37 changes: 37 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{"version": "0.2.0",
"configurations": [{
"name": "Launch app",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "homey",
"args": ["app", "run", "--remote"],
"outputCapture": "std",
"serverReadyAction": {
"pattern": "Debugger listening on",
"action": "startDebugging",
"name": "Attach to Homey"
}
},
{
"type": "node",
"request": "attach",
"restart": true,
"name": "Attach to Homey",
"address": "${env:HOMEY_DEBUG_IP}",
"port": 9225,
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app/"
},
{
"type": "node",
"request": "attach",
"restart": true,
"name": "Attach HA to Homey23 Docker",
"address": "${env:HOMEY_DEBUG_IP}",
"port": 9229,
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app/"
}
]
}
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class KNXApp extends Homey.App {
const homeyIP = address.split(':', 1).toString();

this.log('Homey IP + Parsed IP', address, homeyIP);
this.knxInterfaceManager = new KNXInterfaceManager(homeyIP);
this.knxInterfaceManager = new KNXInterfaceManager(homeyIP, this.homey);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions drivers/knx_dimcontrol/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class KNXDimControl extends KNXGenericDevice {
super.onKNXEvent(groupaddress, data);
if (groupaddress === this.settings.ga_status) {
this.setCapabilityValue('onoff', DatapointTypeParser.onoff(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});
}
Expand All @@ -30,7 +30,7 @@ class KNXDimControl extends KNXGenericDevice {
// This will be catched by onKNXEvent, hence the return value is not used.
if (this.settings.ga_status) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_status)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
Expand All @@ -41,7 +41,7 @@ class KNXDimControl extends KNXGenericDevice {
this.log('onoff');
if (this.knxInterface && this.settings.ga_switch) {
return this.knxInterface.writeKNXGroupAddress(this.settings.ga_switch, value, 'DPT1')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.switch_failed'));
});
Expand All @@ -57,7 +57,7 @@ class KNXDimControl extends KNXGenericDevice {
};

return this.knxInterface.writeKNXGroupAddress(this.settings.ga_dim, dpt3Data, 'DPT3')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.dim_failed'));
});
Expand All @@ -73,7 +73,7 @@ class KNXDimControl extends KNXGenericDevice {
};

return this.knxInterface.writeKNXGroupAddress(this.settings.ga_dim, dpt3Data, 'DPT3')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.dim_failed'));
});
Expand Down
15 changes: 8 additions & 7 deletions drivers/knx_dimmer/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class KNXDimmer extends KNXGenericDevice {
super.onKNXEvent(groupaddress, data);
if (groupaddress === this.settings.ga_status) {
this.setCapabilityValue('onoff', DatapointTypeParser.onoff(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});
}
if (groupaddress === this.settings.ga_dim_status) {
this.setCapabilityValue('dim', DatapointTypeParser.dim(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set dim error', knxerror);
});
}
Expand All @@ -35,13 +35,13 @@ class KNXDimmer extends KNXGenericDevice {
// This will be catched by onKNXEvent, hence the return value is not used.
if (this.settings.ga_status) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_status)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
if (this.settings.ga_dim_status) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_dim_status)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
Expand All @@ -51,7 +51,7 @@ class KNXDimmer extends KNXGenericDevice {
onCapabilityOnoff(value, opts) {
if (this.knxInterface && this.settings.ga_switch) {
return this.knxInterface.writeKNXGroupAddress(this.settings.ga_switch, value, 'DPT1')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.switch_failed'));
});
Expand All @@ -63,18 +63,19 @@ class KNXDimmer extends KNXGenericDevice {
if (this.knxInterface && this.settings.ga_dim) {
const sendValue = value > 0;
this.setCapabilityValue('onoff', sendValue)
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});

return this.knxInterface.writeKNXGroupAddress(this.settings.ga_dim, value * 255, 'DPT5')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.dim_failed'));
});
}
return null;
}

}

module.exports = KNXDimmer;
4 changes: 2 additions & 2 deletions drivers/knx_electric_measuring/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class KNXElectricSensor extends KNXGenericDevice {
super.onKNXEvent(groupaddress, data);
if (groupaddress === this.settings.ga_sensor) {
this.setCapabilityValue('measure_power', DatapointTypeParser.dpt14(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set measure_power error', knxerror);
});
}
Expand All @@ -27,7 +27,7 @@ class KNXElectricSensor extends KNXGenericDevice {
// This will be catched by onKNXEvent, hence the return value is not used.
if (this.settings.ga_sensor) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_sensor)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/knx_light/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class KNXLight extends KNXGenericDevice {
super.onKNXEvent(groupaddress, data);
if (groupaddress === this.settings.ga_status) {
this.setCapabilityValue('onoff', DatapointTypeParser.onoff(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});
}
Expand All @@ -28,7 +28,7 @@ class KNXLight extends KNXGenericDevice {
// This will be catched by onKNXEvent, hence the return value is not used.
if (this.settings.ga_status) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_status)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
Expand All @@ -38,7 +38,7 @@ class KNXLight extends KNXGenericDevice {
onCapabilityOnoff(value, opts) {
if (this.knxInterface && this.settings.ga_switch) {
return this.knxInterface.writeKNXGroupAddress(this.settings.ga_switch, value, 'DPT1')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.switch_failed'));
});
Expand Down
6 changes: 3 additions & 3 deletions drivers/knx_luminance_sensor/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class KNXLuminanceSensor extends KNXGenericDevice {
this.log('event', data);
if (groupaddress === this.settings.ga_sensor) {
this.setCapabilityValue('measure_luminance', DatapointTypeParser.dpt9(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set measure_luminance error', knxerror);
});
}
Expand All @@ -28,7 +28,7 @@ class KNXLuminanceSensor extends KNXGenericDevice {
// This will be catched by onKNXEvent, hence the return value is not used.
if (this.settings.ga_sensor) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_sensor)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
Expand All @@ -38,7 +38,7 @@ class KNXLuminanceSensor extends KNXGenericDevice {
getMeasuredLuminance() {
if (this.settings.ga_sensor) {
this.knxInterface.readKNXGroupAddress(this.settings.ga_sensor)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.sensor_get_failed'));
});
Expand Down
17 changes: 8 additions & 9 deletions drivers/knx_rgb/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ class KNXRGB extends KNXGenericDevice {

// This will trigger onKNXToggleEvent, hence the return value is not used.
this.readSettingAddress(['ga_red_toggle_status', 'ga_green_toggle_status', 'ga_blue_toggle_status'])
.catch(readError => {
.catch((readError) => {
this.log('onKNXConnection error', readError);
});
// This will trigger onKNXDimEvent, hence the return value is not used.
this.readSettingAddress(['ga_red_dim_status', 'ga_green_dim_status', 'ga_blue_dim_status'])
.catch(readError => {
.catch((readError) => {
this.log('onKNXConnection error', readError);
});
}
Expand Down Expand Up @@ -126,15 +126,14 @@ class KNXRGB extends KNXGenericDevice {
&& !this._onOffEventHandlerObject.g
&& !this._onOffEventHandlerObject.b) {
this.setCapabilityValue('onoff', false)
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});
} else {
this.setCapabilityValue('onoff', true)
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});

}
}
}
Expand Down Expand Up @@ -188,19 +187,19 @@ class KNXRGB extends KNXGenericDevice {
if (this._hsvEventHandlerObject) {
if (this._hsvEventHandlerObject.h !== 0) {
this.setCapabilityValue('light_hue', this._hsvEventHandlerObject.h)
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set light_hue error', knxerror);
});
}
if (this._hsvEventHandlerObject.s !== 0) {
this.setCapabilityValue('light_saturation', this._hsvEventHandlerObject.s)
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set light_saturation error', knxerror);
});
}
if (this._hsvEventHandlerObject.v !== 0) {
this.setCapabilityValue('dim', this._hsvEventHandlerObject.v)
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set dim error', knxerror);
});
}
Expand Down Expand Up @@ -253,7 +252,7 @@ class KNXRGB extends KNXGenericDevice {
}

return Promise.all(promiseQue)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.switch_failed'));
});
Expand Down
4 changes: 2 additions & 2 deletions drivers/knx_scene/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class KNXScene extends KNXGenericDevice {
// Trigger any flow that is bound on this device.
this.homey.flow.getDeviceTriggerCard('trigger_from_scene')
.trigger(this)
.catch(err => this.log(err));
.catch((err) => this.log(err));
}
}

Expand All @@ -49,7 +49,7 @@ class KNXScene extends KNXGenericDevice {
}
// The -1 is temporary until the knx.js lib fully supports scenes
return this.knxInterface.writeKNXGroupAddress(this.settings.ga_scene, (this.settings.scene_number - 1), 'DPT17')
.catch(knxerror => {
.catch((knxerror) => {
throw new Error(this.homey.__('errors.switch_failed'), knxerror);
});
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/knx_scene/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class KNXScene extends KNXGenericDriver {

this.homey.flow
.getActionCard('trigger_to_scene')
.registerRunListener(async args => {
.registerRunListener(async (args) => {
return args['knx_scene'].triggerToScene();
});
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/knx_switch/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class KNXSwitch extends KNXGenericDevice {

if (groupaddress === statusAddress) {
this.setCapabilityValue('onoff', DatapointTypeParser.onoff(data))
.catch(knxerror => {
.catch((knxerror) => {
this.log('Set onoff error', knxerror);
});
}
Expand All @@ -43,7 +43,7 @@ class KNXSwitch extends KNXGenericDevice {
if (statusAddress) {
// switches don't have a seperate status address
this.knxInterface.readKNXGroupAddress(statusAddress)
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
});
}
Expand All @@ -54,13 +54,13 @@ class KNXSwitch extends KNXGenericDevice {
if (this.knxInterface && this.settings.ga_switch) {
if (this.settings.inverted === true) {
return this.knxInterface.writeKNXGroupAddress(this.settings.ga_switch, !value, 'DPT1')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.switch_failed'));
});
}
return this.knxInterface.writeKNXGroupAddress(this.settings.ga_switch, value, 'DPT1')
.catch(knxerror => {
.catch((knxerror) => {
this.log(knxerror);
throw new Error(this.homey.__('errors.switch_failed'));
});
Expand Down
Loading

0 comments on commit 33cde0b

Please sign in to comment.