Skip to content

Commit

Permalink
Add some missing strings, match state casing with HA core
Browse files Browse the repository at this point in the history
  • Loading branch information
dshokouhi committed Aug 7, 2023
1 parent 8606567 commit 594d1e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,16 +636,19 @@ fun <T> Entity<T>.friendlyState(context: Context, options: EntityRegistryOptions
"armed_home" -> context.getString(commonR.string.state_armed_home)
"armed_night" -> context.getString(commonR.string.state_armed_night)
"armed_vacation" -> context.getString(commonR.string.state_armed_vacation)
"arming" -> context.getString(commonR.string.state_arming)
"closed" -> context.getString(commonR.string.state_closed)
"closing" -> context.getString(commonR.string.state_closing)
"disarmed" -> context.getString(commonR.string.state_disarmed)
"disarming" -> context.getString(commonR.string.state_disarming)
"jammed" -> context.getString(commonR.string.state_jammed)
"locked" -> context.getString(commonR.string.state_locked)
"locking" -> context.getString(commonR.string.state_locking)
"off" -> context.getString(commonR.string.state_off)
"on" -> context.getString(commonR.string.state_on)
"open" -> context.getString(commonR.string.state_open)
"opening" -> context.getString(commonR.string.state_opening)
"pending" -> context.getString(commonR.string.state_pending)
"triggered" -> context.getString(commonR.string.state_triggered)
"unavailable" -> context.getString(commonR.string.state_unavailable)
"unlocked" -> context.getString(commonR.string.state_unlocked)
Expand Down Expand Up @@ -696,12 +699,13 @@ fun <T> Entity<T>.friendlyState(context: Context, options: EntityRegistryOptions
fun <T> Entity<T>.canSupportPrecision() = domain == "sensor" && state.toDoubleOrNull() != null

fun <T> Entity<T>.isExecuting() = when (state) {
"arming" -> true
"buffering" -> true
"closing" -> true
"disarming" -> true
"locking" -> true
"opening" -> true
"pending" -> true
"unlocking" -> true
"buffering" -> true
"disarming" -> true
"arming" -> true
else -> false
}
13 changes: 8 additions & 5 deletions common/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,12 @@
<string name="alarm_control_panels">Alarm Control Panels</string>
<string name="state_triggered">Triggered</string>
<string name="state_disarmed">Disarmed</string>
<string name="state_armed_vacation">Armed Vacation</string>
<string name="state_armed_night">Armed Night</string>
<string name="state_armed_home">Armed Home</string>
<string name="state_armed_custom_bypass">Armed Custom Bypass</string>
<string name="state_armed_away">Armed Away</string>
<string name="state_armed_vacation">Armed vacation</string>
<string name="state_armed_night">Armed night</string>
<string name="state_armed_home">Armed home</string>
<string name="state_armed_custom_bypass">Armed custom bypass</string>
<string name="state_armed_away">Armed away</string>
<string name="state_arming">Arming</string>
<string name="state_disarming">Disarming</string>
<string name="state_pending">Pending</string>
</resources>

0 comments on commit 594d1e5

Please sign in to comment.