Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
#12 added support for humidity sensors that use the temperature device
Browse files Browse the repository at this point in the history
  • Loading branch information
michbeck100 committed Dec 23, 2015
1 parent 83d5938 commit 88f7de8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions accessories/temperature.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ module.exports = (env) ->
device.on 'temperature', (temperature) =>
@getService(Service.TemperatureSensor)
.setCharacteristic(Characteristic.CurrentTemperature, temperature)

# some devices also measure humidity
if device.hasAttribute('humidity')
@addService(Service.CurrentRelativeHumidity, device.name)
.getCharacteristic(Characteristic.CurrentRelativeHumidity)
.on 'get', (callback) =>
@handleReturnPromise(device.getHumidity(), callback, null)

device.on 'humidity', (humidity) =>
@getService(Service.CurrentRelativeHumidity)
.setCharacteristic(Characteristic.CurrentRelativeHumidity, humidity)

0 comments on commit 88f7de8

Please sign in to comment.