mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add "gate" device class for DEVICE_CLASS_GATE (#5299)
* Add "gate" device class for DEVICE_CLASS_GATE Gates are found outside of a structure and are typically part of a fence. When opening or closing a garage door, it was impossible to tell if you had hit the button or not even though the underlying state was reported as "opening". This lead to confusion and multiple clicks to open a garage door which can cause the door to stop opening and result in frustration. Add icons for gate and garage opening and closing states. * Add "gate" device class for DEVICE_CLASS_GATE Gates are found outside of a structure and are typically part of a fence. When opening or closing a garage door, it was impossible to tell if you had hit the button or not even though the underlying state was reported as "opening". This lead to confusion and multiple clicks to open a garage door which can cause the door to stop opening and result in frustration. Add icons for gate and garage opening and closing states. * de-bold
This commit is contained in:
parent
1950656bd5
commit
f2578a58b4
@ -4,17 +4,58 @@ import { domainIcon } from "./domain_icon";
|
||||
|
||||
export const coverIcon = (state: HassEntity): string => {
|
||||
const open = state.state !== "closed";
|
||||
|
||||
switch (state.attributes.device_class) {
|
||||
case "garage":
|
||||
return open ? "hass:garage-open" : "hass:garage";
|
||||
switch (state.state) {
|
||||
case "opening":
|
||||
return "hass:arrow-up-box";
|
||||
case "closing":
|
||||
return "hass:arrow-down-box";
|
||||
case "closed":
|
||||
return "hass:garage";
|
||||
default:
|
||||
return "hass:garage-open";
|
||||
}
|
||||
case "gate":
|
||||
switch (state.state) {
|
||||
case "opening":
|
||||
case "closing":
|
||||
return "hass:gate-arrow-right";
|
||||
case "closed":
|
||||
return "hass:gate";
|
||||
default:
|
||||
return "hass:gate-open";
|
||||
}
|
||||
case "door":
|
||||
return open ? "hass:door-open" : "hass:door-closed";
|
||||
case "damper":
|
||||
return open ? "hass:circle" : "hass:circle-slice-8";
|
||||
case "shutter":
|
||||
return open ? "hass:window-shutter-open" : "hass:window-shutter";
|
||||
case "blind":
|
||||
return open ? "hass:blinds-open" : "hass:blinds";
|
||||
case "curtain":
|
||||
switch (state.state) {
|
||||
case "opening":
|
||||
return "hass:arrow-up-box";
|
||||
case "closing":
|
||||
return "hass:arrow-down-box";
|
||||
case "closed":
|
||||
return "hass:blinds";
|
||||
default:
|
||||
return "hass:blinds-open";
|
||||
}
|
||||
case "window":
|
||||
return open ? "hass:window-open" : "hass:window-closed";
|
||||
switch (state.state) {
|
||||
case "opening":
|
||||
return "hass:arrow-up-box";
|
||||
case "closing":
|
||||
return "hass:arrow-down-box";
|
||||
case "closed":
|
||||
return "hass:window-closed";
|
||||
default:
|
||||
return "hass:window-open";
|
||||
}
|
||||
default:
|
||||
return domainIcon("cover", state.state);
|
||||
}
|
||||
|
@ -77,7 +77,16 @@ export const domainIcon = (domain: string, state?: string): string => {
|
||||
: "hass:checkbox-marked-circle";
|
||||
|
||||
case "cover":
|
||||
return state === "closed" ? "hass:window-closed" : "hass:window-open";
|
||||
switch (state) {
|
||||
case "opening":
|
||||
return "hass:arrow-up-box";
|
||||
case "closing":
|
||||
return "hass:arrow-down-box";
|
||||
case "closed":
|
||||
return "hass:window-closed";
|
||||
default:
|
||||
return "hass:window-open";
|
||||
}
|
||||
|
||||
case "lock":
|
||||
return state && state === "unlocked" ? "hass:lock-open" : "hass:lock";
|
||||
|
Loading…
x
Reference in New Issue
Block a user