Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Mar 13, 2024
1 parent 8e9c012 commit d45f18b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"location" : "https://github.com/MillerTechnologyPeru/Govee.git",
"state" : {
"branch" : "master",
"revision" : "b4440fb9ef4ddcb20013eb2e9be40bedf87e687e"
"revision" : "d681e837edc832fc877a409c7d9d967afda8f416"
}
},
{
Expand Down
19 changes: 8 additions & 11 deletions Sources/TempSensorHomeKit/GoveeThermometerAccessory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ final class GoveeThermometerAccessory: HAP.Accessory.Thermometer, SensorAccessor

let battery = BatteryService()

init(peripheral: NativeCentral.Peripheral, advertisement: GoveeAdvertisement.Thermometer, configuration: SensorConfiguration.Sensor?) {
init(peripheral: NativeCentral.Peripheral, advertisement: GoveeAccessory.Thermometer, configuration: SensorConfiguration.Sensor?) {
self.peripheral = peripheral
self.configuration = configuration
let id = advertisement.name.address.rawValue
#if os(Linux)
assert(id == peripheral.description)
#endif
let id = advertisement.name.rawValue
let info = Service.Info.Info(
name: configuration?.name ?? "Govee Thermometer Sensor",
serialNumber: id,
Expand All @@ -58,13 +55,13 @@ final class GoveeThermometerAccessory: HAP.Accessory.Thermometer, SensorAccessor
self.update(advertisement: advertisement)
}

func update(advertisement: GoveeAdvertisement.Thermometer) {
func update(advertisement: GoveeAccessory.Thermometer) {
self.lastSeen = Date()
self.reachable = true
self.battery.batteryLevel?.value = advertisement.manufacturingData.batteryLevel
self.battery.statusLowBattery.value = advertisement.manufacturingData.batteryLevel < 25 ? .batteryLow : .batteryNormal
self.temperatureSensor.currentTemperature.value = advertisement.manufacturingData.temperature + (configuration?.calibration?.temperature ?? 0.0)
self.humidity.currentRelativeHumidity.value = advertisement.manufacturingData.humidity + (configuration?.calibration?.humidity ?? 0.0)
self.battery.batteryLevel?.value = advertisement.manufacturerData.batteryLevel
self.battery.statusLowBattery.value = advertisement.manufacturerData.batteryLevel < 25 ? .batteryLow : .batteryNormal
self.temperatureSensor.currentTemperature.value = advertisement.manufacturerData.temperature + (configuration?.calibration?.temperature ?? 0.0)
self.humidity.currentRelativeHumidity.value = advertisement.manufacturerData.humidity + (configuration?.calibration?.humidity ?? 0.0)
}
}

Expand All @@ -87,7 +84,7 @@ extension GoveeThermometerAccessory {
}
}

extension GoveeAdvertisement.Thermometer: SensorAdvertisement {
extension GoveeAccessory.Thermometer: SensorAdvertisement {

public static var sensorType: String { "com.Govee.Thermometer" }
}

0 comments on commit d45f18b

Please sign in to comment.