mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 07:47:08 +00:00
Add icon translations to Syncthing (#112297)
This commit is contained in:
parent
2c34c918fc
commit
446314bb27
@ -20,14 +20,3 @@ EVENTS = {
|
|||||||
"StateChanged": STATE_CHANGED_RECEIVED,
|
"StateChanged": STATE_CHANGED_RECEIVED,
|
||||||
"FolderPaused": FOLDER_PAUSED_RECEIVED,
|
"FolderPaused": FOLDER_PAUSED_RECEIVED,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FOLDER_SENSOR_ICONS = {
|
|
||||||
"paused": "mdi:folder-clock",
|
|
||||||
"scanning": "mdi:folder-search",
|
|
||||||
"syncing": "mdi:folder-sync",
|
|
||||||
"idle": "mdi:folder",
|
|
||||||
}
|
|
||||||
|
|
||||||
FOLDER_SENSOR_ALERT_ICON = "mdi:folder-alert"
|
|
||||||
FOLDER_SENSOR_DEFAULT_ICON = "mdi:folder"
|
|
||||||
|
16
homeassistant/components/syncthing/icons.json
Normal file
16
homeassistant/components/syncthing/icons.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"entity": {
|
||||||
|
"sensor": {
|
||||||
|
"syncthing": {
|
||||||
|
"default": "mdi:folder-alert",
|
||||||
|
"state": {
|
||||||
|
"unknown": "mdi:folder",
|
||||||
|
"idle": "mdi:folder",
|
||||||
|
"scanning": "mdi:folder-search",
|
||||||
|
"syncing": "mdi:folder-sync",
|
||||||
|
"paused": "mdi:folder-clock"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,9 +13,6 @@ from homeassistant.helpers.event import async_track_time_interval
|
|||||||
from .const import (
|
from .const import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
FOLDER_PAUSED_RECEIVED,
|
FOLDER_PAUSED_RECEIVED,
|
||||||
FOLDER_SENSOR_ALERT_ICON,
|
|
||||||
FOLDER_SENSOR_DEFAULT_ICON,
|
|
||||||
FOLDER_SENSOR_ICONS,
|
|
||||||
FOLDER_SUMMARY_RECEIVED,
|
FOLDER_SUMMARY_RECEIVED,
|
||||||
SCAN_INTERVAL,
|
SCAN_INTERVAL,
|
||||||
SERVER_AVAILABLE,
|
SERVER_AVAILABLE,
|
||||||
@ -57,6 +54,7 @@ class FolderSensor(SensorEntity):
|
|||||||
"""A Syncthing folder sensor."""
|
"""A Syncthing folder sensor."""
|
||||||
|
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
_attr_translation_key = "syncthing"
|
||||||
|
|
||||||
STATE_ATTRIBUTES = {
|
STATE_ATTRIBUTES = {
|
||||||
"errors": "errors",
|
"errors": "errors",
|
||||||
@ -116,15 +114,6 @@ class FolderSensor(SensorEntity):
|
|||||||
"""Could the device be accessed during the last update call."""
|
"""Could the device be accessed during the last update call."""
|
||||||
return self._state is not None
|
return self._state is not None
|
||||||
|
|
||||||
@property
|
|
||||||
def icon(self):
|
|
||||||
"""Return the icon for this sensor."""
|
|
||||||
if self._state is None:
|
|
||||||
return FOLDER_SENSOR_DEFAULT_ICON
|
|
||||||
if self.state in FOLDER_SENSOR_ICONS:
|
|
||||||
return FOLDER_SENSOR_ICONS[self.state]
|
|
||||||
return FOLDER_SENSOR_ALERT_ICON
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user