You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a working platform with 8 temperature sensors and struggling to integrate fakegato-history. I added fakegato-history 0.5.6 as a dependency for my plugin and its visible in the node_modules folder. I followed the instructions by adding to module export, in the module for each accessory creation, and returned the service (fakegato related entire are in Bold font).
By I can't resolve an error and pretty new to coding. I'm probably creating the FakeGatoHistoryService in the wrong place or out of scope. Thanks a lot for any hints!
error
ReferenceError: FakeGatoHistoryService is not defined
at HeaterReportingAccessory.getServices (/homebridge/node_modules/homebridge-heater-reporting/index.js:211:32)
at Server.createHAPAccessory (/usr/local/lib/node_modules/homebridge/src/server.ts:442:41)
at /usr/local/lib/node_modules/homebridge/src/server.ts:427:34
at Array.forEach ()
at /usr/local/lib/node_modules/homebridge/src/server.ts:417:21
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:10:18
at HeaterReportingPlatform.accessories (/homebridge/node_modules/homebridge-heater-reporting/index.js:185:9)
at /usr/local/lib/node_modules/homebridge/src/server.ts:415:24
at new Promise ()
at Server.loadPlatformAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:414:12)
Here are the relevant extracts of the key code:
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic; var FakeGatoHistoryService = require('fakegato-history')(homebridge);
homebridge.registerAccessory("homebridge-heater-reporting", "heater-reporting", HeaterReportingAccessory);
homebridge.registerPlatform("homebridge-heater-reporting", "heater-reporting", HeaterReportingPlatform);
}
function HeaterReportingPlatform(log, config){
this.sensors = config['sensors']; //sensors is an array in config.json, each sensor identified my name, keyword, serial
//(...)my code
}
HeaterReportingPlatform.prototype = {
accessories: function(callback) {
var sensorAccessories = []; //this is an array to store the sensor temperature accessories
for(var i = 0; i < this.sensors.length; i++){
var sensor = new HeaterReportingAccessory(this.log, this.sensors[i]);
sensorAccessories.push(sensor);
}
var saCount = sensorAccessories.length;
callback(sensorAccessories);
}
function HeaterReportingAccessory(log, sensorConfig) {
this.log = log;
this.keyword = sensorConfig["keyword"];
this.name = sensorConfig["name"];
this.sn = sensorConfig["serial"];
}
HeaterReportingAccessory.prototype = {
getServices: function() {
var informationService = new Service.AccessoryInformation();
informationService
.setCharacteristic(Characteristic.Name, this.name)
.setCharacteristic(Characteristic.Manufacturer, "Dallas")
.setCharacteristic(Characteristic.Model, this.keyword)
.setCharacteristic(Characteristic.SerialNumber, this.sn);
var temperatureService = new Service.TemperatureSensor(this.name);
temperatureService.getCharacteristic(Characteristic.CurrentTemperature)
.on("get", this.getTemperature.bind(this));
//line 211 var loggingService = new FakeGatoHistoryService("weather", {displayName: this.name, log: this.log}, {storage: 'fs'});
I have a working platform with 8 temperature sensors and struggling to integrate fakegato-history. I added fakegato-history 0.5.6 as a dependency for my plugin and its visible in the node_modules folder. I followed the instructions by adding to module export, in the module for each accessory creation, and returned the service (fakegato related entire are in Bold font).
By I can't resolve an error and pretty new to coding. I'm probably creating the FakeGatoHistoryService in the wrong place or out of scope. Thanks a lot for any hints!
ReferenceError: FakeGatoHistoryService is not defined
at HeaterReportingAccessory.getServices (/homebridge/node_modules/homebridge-heater-reporting/index.js:211:32)
at Server.createHAPAccessory (/usr/local/lib/node_modules/homebridge/src/server.ts:442:41)
at /usr/local/lib/node_modules/homebridge/src/server.ts:427:34
at Array.forEach ()
at /usr/local/lib/node_modules/homebridge/src/server.ts:417:21
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:10:18
at HeaterReportingPlatform.accessories (/homebridge/node_modules/homebridge-heater-reporting/index.js:185:9)
at /usr/local/lib/node_modules/homebridge/src/server.ts:415:24
at new Promise ()
at Server.loadPlatformAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:414:12)
module.exports = function(homebridge) {
Service = homebridge.hap.Service;
Characteristic = homebridge.hap.Characteristic;
var FakeGatoHistoryService = require('fakegato-history')(homebridge);
homebridge.registerAccessory("homebridge-heater-reporting", "heater-reporting", HeaterReportingAccessory);
homebridge.registerPlatform("homebridge-heater-reporting", "heater-reporting", HeaterReportingPlatform);
}
function HeaterReportingPlatform(log, config){
this.sensors = config['sensors']; //sensors is an array in config.json, each sensor identified my name, keyword, serial
//(...)my code
}
HeaterReportingPlatform.prototype = {
accessories: function(callback) {
var sensorAccessories = []; //this is an array to store the sensor temperature accessories
for(var i = 0; i < this.sensors.length; i++){
var sensor = new HeaterReportingAccessory(this.log, this.sensors[i]);
sensorAccessories.push(sensor);
}
var saCount = sensorAccessories.length;
callback(sensorAccessories);
}
function HeaterReportingAccessory(log, sensorConfig) {
this.log = log;
this.keyword = sensorConfig["keyword"];
this.name = sensorConfig["name"];
this.sn = sensorConfig["serial"];
}
HeaterReportingAccessory.prototype = {
getServices: function() {
var informationService = new Service.AccessoryInformation();
//line 211
var loggingService = new FakeGatoHistoryService("weather", {displayName: this.name, log: this.log}, {storage: 'fs'});
The text was updated successfully, but these errors were encountered: