Review feedback

This commit is contained in:
2020-05-01 00:16:10 -07:00
parent c60685bf20
commit c6fa9fe960
5 changed files with 22 additions and 19 deletions

View File

@@ -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
}
}

View File

@@ -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`