diff options
author | ctucx <c@ctu.cx> | 2020-09-14 16:20:59 +0200 |
---|---|---|
committer | ctucx <c@ctu.cx> | 2020-09-14 16:20:59 +0200 |
commit | 9c93e45919cabbbdf3cf99d1a0ee2f8b7bb9788a (patch) | |
tree | 900300aa10ed17d0cbc3f6865d28743745ea2167 /types.nim | |
parent | b9b9e730a25b881e822be8a0ad3ab4c787f99361 (diff) |
update
Diffstat (limited to 'types.nim')
-rw-r--r-- | types.nim | 62 |
1 files changed, 48 insertions, 14 deletions
@@ -1,12 +1,6 @@ import options type - TradfriGatewayObj* = object - host*: string - port*: int - user*: string - pass*: string - TradfriDeviceType* = enum Remote, slaveRemote, Lightbulb, Plug, motionSensor, signalRepeater, Blind, soundRemote @@ -16,6 +10,16 @@ type TradfriLightSpectrum* = enum RGB, White, None + TradfriDeviceActionType* = enum + LightSetPowerState, LightSetBrightness, LightSetColorHex, LightSetColorXY, LightSetHueSaturation, LightSetColorTemperature, PlugSetPowerState, PlugSetDimmerValue + + + TradfriGatewayRef* = object + host*: string + port*: int + user*: string + pass*: string + TradfriDeviceInfo* = object manufacturer*: string modelNumber*: string @@ -62,11 +66,41 @@ type soundRemoteSupported*: bool TradfriDevice* = object - `type`*: TradfriDeviceType - name*: string - alive*: bool - createdAt*: int - lastSeen*: int - instanceId*: int - info*: TradfriDeviceInfo - state*: TradfriDeviceState + gatewayRef*: TradfriGatewayRef + `type`*: TradfriDeviceType + id*: int + name*: string + alive*: bool + createdAt*: int + lastSeen*: int + info*: TradfriDeviceInfo + state*: TradfriDeviceState + + TradfriDeviceAction* = object + transitionTime*: int + case kind*: TradfriDeviceActionType + of LightSetPowerState: + lightPowerState*: bool + + of LightSetBrightness: + lightBrightness*: bool + + of LightSetColorHex: + lightColorHex*: string + + of LightSetColorXY: + lightColorX*: int + lightColorY*: int + + of LightSetHueSaturation: + lightHue*: int + lightSaturation*: int + + of LightSetColorTemperature: + lightColorTemperature*: int + + of PlugSetPowerState: + plugPowerState*: bool + + of PlugSetDimmerValue: + plugDimmerValue*: int |