summaryrefslogtreecommitdiffstats
path: root/types.nim
diff options
context:
space:
mode:
authorctucx <c@ctu.cx>2020-09-14 16:20:59 +0200
committerctucx <c@ctu.cx>2020-09-14 16:20:59 +0200
commit9c93e45919cabbbdf3cf99d1a0ee2f8b7bb9788a (patch)
tree900300aa10ed17d0cbc3f6865d28743745ea2167 /types.nim
parentb9b9e730a25b881e822be8a0ad3ab4c787f99361 (diff)
downloadnimtradfri-9c93e45919cabbbdf3cf99d1a0ee2f8b7bb9788a.tar.gz
nimtradfri-9c93e45919cabbbdf3cf99d1a0ee2f8b7bb9788a.tar.bz2
nimtradfri-9c93e45919cabbbdf3cf99d1a0ee2f8b7bb9788a.zip
update
Diffstat (limited to 'types.nim')
-rw-r--r--types.nim62
1 files changed, 48 insertions, 14 deletions
diff --git a/types.nim b/types.nim
index a34d217..60008c6 100644
--- a/types.nim
+++ b/types.nim
@@ -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