Skip to content

Commit

Permalink
Fix a binary sensor icon issue
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Sep 20, 2016
1 parent 18af536 commit e5c44a7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions HomeAssistant/BinarySensorComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ class BinarySensor: SwitchableEntity {
if self.Icon != nil { return self.Icon! }

let activated = (self.IsOn == false)
if self.SensorClass == nil && activated {
return "mdi:checkbox-marked-circle"
}
switch (self.SensorClass!) {
if let sensorClass = self.SensorClass {
switch (sensorClass) {
case "connectivity":
return activated ? "mdi:server-network-off" : "mdi:server-network"
case "light":
Expand All @@ -52,6 +50,13 @@ class BinarySensor: SwitchableEntity {
return activated ? "mdi:verified" : "mdi:alert"
default:
return activated ? "mdi:radiobox-blank" : "mdi:checkbox-marked-circle"
}
} else {
if activated {
return "mdi:radiobox-blank"
} else {
return "mdi:checkbox-marked-circle"
}
}
}
}

0 comments on commit e5c44a7

Please sign in to comment.