Skip to content

Instantly share code, notes, and snippets.

@EddyVerbruggen
Created January 12, 2017 19:33
Show Gist options
  • Save EddyVerbruggen/405fe6a03644128f8173c431a7be2cd9 to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/405fe6a03644128f8173c431a7be2cd9 to your computer and use it in GitHub Desktop.
NativeScript HomeKit - adding rooms
// the home you created earlier
let homeName = home.name;
// ask the user for a name and add it to HomeKit
prompt(`Name the room to add to ${homeName}`).then((promptResult: PromptResult) => {
if (promptResult.result) {
homekit.addRoomToHome(promptResult.text, homeName).then(
(room: Room) => console.log(`Added room ${room.name} to home ${homeName}`),
err => alert(err)
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment