// NewSwitch returns a switch service. func NewSwitch(name string, on bool) *Switch { onChar := characteristic.NewOn(on) nameChar := characteristic.NewName(name) svc := New() svc.Type = typeSwitch svc.AddCharacteristic(onChar.Characteristic) svc.AddCharacteristic(nameChar.Characteristic) return &Switch{svc, onChar, nameChar} }
// NewLightBulb returns a light bulb service. func NewLightBulb(name string, on bool) *LightBulb { onChar := characteristic.NewOn(on) nameChar := characteristic.NewName(name) brightness := characteristic.NewBrightness(100) // 100% saturation := characteristic.NewSaturation(0.0) hue := characteristic.NewHue(0.0) svc := New() svc.Type = typeLightBulb svc.AddCharacteristic(onChar.Characteristic) svc.AddCharacteristic(nameChar.Characteristic) svc.AddCharacteristic(brightness.Characteristic) svc.AddCharacteristic(saturation.Characteristic) svc.AddCharacteristic(hue.Characteristic) return &LightBulb{svc, onChar, nameChar, brightness, saturation, hue} }