class TuyaCloud::Device
Attributes
controls[RW]
id[RW]
name[RW]
type[RW]
Public Class Methods
new(json, auth_context)
click to toggle source
# File lib/tuya_cloud/device.rb, line 10 def initialize(json, auth_context) self.id = json['id'] self.name = json['name'] self.type = json['dev_type'] case type when 'light' self.controls = if json['data'] && json['data']['color_mode'] ColorLight.new(json, auth_context) else Light.new(json, auth_context) end when 'switch' self.controls = Switch.new(json, auth_context) when 'scene' self.controls = Scene.new(json, auth_context) else raise ArgumentError, 'unknown device type' end end