Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
package com.example.retroha.model
|
||||
enum class EntityState { ON, OFF, UNAVAILABLE, TOGGLING }
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.example.retroha.model
|
||||
data class WidgetConfig(
|
||||
val id: Long,
|
||||
val entityId: String,
|
||||
val label: String,
|
||||
val value: String,
|
||||
val secondary: String,
|
||||
val domain: String,
|
||||
val state: EntityState,
|
||||
val brightness: Int? = null
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.example.retroha.model
|
||||
enum class WidgetInteraction { TOGGLE, EXECUTE, READ_ONLY }
|
||||
fun String.toWidgetInteraction(): WidgetInteraction = when (this) {
|
||||
"light",
|
||||
"switch",
|
||||
"fan",
|
||||
"input_boolean",
|
||||
"automation",
|
||||
"lock" -> WidgetInteraction.TOGGLE
|
||||
"script",
|
||||
"scene",
|
||||
"button",
|
||||
"input_button" -> WidgetInteraction.EXECUTE
|
||||
else -> WidgetInteraction.READ_ONLY
|
||||
}
|
||||
Reference in New Issue
Block a user