Skip to content

Commit

Permalink
Disable input_select until the options get fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Sep 30, 2016
1 parent a35a72c commit 8f2f35a
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions HomeAssistant/GroupViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ class GroupViewController: FormViewController {
}
}
}
case "input_select":
self.form.last! <<< PickerInlineRow<String>(entity.ID) {
$0.title = entity.Name
$0.value = entity.State
$0.options = entity.Attributes["options"] as! [String]
}.onChange { row -> Void in
let _ = HomeAssistantAPI.sharedInstance.CallService(domain: "input_select", service: "select_option", serviceData: ["entity_id": entity.ID as AnyObject, "option": row.value! as AnyObject])
}.cellUpdate { cell, row in
cell.imageView?.image = entity.EntityIcon
if let picture = entity.DownloadedPicture {
cell.imageView?.image = picture.scaledToSize(CGSize(width: 30, height: 30))
}
}
// case "input_select":
// self.form.last! <<< PickerInlineRow<String>(entity.ID) {
// $0.title = entity.Name
// $0.value = entity.State
// $0.options = entity.Attributes["options"] as! [String]
// }.onChange { row -> Void in
// let _ = HomeAssistantAPI.sharedInstance.CallService(domain: "input_select", service: "select_option", serviceData: ["entity_id": entity.ID as AnyObject, "option": row.value! as AnyObject])
// }.cellUpdate { cell, row in
// cell.imageView?.image = entity.EntityIcon
// if let picture = entity.DownloadedPicture {
// cell.imageView?.image = picture.scaledToSize(CGSize(width: 30, height: 30))
// }
// }
case "lock":
self.form.last! <<< SwitchRow(entity.ID) {
$0.title = entity.Name
Expand Down Expand Up @@ -217,7 +217,11 @@ class GroupViewController: FormViewController {
// }
row.displayValueFor = { (pos: Float?) in
print(pos)
return (entity.State.capitalized + " " + entity.UnitOfMeasurement!)
if let uom = entity.UnitOfMeasurement {
return (entity.State.capitalized + " " + uom)
} else {
return entity.State.capitalized
}
}
}
default:
Expand Down

0 comments on commit 8f2f35a

Please sign in to comment.