-
Notifications
You must be signed in to change notification settings - Fork 277
/
InputSlider.swift
34 lines (27 loc) · 945 Bytes
/
InputSlider.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// InputSlider.swift
// HomeAssistant
//
// Created by Robbie Trencheny on 9/5/16.
// Copyright © 2016 Robbie Trencheny. All rights reserved.
//
import Foundation
import ObjectMapper
import RealmSwift
class InputSlider: Entity {
var Minimum = RealmOptional<Float>()
var Maximum = RealmOptional<Float>()
var Step = RealmOptional<Int>()
override func mapping(map: Map) {
super.mapping(map: map)
Maximum.value <- map["attributes.max"]
Minimum.value <- map["attributes.min"]
Step.value <- map["attributes.step"]
}
override var ComponentIcon: String {
return "mdi:ray-vertex"
}
func SelectValue(_ value: Float) {
let _ = HomeAssistantAPI.sharedInstance.CallService(domain: "input_slider", service: "select_value", serviceData: ["entity_id": self.ID as AnyObject, "value": value as AnyObject])
}
}