diff --git a/homeassistant/components/syncthing/const.py b/homeassistant/components/syncthing/const.py index a9ec0ad0375..0e5b2714be8 100644 --- a/homeassistant/components/syncthing/const.py +++ b/homeassistant/components/syncthing/const.py @@ -20,14 +20,3 @@ EVENTS = { "StateChanged": STATE_CHANGED_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" diff --git a/homeassistant/components/syncthing/icons.json b/homeassistant/components/syncthing/icons.json new file mode 100644 index 00000000000..0e86b6e4fa3 --- /dev/null +++ b/homeassistant/components/syncthing/icons.json @@ -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" + } + } + } + } +} diff --git a/homeassistant/components/syncthing/sensor.py b/homeassistant/components/syncthing/sensor.py index c88de91cae0..7b22017c9c1 100644 --- a/homeassistant/components/syncthing/sensor.py +++ b/homeassistant/components/syncthing/sensor.py @@ -13,9 +13,6 @@ from homeassistant.helpers.event import async_track_time_interval from .const import ( DOMAIN, FOLDER_PAUSED_RECEIVED, - FOLDER_SENSOR_ALERT_ICON, - FOLDER_SENSOR_DEFAULT_ICON, - FOLDER_SENSOR_ICONS, FOLDER_SUMMARY_RECEIVED, SCAN_INTERVAL, SERVER_AVAILABLE, @@ -57,6 +54,7 @@ class FolderSensor(SensorEntity): """A Syncthing folder sensor.""" _attr_should_poll = False + _attr_translation_key = "syncthing" STATE_ATTRIBUTES = { "errors": "errors", @@ -116,15 +114,6 @@ class FolderSensor(SensorEntity): """Could the device be accessed during the last update call.""" 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 def extra_state_attributes(self): """Return the state attributes."""