Skip to content

Commit

Permalink
v6.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
seydx committed Jul 7, 2021
1 parent 51adeee commit 21dc2ae
Show file tree
Hide file tree
Showing 13 changed files with 428 additions and 193 deletions.
58 changes: 44 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,103 @@
# Changelog

# v6.0.12 - 2021-07-08

## Notable Changes
- **Smarthome**
- Changed "Humidity Sensor" from built-in sensor to a separate humidity sensor accessory
- Added new `externTemperatureSensor` option for thermostat accessories to use the temperature value from the external temperature sensor setted up in the FritzBox GUI

## Other Changes
- Reduced minimum polling timer to `1`

## Bugfixes
- Fixed an issue where enabling temperature or humidity doesnt work for several smarthome accessories
- Fixed an issue where receiving an error during sending a telegram message caused homebridge to crash
- Fixed an issue where thermostat `open window switch` caused a warning on startup
- Minor bug fixes

# v6.0.11 - 2021-07-04

## Other Changes
- Fixed an issue where buttons with 4 channels didnt work properly
- Updated dependencies

## Bugfixes
- Fixed an issue where buttons with 4 channels didnt work properly

# v6.0.10 - 2021-06-28

## Other Changes
## Bugfixes
- Fixed an issue where authentication with a complex password didnt work

# v6.0.9 - 2021-06-28

## Other Changes
## Bugfixes
- Fixed an issue where changing lightbulb color didnt work

# v6.0.8 - 2021-06-27

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

# v6.0.7 - 2021-06-27

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

# v6.0.6 - 2021-06-27

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

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

# v6.0.5 - 2021-06-23

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

## Bugfixes
- Fixed an issue where callmonitor (outgoing) not triggered correctly

# v6.0.4 - 2021-06-22

## Other Changes
- Bug fixes

## Bugfixes
- Minor bug fixes
# v6.0.3 - 2021-06-22

## Notable Changes
- **Log**: Added multiple logging functions to config to allow adjusting the logging output.
- **Log**:
- Added multiple logging functions to config to allow adjusting the logging output.
- **Smarthome**:
- **Buttons**: Added support for Telekom Wandtaster
- **Config**:
- **Buttons**: Added `longPress` option to smarthome buttons

## Other Changes
- Updated dependencies

## Bugfixes
- Fixed an issue where presence devices with an ip address in the config could not be exposed to HomeKit.
- Minor bug fixes
- Updated dependencies

# v6.0.2 - 2021-06-22

## Other Changes
- Better error handling in the backend

## Bugfixes
- 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

# v6.0.1 - 2021-06-21

## Other Changes
## Bugfixes
- Minor bug fixes
- Cleaned up config.schema.json

Expand Down Expand Up @@ -120,9 +148,11 @@ This update is by far the biggest update for `homebridge-fritz-platform`. To mak
## Other Changes
- The code has been refactored (again)
- Adjusted config.schema.json to reflect the changes mentioned above
- Bug fixes
- Updated dependencies

## Bugfixes
- Minor bug fixes

# v5.1.2 - 2021-05-30
- Fix CreateUrlSID for DECT

Expand Down
11 changes: 10 additions & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@
"description": "Current power consumption when the device is active. Used for notification via telegram when started (current power consumption above this value) or ended (current power consumption below this value).",
"minimum": 1
},
"externTemperatureSensor": {
"title": "Use Extern Temperature Sensor",
"type": "boolean",
"condition": {
"functionBody": "return model.smarthome[arrayIndices[0]].accType === 'thermostat';"
},
"description": "Enable this, if you want to show the temperature value from the extern temperature sensor setted up in your FritzBox GUI as the current temperature."
},
"temperature": {
"title": "Temperature Sensor",
"type": "boolean",
Expand All @@ -552,7 +560,7 @@
"condition": {
"functionBody": "return model.smarthome[arrayIndices[0]].accType === 'button' || model.smarthome[arrayIndices[0]].accType === 'thermostat' || model.smarthome[arrayIndices[0]].accType === 'switch' || model.smarthome[arrayIndices[0]].accTypeGroup === 'switch' || model.smarthome[arrayIndices[0]].accTypeGroup === 'switch-lightbulb';"
},
"description": "Enable this, if the device(s) has a built in humidity sensor. This adds an additional humidity sensor to the temperature sensor."
"description": "Enable this, if the device(s) has a built in humidty sensor. This exposes an additional humidty sensor as an accessory to HomeKit."
},
"window": {
"title": "Window Sensor",
Expand Down Expand Up @@ -1738,6 +1746,7 @@
"smarthome[].readOnly",
"smarthome[].energy",
"smarthome[].startValue",
"smarthome[].externTemperatureSensor",
"smarthome[].temperature",
"smarthome[].humidity",
"smarthome[].window",
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.11",
"version": "6.0.12",
"description": "Homebridge Plugin to control FritzBox router, smarthome devices and more.",
"main": "index.js",
"funding": [
Expand Down
90 changes: 90 additions & 0 deletions src/accessories/smarthome/humidity/humidity.accessory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
'use strict';

const moment = require('moment');
const logger = require('../../../utils/logger');
const Handler = require('../smarthome.handler');

const timeout = (ms) => new Promise((res) => setTimeout(res, ms));

class Accessory {
constructor(api, accessory, accessories, meshMaster, HistoryService) {
this.api = api;
this.accessory = accessory;
this.HistoryService = HistoryService;

this.handler = Handler.configure(api, accessories, accessory.context.config.polling, meshMaster);
this.getService();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Services
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

async getService() {
let service = this.accessory.getService(this.api.hap.Service.HumiditySensor);

if (!service) {
logger.info(
'Adding HumiditySensor service',
`${this.accessory.displayName} (${this.accessory.context.config.subtype})`
);
service = this.accessory.addService(
this.api.hap.Service.HumiditySensor,
this.accessory.displayName,
this.accessory.context.config.subtype
);
}

if (this.accessory.context.config.battery) {
let batteryService = this.accessory.getService(this.api.hap.Service.BatteryService);

if (!batteryService) {
logger.info(
'Adding Battery service',
`${this.accessory.displayName} (${this.accessory.context.config.subtype})`
);
batteryService = this.accessory.addService(this.api.hap.Service.BatteryService);
}

batteryService.setCharacteristic(
this.api.hap.Characteristic.ChargingState,
this.api.hap.Characteristic.ChargingState.NOT_CHARGEABLE
);
} else {
if (this.accessory.getService(this.api.hap.Service.BatteryService)) {
this.accessory.removeService(this.accessory.getService(this.api.hap.Service.BatteryService));
}
}

this.historyService = new this.HistoryService('room', this.accessory, {
storage: 'fs',
path: this.api.user.storagePath() + '/fritzbox/',
disableTimer: true,
});

await timeout(250); //wait for historyService to load

service
.getCharacteristic(this.api.hap.Characteristic.CurrentRelativeHumidity)
.on('change', (context) => this.handler.change(context, this.accessory, null, this.historyService));

this.refreshHistory(service);
}

async refreshHistory(service) {
let state = service.getCharacteristic(this.api.hap.Characteristic.CurrentRelativeHumidity).value;

this.historyService.addEntry({
time: moment().unix(),
temp: 0,
humidity: state,
ppm: 0,
});

setTimeout(() => {
this.refreshHistory(service);
}, 10 * 60 * 1000);
}
}

module.exports = Accessory;
1 change: 1 addition & 0 deletions src/accessories/smarthome/smarthome.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Config = (smarthomeConfig) => {
energy: smarthomeConfig.energy || false,
startValue: parseInt(smarthomeConfig.startValue) > 0 ? parseInt(smarthomeConfig.startValue) : false,
temperature: smarthomeConfig.temperature || false,
externTemperatureSensor: smarthomeConfig.externTemperatureSensor || false,
humidity: smarthomeConfig.humidity || false,
window: smarthomeConfig.window || false,
openWindow: smarthomeConfig.openWindow || false,
Expand Down
Loading

0 comments on commit 21dc2ae

Please sign in to comment.