lifxlan
Version:
TypeScript library for controlling LIFX products over LAN
101 lines • 3.6 kB
JavaScript
import * as Encoding from '../encoding.js';
import { Type } from '../constants/index.js';
export function GetColorCommand() {
return {
type: Type.GetColor,
decode: Encoding.decodeLightState,
defaultResponseMode: 'response',
};
}
export function SetColorCommand(hue, saturation, brightness, kelvin, duration) {
return {
type: Type.SetColor,
payload: Encoding.encodeSetColor(hue, saturation, brightness, kelvin, duration),
decode: Encoding.decodeLightState,
defaultResponseMode: 'ack-only',
};
}
export function SetWaveformCommand(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform) {
return {
type: Type.SetWaveform,
payload: Encoding.encodeSetWaveform(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform),
decode: Encoding.decodeLightState,
defaultResponseMode: 'ack-only',
};
}
export function GetLightPowerCommand() {
return {
type: Type.GetLightPower,
decode: Encoding.decodeStateLightPower,
defaultResponseMode: 'response',
};
}
export function SetLightPowerCommand(level, duration) {
return {
type: Type.SetLightPower,
payload: Encoding.encodeSetLightPower(level, duration),
decode: Encoding.decodeStateLightPower,
defaultResponseMode: 'ack-only',
};
}
export function SetWaveformOptionalCommand(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform, setHue, setSaturation, setBrightness, setKelvin) {
return {
type: Type.SetWaveformOptional,
payload: Encoding.encodeSetWaveformOptional(transient, hue, saturation, brightness, kelvin, period, cycles, skewRatio, waveform, setHue, setSaturation, setBrightness, setKelvin),
decode: Encoding.decodeStateLightPower,
defaultResponseMode: 'ack-only',
};
}
export function GetInfraredCommand() {
return {
type: Type.GetInfrared,
decode: Encoding.decodeStateInfrared,
defaultResponseMode: 'response',
};
}
export function SetInfraredCommand(brightness) {
return {
type: Type.SetInfrared,
payload: Encoding.encodeSetInfrared(brightness),
decode: Encoding.decodeStateInfrared,
defaultResponseMode: 'ack-only',
};
}
export function GetHevCycleCommand() {
return {
type: Type.GetHevCycle,
decode: Encoding.decodeStateHevCycle,
defaultResponseMode: 'response',
};
}
export function SetHevCycleCommand(enable, durationSeconds) {
return {
type: Type.SetHevCycle,
payload: Encoding.encodeSetHevCycle(enable, durationSeconds),
decode: Encoding.decodeStateHevCycle,
defaultResponseMode: 'ack-only',
};
}
export function GetHevCycleConfigurationCommand() {
return {
type: Type.GetHevCycleConfiguration,
decode: Encoding.decodeStateHevCycleConfiguration,
defaultResponseMode: 'response',
};
}
export function SetHevCycleConfigurationCommand(indication, durationSeconds) {
return {
type: Type.SetHevCycleConfiguration,
payload: Encoding.encodeSetHevCycleConfiguration(indication, durationSeconds),
decode: Encoding.decodeStateHevCycleConfiguration,
defaultResponseMode: 'ack-only',
};
}
export function GetLastHevCycleResultCommand() {
return {
type: Type.GetLastHevCycleResult,
decode: Encoding.decodeStateLastHevCycleResult,
defaultResponseMode: 'response',
};
}
//# sourceMappingURL=light.js.map