Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Müller-Seydlitz <[email protected]>
  • Loading branch information
timbms authored Jun 24, 2022
1 parent 7aa1001 commit 5915282
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions OpenHABCore/Sources/OpenHABCore/Model/NumberState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
import Foundation

public struct NumberState: CustomStringConvertible, Equatable {
// Access to default memberwise initializer not permitted outside of package

public init(value: Double, unit: String? = "", format: String? = "") {
self.value = value
self.unit = unit
self.format = format
}

public var description: String {
toString(locale: Locale.current)
}
Expand Down
7 changes: 6 additions & 1 deletion openHAB/SetpointUITableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ class SetpointUITableViewCell: GenericUITableViewCell {
newValue = stateValue + widget.step
}
if newValue >= widget.minValue, newValue <= widget.maxValue {
numberState?.value = newValue
if numberState != nil {
numberState?.value = newValue
} else {
numberState = NumberState(value: newValue)
}

widget.sendItemUpdate(state: numberState)
}
}
Expand Down

0 comments on commit 5915282

Please sign in to comment.