Skip to content

Instantly share code, notes, and snippets.

@tanepiper
Created November 6, 2017 21:07
Show Gist options
  • Select an option

  • Save tanepiper/a0aaf7160177688cfaaaf061b7df1d22 to your computer and use it in GitHub Desktop.

Select an option

Save tanepiper/a0aaf7160177688cfaaaf061b7df1d22 to your computer and use it in GitHub Desktop.
const register = shared => ({
event: 'HeatWarning',
command: async event => {
const lights = await shared.hub.lights.getAll();
lights.map(async (light, index) => {
light.on = true;
light.alert = 'lselect';
light.effect = 'none';
light.brightness = 254;
light.saturation = 254;
if (index % 2 === 0) {
light.xy = shared.h.rgbToXy(shared.h.colours.RED);
} else {
light.xy = shared.h.rgbToXy(shared.h.colours.YELLOW);
}
await shared.hub.lights.save(light);
await shared.h.sleep(5000);
await shared.h.setLightToCurrentStar();
});
}
});
module.exports = register;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment