diff options
author | ctucx <c@ctu.cx> | 2020-09-14 13:01:28 +0200 |
---|---|---|
committer | ctucx <c@ctu.cx> | 2020-09-14 13:01:28 +0200 |
commit | b9b9e730a25b881e822be8a0ad3ab4c787f99361 (patch) | |
tree | f5e6fe7f2014fc2efb1adecda5b7b1e991574b0e /types.nim |
init
Diffstat (limited to 'types.nim')
-rw-r--r-- | types.nim | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/types.nim b/types.nim new file mode 100644 index 0000000..a34d217 --- /dev/null +++ b/types.nim @@ -0,0 +1,72 @@ +import options + +type + TradfriGatewayObj* = object + host*: string + port*: int + user*: string + pass*: string + + TradfriDeviceType* = enum + Remote, slaveRemote, Lightbulb, Plug, motionSensor, signalRepeater, Blind, soundRemote + + TradfriPowerSource* = enum + Unknown, internalBattery, externalBattery, Battery, POE, USB, AC, Solar + + TradfriLightSpectrum* = enum + RGB, White, None + + TradfriDeviceInfo* = object + manufacturer*: string + modelNumber*: string + serialNumber*: string + firmwareVersion*: string + power*: TradfriPowersource + battery*: int + + + TradfriDeviceState* = object + case kind*: TradfriDeviceType + of Remote: + remoteSupported*: bool + + of slaveRemote: + slaveRemoteSupported*: bool + + of Lightbulb: + lightPowered*: bool + lightSpectrum*: TradfriLightSpectrum + lightHue*: Option[int] + lightSaturation*: Option[int] + lightColorHex*: Option[string] + lightColorX*: Option[int] + lightColorY*: Option[int] + lightColorTemperature*: Option[int] + lightBrightness*: int + + of Plug: + plugPowered*: bool + plugDimmer*: int + + of motionSensor: + motionSensorSupported*: bool + + of signalRepeater: + signalRepeaterSupported*: bool + + of Blind: + blindPosition*: float + blindTrigger*: float + + of soundRemote: + soundRemoteSupported*: bool + + TradfriDevice* = object + `type`*: TradfriDeviceType + name*: string + alive*: bool + createdAt*: int + lastSeen*: int + instanceId*: int + info*: TradfriDeviceInfo + state*: TradfriDeviceState |