feat: Working on async integrations.
This commit is contained in:
@@ -3,7 +3,7 @@ import Psychrometrics
|
||||
/// Represents a temperature and humidity sensor that can be used to derive
|
||||
/// the dew-point temperature and enthalpy values.
|
||||
///
|
||||
public struct TemperatureAndHumiditySensor: Equatable, Identifiable {
|
||||
public struct TemperatureAndHumiditySensor: Equatable, Hashable, Identifiable {
|
||||
|
||||
/// The identifier of the sensor, same as the location.
|
||||
public var id: Location { location }
|
||||
@@ -93,7 +93,7 @@ public struct TemperatureAndHumiditySensor: Equatable, Identifiable {
|
||||
}
|
||||
|
||||
/// Represents the MQTT topics to listen for updated sensor values on.
|
||||
public struct Topics: Equatable {
|
||||
public struct Topics: Equatable, Hashable {
|
||||
|
||||
/// The temperature topic of the sensor.
|
||||
public let temperature: String
|
||||
@@ -111,7 +111,7 @@ public struct TemperatureAndHumiditySensor: Equatable, Identifiable {
|
||||
|
||||
init(location: TemperatureAndHumiditySensor.Location) {
|
||||
self.temperature = "sensors/\(location.rawValue)/temperature"
|
||||
self.humidity = "sensors/\(location.rawValue)/temperature"
|
||||
self.humidity = "sensors/\(location.rawValue)/humidity"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,3 +88,11 @@ extension TrackedChanges: Equatable where Value: Equatable {
|
||||
self.init(wrappedValue: wrappedValue, needsProcessed: needsProcessed, isEqual: ==)
|
||||
}
|
||||
}
|
||||
|
||||
extension TrackedChanges: Hashable where Value: Hashable {
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(wrappedValue)
|
||||
hasher.combine(needsProcessed)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user