Skip to content

Commit

Permalink
Merge pull request #13 from Cyberbeni/unnamed-device-fix
Browse files Browse the repository at this point in the history
Fix child devices being reported as 'Unnamed device'
  • Loading branch information
Cyberbeni authored Nov 4, 2024
2 parents 0fbf749 + e5d83cc commit 56b3dba
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion Sources/Wiring/App/App+BridgeStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ extension App {
),
deviceClass: .connectivity,
name: nil,
objectId: nil,
payloadOff: Mqtt.Availability.offline.rawValue,
payloadOn: Mqtt.Availability.online.rawValue,
stateTopic: stateTopic,
Expand Down
5 changes: 2 additions & 3 deletions Sources/Wiring/App/App+Presence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ extension App {
availabilityTopic: mqttClient.stateTopic,
device: .init(
identifiers: stateTopic,
name: nil,
name: name,
viaDevice: mqttClient.stateTopic
),
deviceClass: .presence,
name: name,
objectId: name,
name: .explicitNone,
payloadOff: nil,
payloadOn: nil,
stateTopic: stateTopic,
Expand Down
3 changes: 3 additions & 0 deletions Sources/Wiring/Extensions/Optional+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extension String?? {
static var explicitNone: Self { .some(.none) }
}
4 changes: 2 additions & 2 deletions Sources/Wiring/HomeAssistantMqtt/MqttBinarySensor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ extension Mqtt {
let availabilityTopic: String?
let device: Device
let deviceClass: DeviceClass
let name: String?
let objectId: String?
/// Can be set to `.explicitNone` if only the device name is relevant.
let name: String??
let payloadOff: String?
let payloadOn: String?
let stateTopic: String
Expand Down

0 comments on commit 56b3dba

Please sign in to comment.