Skip to content

Commit

Permalink
fix(environmentsensor): use contact sensor for rain sensor instead of…
Browse files Browse the repository at this point in the history
… leak sensor #106
  • Loading branch information
bombadiltom committed Aug 26, 2024
1 parent de38842 commit 24003df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.10.14
### use contact sensor for rain sensor instead of leak sensor

## 0.10.13
### add Rohrmotor-Aktor 9471-3 (35200662)

Expand Down
8 changes: 4 additions & 4 deletions accessories/RademacherEnvironmentSensorAccessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function RademacherEnvironmentSensorAccessory(log, debug, accessory, sensor, ses
this.services.push(lightService);
// Rain sensor
this.currentRainState=this.sensor.readings.rain_detected;
var rainsensorService = this.accessory.getService(global.Service.LeakSensor);
rainsensorService.getCharacteristic(global.Characteristic.LeakDetected)
var rainsensorService = this.accessory.getService(global.Service.ContactSensor);
rainsensorService.getCharacteristic(global.Characteristic.ContactSensorState)
.setValue(this.currentRainState)
.on('get', this.getCurrentRainState.bind(this));
this.services.push(rainsensorService);
Expand Down Expand Up @@ -73,8 +73,8 @@ RademacherEnvironmentSensorAccessory.prototype.getCurrentRainState = function (c
{
self.currentRainState=data.readings.rain_detected
if (self.debug) self.log("%s [%s] - getCurrentRainState(): rain_detected=%s", self.accessory.displayName, self.sensor.did, self.currentRainState);
var rainsensorService = self.accessory.getService(global.Service.LeakSensor);
rainsensorService.getCharacteristic(global.Characteristic.LeakDetected).updateValue(self.currentRainState);
var rainsensorService = self.accessory.getService(global.Service.ContactSensor);
rainsensorService.getCharacteristic(global.Characteristic.ContactSensorState).updateValue(self.currentRainState);

}
});
Expand Down
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ RademacherHomePilot.prototype.addEnvironmentSensorAccessory = function(accessory
accessory = new global.Accessory(name, UUIDGen.generate("did"+sensor.did));
accessory.addService(global.Service.TemperatureSensor, name);
accessory.addService(global.Service.LightSensor, name);
// As of now implementation of Rain Sensor as Leak Sensor
accessory.addService(global.Service.LeakSensor, name);
accessory.addService(global.Service.ContactSensor, name);
this.api.registerPlatformAccessories("homebridge-rademacher-homepilot", "RademacherHomePilot", [accessory]);
}
else if (accessoryIn instanceof RademacherEnvironmentSensorAccessory)
Expand Down

0 comments on commit 24003df

Please sign in to comment.