Skip to content

Commit

Permalink
v6.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
seydx committed Oct 5, 2021
1 parent da10422 commit 14f4a64
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 34 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

# v6.0.17 - 2021-10-06

## Other Changes
- Updated dependencies

## Bugfixes
- Fixed an issue where smarthome thermostat groups did not display the average current temperature
- Fixed an issue where starting wps failed and showed wrong state
- Fixed an issue where setting thermostat to max temperature (via FritzBox) displayed wrong state/temperature in HomeKit
- Fixed an issue where scenes/automations do not work properly with Smarthome thermostats
- Minor Bugfixes

# v6.0.16 - 2021-09-21

## Notable Changes
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-fritz-platform",
"version": "6.0.16",
"version": "6.0.17",
"description": "Homebridge Plugin to control FritzBox router, smarthome devices and more.",
"main": "index.js",
"funding": [
Expand Down Expand Up @@ -48,7 +48,7 @@
"homebridge": "^1.3.0"
},
"dependencies": {
"@seydx/fritzbox": "^2.3.0",
"@seydx/fritzbox": "^2.3.1",
"fakegato-history": "0.6.2",
"form-data": "^4.0.0",
"fs-extra": "10.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/accessories/presence/presence.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ class Handler {
if (this.hosts.length) {
const userAccessories = this.accessories.filter(
(accessory) =>
accessory &&
accessory.context &&
accessory.context.config.type === 'presence' &&
accessory.displayName !== 'Anyone' &&
accessory.displayName !== 'Guest'
Expand Down
12 changes: 6 additions & 6 deletions src/accessories/router/router.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class Handler {
);
logger.debug(response, `${accessory.displayName} (${subtype})`);

state = response['NewX_AVM-DE_WPSStatus'] === 'on';
state = response['NewX_AVM-DE_WPSStatus'] !== 'off';
} catch (err) {
logger.warn('An error occured during getting state!', `${accessory.displayName} (${subtype})`);
logger.error(err, `${accessory.displayName} (${subtype})`);
Expand Down Expand Up @@ -631,19 +631,19 @@ class Handler {
}
case 'wps': {
logger.info(`${state ? 'ON' : 'OFF'}`, `${accessory.displayName} (${subtype})`);
let status = state ? 'pbc' : 'stop';
let status = state ? '1' : '0';

try {
logger.debug(
`Service: urn:WLANConfiguration-com:serviceId:WLANConfiguration1 - Command: X_AVM-DE_SetWPSConfig - Actions: ${JSON.stringify(
`Service: urn:WLANConfiguration-com:serviceId:WLANConfiguration1 - Command: X_AVM-DE_SetWPSEnable - Actions: ${JSON.stringify(
{
'NewX_AVM-DE_WPSMode': status,
'NewX_AVM-DE_WPSEnable': status,
}
)}`,
`${accessory.displayName} (${subtype})`
);
await fritzbox.exec('urn:WLANConfiguration-com:serviceId:WLANConfiguration1', 'X_AVM-DE_SetWPSConfig', {
'NewX_AVM-DE_WPSMode': status,
await fritzbox.exec('urn:WLANConfiguration-com:serviceId:WLANConfiguration1', 'X_AVM-DE_SetWPSEnable', {
'NewX_AVM-DE_WPSEnable': status,
});
} catch (err) {
logger.warn('An error occured during setting state!', `${accessory.displayName} (${subtype})`);
Expand Down
2 changes: 1 addition & 1 deletion src/accessories/smarthome/smarthome-button.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class Handler {
//logger.debug(this.smarthomeList, 'Smarthome');

const accessories = this.accessories.filter(
(accessory) => accessory.context.config.subtype === 'smarthome-button'
(accessory) => accessory && accessory.context && accessory.context.config.subtype === 'smarthome-button'
);

for (const accessory of accessories) {
Expand Down
38 changes: 27 additions & 11 deletions src/accessories/smarthome/smarthome.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,10 @@ class Handler {
currentTemp = device.thermostat.current;
targetTemp = device.thermostat.target;

if (targetTemp === 'on') {
targetTemp = 28;
}

/*
currentTemp = (device.thermostat.current === 'on' || device.thermostat.current === 'off')
? currentTemp
Expand Down Expand Up @@ -1576,17 +1580,26 @@ class Handler {

if (accessory.context.config.ain) {
if (target === 'temperature') {
logger.info(`Temperature ${state}`, `${accessory.displayName} (${subtype})`);
let temp = Math.round((Math.min(Math.max(state, 8), 28) - 8) * 2) + 16;

cmd = {
...cmd,
switchcmd: 'sethkrtsoll',
param: temp,
};
/*
* Due to a bug in HomeKit regarding scenes/automations,
* the command to change the temperature must be executed with a time delay.
* Otherwise the "ON/OFF" value is sent AFTER the temperature setting and this
* leads to problems.
*/

accessory.context.hkrTimeout = setTimeout(async () => {
logger.info(`Temperature ${state}`, `${accessory.displayName} (${subtype})`);
let temp = Math.round((Math.min(Math.max(state, 8), 28) - 8) * 2) + 16;

cmd = {
...cmd,
switchcmd: 'sethkrtsoll',
param: temp,
};

logger.debug(`Send CMD: ${JSON.stringify(cmd)}`, `${accessory.displayName} (${subtype})`);
await requestAHA(this.fritzbox.url.hostname, cmd);
logger.debug(`Send CMD: ${JSON.stringify(cmd)}`, `${accessory.displayName} (${subtype})`);
await requestAHA(this.fritzbox.url.hostname, cmd);
}, 100);
} else {
logger.info(`${state ? 'ON' : 'OFF'}`, `${accessory.displayName} (${subtype})`);

Expand Down Expand Up @@ -1736,7 +1749,10 @@ class Handler {
//buttons have its own handler
const accessories = this.accessories.filter(
(accessory) =>
accessory.context.config.type === 'smarthome' && accessory.context.config.subtype !== 'smarthome-button'
accessory &&
accessory.context &&
accessory.context.config.type === 'smarthome' &&
accessory.context.config.subtype !== 'smarthome-button'
);

for (const accessory of accessories) {
Expand Down

0 comments on commit 14f4a64

Please sign in to comment.