fixed netatmo problem with duplicate module names

This commit is contained in:
Patrick
2015-10-25 21:57:46 +01:00
parent 3da52388e8
commit dc6faa9784

View File

@@ -49,7 +49,7 @@ function NetAtmoRepository(log, api) {
NetAtmoRepository.prototype = {
refresh: function(callback) {
var datasource={
var datasource = {
devices: {},
modules: {}
};
@@ -69,7 +69,7 @@ NetAtmoRepository.prototype = {
},
load: function(callback) {
var that = this;
this.cache.get( "datasource", function( err, datasource ){
this.cache.get( "datasource", function( err, datasource ) {
if( !err ){
if ( datasource == undefined ){
that.refresh(callback);
@@ -126,7 +126,14 @@ function NetatmoAccessory(log, repository, deviceId, moduleId, device) {
if (moduleId) {
this.serial = moduleId;
}
// add station name to devices to avoid duplicate names
if (device.station_name) {
this.name = device.station_name + " " + device.module_name;
} else {
this.name = device.module_name;
}
this.model = device.type;
this.serviceTypes = device.data_type;
if (device.battery_vp) {