Review feedback
This commit is contained in:
@@ -10,13 +10,13 @@ import Foundation
|
||||
|
||||
enum DeviceState : String, Codable
|
||||
{
|
||||
case off = "off"
|
||||
case on = "on"
|
||||
case off
|
||||
case on
|
||||
}
|
||||
|
||||
enum DeviceType : String, Codable
|
||||
{
|
||||
case `switch` = "switch"
|
||||
case `switch`
|
||||
}
|
||||
|
||||
protocol Device
|
||||
@@ -50,20 +50,21 @@ class AnyDevice : Device
|
||||
private var device: Device
|
||||
|
||||
public var name: String
|
||||
{ get { return device.name } }
|
||||
{ return device.name }
|
||||
|
||||
public var serial: String
|
||||
{ get { return device.serial } }
|
||||
{ return device.serial }
|
||||
|
||||
public var type: DeviceType
|
||||
{ get { return device.type } }
|
||||
{ return device.type }
|
||||
|
||||
public var state: DeviceState {
|
||||
get { return device.state }
|
||||
set { device.state = newValue }
|
||||
}
|
||||
|
||||
init(_ device: Device) {
|
||||
init(_ device: Device)
|
||||
{
|
||||
self.device = device
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,15 @@ public struct HubitatDevice : Device
|
||||
|
||||
var id: Int = -1
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
enum CodingKeys: String, CodingKey
|
||||
{
|
||||
case name = "label"
|
||||
case id = "id"
|
||||
case attributes = "attributes"
|
||||
}
|
||||
|
||||
enum AttributesKeys: String, CodingKey {
|
||||
enum AttributesKeys: String, CodingKey
|
||||
{
|
||||
case power
|
||||
case dataType
|
||||
case `switch`
|
||||
|
||||
Reference in New Issue
Block a user