Skip to content

Commit

Permalink
v6.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
seydx committed Jun 27, 2021
1 parent 2ee7759 commit 08a5aeb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 93 deletions.
20 changes: 13 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
# Changelog

# 6.0.7 - 2021-06-27
# v6.0.8 - 2021-06-27

## Other Changes
- Fixed an issue where restarting a router failed
- Minor bug fixes

# v6.0.7 - 2021-06-27

## Other Changes
- Fixed an issue where presence user throw an erorr if it could not be found manually or in the hosts list
- Minor bug fixes

# 6.0.6 - 2021-06-27
# v6.0.6 - 2021-06-27

## Other Changes
- Fixed an issue where broadband received wrong state/value
- Updated dependencies

# 6.0.5 - 2021-06-23
# v6.0.5 - 2021-06-23

## Other Changes
- Fixed an issue where callmonitor (outgoing) not triggered correctly
- Improved logging

# 6.0.4 - 2021-06-22
# v6.0.4 - 2021-06-22

## Other Changes
- Bug fixes

# 6.0.3 - 2021-06-22
# v6.0.3 - 2021-06-22

## Notable Changes
- **Log**: Added multiple logging functions to config to allow adjusting the logging output.
Expand All @@ -37,15 +43,15 @@
- Minor bug fixes
- Updated dependencies

# 6.0.2 - 2021-06-22
# v6.0.2 - 2021-06-22

## Other Changes
- Better error handling in the backend
- Fixed an issue where extra characteristics was not polling
- Fixed an issue with Telegram where also the subtypes of an accessory was shown in the message
- Minor bug fixes

# 6.0.1 - 2021-06-21
# v6.0.1 - 2021-06-21

## Other Changes
- Minor bug fixes
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": "homebridge-fritz-platform",
"version": "6.0.7",
"version": "6.0.8",
"description": "Homebridge Plugin to control FritzBox router, smarthome devices and more.",
"main": "index.js",
"funding": [
Expand Down
2 changes: 1 addition & 1 deletion src/accessories/presence/presence.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class Handler {
accessory.context.changedOn = Date.now();

logger.info(
`Occupancy state switched back to ${newState ? 'DETECTED' : 'NOT DETECTED'}`,
`Occupancy state changed to ${newState ? 'DETECTED' : 'NOT DETECTED'}`,
`${accessory.displayName} (${subtype})`
);

Expand Down
93 changes: 11 additions & 82 deletions src/accessories/router/router.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ class Handler {

state = response.NewConnectionStatus === 'Connected';

if (accessory.context.restart) {
if (accessory.context.restart){
accessory.context.restart = false;

if (accessory.context.config.reboot.off && accessory.context.config.master) {
if (accessory.context.config.master && accessory.context.config.reboot.off) {
try {
logger.info('Executing OFF script...', `${accessory.displayName} (${subtype})`);

Expand Down Expand Up @@ -166,6 +166,10 @@ class Handler {
logger.debug(response, `${accessory.displayName} (${subtype})`);

state = response.NewEnable === '1';

if (accessory.context.restart) {
accessory.context.restart = false;
}
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err, `${accessory.displayName} (${subtype})`);
Expand Down Expand Up @@ -465,53 +469,9 @@ class Handler {
let characteristic = ownCharacteristic ? ownCharacteristic : this.api.hap.Characteristic.On;

switch (subtype) {
case 'dsl': {
logger.info(`${state ? 'ON' : 'OFF'}`, `${accessory.displayName} (${subtype})`);

if (state) {
logger.info('ON not supported!', `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(!state),
1000
);
} else {
if (accessory.context.config.reboot.on && accessory.context.config.master) {
try {
logger.info('Executing ON script...', `${accessory.displayName} (${subtype})`);

await initReboot(accessory.context.config.reboot.off);

logger.info('ON script executed successfully!', `${accessory.displayName} (${subtype})`);
} catch (err) {
logger.error('An error occured during executing ON script!', `${accessory.displayName} (${subtype})`);
logger.error(err, `${accessory.displayName} (${subtype})`);
}
}

try {
logger.debug(
'Service: urn:DeviceConfig-com:serviceId:DeviceConfig1 - Command: Reboot - Actions: null',
`${accessory.displayName} (${subtype})`
);
await fritzbox.exec('urn:DeviceConfig-com:serviceId:DeviceConfig1', 'Reboot');

accessory.context.restart = true;
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(!state),
1000
);
}
}
break;
}
case 'cable': {
case 'dsl':
case 'cable':
case 'repeater': {
logger.info(`${state ? 'ON' : 'OFF'}`, `${accessory.displayName} (${subtype})`);

if (state) {
Expand All @@ -523,11 +483,11 @@ class Handler {
1000
);
} else {
if (accessory.context.config.reboot.on && accessory.context.config.master) {
if (accessory.context.config.master && accessory.context.config.reboot.on) {
try {
logger.info('Executing ON script...', `${accessory.displayName} (${subtype})`);

await initReboot(accessory.context.config.reboot.off);
await initReboot(accessory.context.config.reboot.on);

logger.info('ON script executed successfully!', `${accessory.displayName} (${subtype})`);
} catch (err) {
Expand Down Expand Up @@ -557,37 +517,6 @@ class Handler {
}
break;
}
case 'repeater': {
logger.info(`${state ? 'ON' : 'OFF'}`, `${accessory.displayName} (${subtype})`);

if (state) {
logger.info('ON not supported!', `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(!state),
1000
);
} else {
try {
logger.debug(
'Service: urn:DeviceConfig-com:serviceId:DeviceConfig1 - Command: Reboot - Actions: null',
`${accessory.displayName} (${subtype})`
);
await fritzbox.exec('urn:DeviceConfig-com:serviceId:DeviceConfig1', 'Reboot');
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
logger.error(err, `${accessory.displayName} (${subtype})`);

setTimeout(
() =>
accessory.getService(this.api.hap.Service.Switch).getCharacteristic(characteristic).updateValue(!state),
1000
);
}
}
break;
}
case 'wifi_2ghz': {
logger.info(`${state ? 'ON' : 'OFF'}`, `${accessory.displayName} (${subtype})`);

Expand Down
2 changes: 1 addition & 1 deletion src/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function FritzPlatform(log, config, api) {
}

if (this.config.devices) {
RouterSetup(this.devices, this.config.devices, this.config.extras, config.options, this.meshMaster);
RouterSetup(this.devices, this.config.devices, this.config.extras, this.config.options, this.meshMaster);
}

if (!this.meshMaster.configured) {
Expand Down

0 comments on commit 08a5aeb

Please sign in to comment.