Improve Home Assistant connection reliability
This commit is contained in:
@@ -35,14 +35,12 @@ extension Device where Self: Hashable
|
||||
{
|
||||
func hash(into hasher: inout Hasher)
|
||||
{
|
||||
hasher.combine(self.name)
|
||||
hasher.combine(self.type)
|
||||
hasher.combine(self.serial)
|
||||
}
|
||||
|
||||
static func == (lhs: Self, rhs: Self) -> Bool
|
||||
{
|
||||
return lhs.name == rhs.name && lhs.serial == rhs.serial
|
||||
return lhs.serial == rhs.serial
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,10 @@ extension HubitatDevice : Decodable
|
||||
|
||||
name = try values.decode(String.self, forKey: .name)
|
||||
|
||||
let attributes = try values.nestedContainer(keyedBy: Self.AttributesKeys, forKey: .attributes)
|
||||
let attributes = try values.nestedContainer(
|
||||
keyedBy: Self.AttributesKeys.self,
|
||||
forKey: .attributes
|
||||
)
|
||||
state = try attributes.decode(DeviceState.self, forKey: .switch)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user