From c24a94c072bedbf035464ba5d1a54c123b4ee456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=20Schr=C3=B6ter?= Date: Mon, 5 Oct 2015 12:00:43 +0200 Subject: [PATCH] added ROOMMATE devices --- platforms/FHEM.js | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/platforms/FHEM.js b/platforms/FHEM.js index f76593f..5033dfa 100644 --- a/platforms/FHEM.js +++ b/platforms/FHEM.js @@ -567,7 +567,8 @@ console.log( result ); } else if( s.Attributes.model == 'HM-SEC-KEY' ) { accessory = new FHEMAccessory(this.log, this.connection, s); - } else if( s.Internals.TYPE == 'PRESENCE' ) { + } else if( s.Internals.TYPE == 'PRESENCE' + || s.Internals.TYPE == 'ROOMMATE' ) { accessory = new FHEMAccessory(this.log, this.connection, s); } else if( s.Internals.TYPE == 'SONOSPLAYER' ) { @@ -729,30 +730,33 @@ FHEMAccessory(log, connection, s) { this.mappings.blind = { reading: 'pct', cmd: 'pct' }; } else if( genericType == 'window' - || s.Attributes.model == 'HM-SEC-WIN' ) { + || s.Attributes.model == 'HM-SEC-WIN' ) this.mappings.window = { reading: 'level', cmd: 'level' }; - } else if( genericType == 'lock' - || s.Attributes.model == 'HM-SEC-KEY' ) { + else if( genericType == 'lock' + || s.Attributes.model == 'HM-SEC-KEY' ) this.mappings.lock = { reading: 'lock' }; - } else if( genericType == 'thermostat' - || s.Attributes.subType == 'thermostat' ) { + else if( genericType == 'thermostat' + || s.Attributes.subType == 'thermostat' ) s.isThermostat = true; - } else if( s.Internals.TYPE == 'CUL_FHTTK' ) { + else if( s.Internals.TYPE == 'CUL_FHTTK' ) this.mappings.contact = { reading: 'Window' }; - } else if( s.Internals.TYPE == 'MAX' - && s.Internals.type == 'ShutterContact' ) { + else if( s.Internals.TYPE == 'MAX' + && s.Internals.type == 'ShutterContact' ) this.mappings.contact = { reading: 'state' }; - } else if( s.Attributes.subType == 'threeStateSensor' ) { + else if( s.Attributes.subType == 'threeStateSensor' ) this.mappings.contact = { reading: 'contact' }; - } else if( s.Internals.TYPE == 'PRESENCE' ) + else if( s.Internals.TYPE == 'PRESENCE' ) this.mappings.occupancy = { reading: 'state' }; + else if( s.Internals.TYPE == 'ROOMMATE' ) + this.mappings.occupancy = { reading: 'presence' }; + else if( s.Attributes.model == 'fs20di' ) s.isLight = true; @@ -1066,6 +1070,12 @@ FHEMAccessory.prototype = { else value = Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW; + } else if( reading == 'presence' ) { + if( value == 'present' ) + value = Characteristic.OccupancyDetected.OCCUPANCY_DETECTED; + else + value = Characteristic.OccupancyDetected.OCCUPANCY_NOT_DETECTED; + } else if( reading == 'state' ) { if( value.match(/^set-/ ) ) return undefined;