Skip to content

Instantly share code, notes, and snippets.

@itsmepetrov
Created December 11, 2018 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmepetrov/6df7be02616ded7edc34b1598642c8ee to your computer and use it in GitHub Desktop.
Save itsmepetrov/6df7be02616ded7edc34b1598642c8ee to your computer and use it in GitHub Desktop.
const HomeKitDevice = require('../HomeKitDevice')
class IkeaTradfriDimmableBulb extends HomeKitDevice {
static get description() {
return {
model: [
'TRADFRI bulb E27 opal 1000lm',
'TRADFRI bulb E27 W opal 1000lm',
],
manufacturer: 'IKEA of Sweden',
name: 'IKEA TRADFRI',
}
}
getAvailbleServices() {
return [{
name: 'Bulb',
type: 'Lightbulb',
}]
}
onDeviceReady() {
this.mountServiceCharacteristic({
endpoint: 1,
cluster: 'genOnOff',
service: 'Bulb',
characteristic: 'On',
reportMinInt: 1,
reportMaxInt: 300,
reportChange: 1,
parser: 'onOff',
})
this.mountServiceCharacteristic({
endpoint: 1,
cluster: 'genLevelCtrl',
service: 'Bulb',
characteristic: 'Brightness',
reportMinInt: 1,
reportMaxInt: 300,
reportChange: 1,
parser: 'dim',
})
}
}
module.exports = IkeaTradfriDimmableBulb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment