mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-11-08 05:03:52 -05:00
Update translations and add icons.json file
This commit is contained in:
@@ -58,7 +58,7 @@ DESCRIPTORS = (
|
||||
),
|
||||
OasisMiniButtonEntityDescription(
|
||||
key="random_track",
|
||||
name="Play random track",
|
||||
translation_key="random_track",
|
||||
press_fn=play_random_track,
|
||||
),
|
||||
)
|
||||
|
||||
45
custom_components/oasis_mini/icons.json
Normal file
45
custom_components/oasis_mini/icons.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"wifi_status": {
|
||||
"default": "mdi:wifi",
|
||||
"state": {
|
||||
"off": "mdi:wifi-off"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"download_progress": {
|
||||
"default": "mdi:progress-download"
|
||||
},
|
||||
"drawing_progress": {
|
||||
"default": "mdi:progress-pencil"
|
||||
},
|
||||
"error": {
|
||||
"default": "mdi:alert-circle-outline",
|
||||
"state": {
|
||||
"0": "mdi:circle-outline"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"state": {
|
||||
"booting": "mdi:loading",
|
||||
"centering": "mdi:record-circle-outline",
|
||||
"downloading": "mdi:progress-download",
|
||||
"error": "mdi:alert-circle-outline",
|
||||
"live": "mdi:pencil-circle-outline",
|
||||
"paused": "mdi:motion-pause-outline",
|
||||
"playing": "mdi:motion-play-outline",
|
||||
"stopped": "mdi:stop-circle-outline",
|
||||
"updating": "mdi:update"
|
||||
}
|
||||
},
|
||||
"wifi_connected": {
|
||||
"default": "mdi:wifi",
|
||||
"state": {
|
||||
"off": "mdi:wifi-off"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class OasisMiniLightEntity(OasisMiniEntity, LightEntity):
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
|
||||
DESCRIPTOR = LightEntityDescription(key="led", name="LED")
|
||||
DESCRIPTOR = LightEntityDescription(key="led", translation_key="led")
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
|
||||
@@ -165,11 +165,17 @@ class OasisMiniMediaPlayerEntity(OasisMiniEntity, MediaPlayerEntity):
|
||||
"""Play a piece of media."""
|
||||
self.abort_if_busy()
|
||||
if media_type == MediaType.PLAYLIST:
|
||||
raise ServiceValidationError("Playlists are not currently supported")
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN, translation_key="playlists_unsupported"
|
||||
)
|
||||
else:
|
||||
track = list(filter(None, map(get_track_id, media_id.split(","))))
|
||||
if not track:
|
||||
raise ServiceValidationError(f"Invalid media: {media_id}")
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="invalid_media",
|
||||
translation_placeholders={"media": media_id},
|
||||
)
|
||||
|
||||
device = self.device
|
||||
enqueue = MediaPlayerEnqueue.NEXT if not enqueue else enqueue
|
||||
|
||||
@@ -35,14 +35,14 @@ class OasisMiniNumberEntity(OasisMiniEntity, NumberEntity):
|
||||
DESCRIPTORS = {
|
||||
NumberEntityDescription(
|
||||
key="ball_speed",
|
||||
name="Ball speed",
|
||||
translation_key="ball_speed",
|
||||
mode=NumberMode.SLIDER,
|
||||
native_max_value=BALL_SPEED_MAX,
|
||||
native_min_value=BALL_SPEED_MIN,
|
||||
),
|
||||
NumberEntityDescription(
|
||||
key="led_speed",
|
||||
name="LED speed",
|
||||
translation_key="led_speed",
|
||||
mode=NumberMode.SLIDER,
|
||||
native_max_value=LED_SPEED_MAX,
|
||||
native_min_value=LED_SPEED_MIN,
|
||||
|
||||
@@ -85,20 +85,20 @@ def playlist_update_handler(entity: OasisMiniSelectEntity) -> None:
|
||||
|
||||
|
||||
DESCRIPTORS = (
|
||||
OasisMiniSelectEntityDescription(
|
||||
key="playlist",
|
||||
name="Playlist",
|
||||
current_value=lambda device: (device.playlist.copy(), device.playlist_index),
|
||||
select_fn=lambda device, option: device.async_change_track(option),
|
||||
update_handler=playlist_update_handler,
|
||||
),
|
||||
OasisMiniSelectEntityDescription(
|
||||
key="autoplay",
|
||||
name="Autoplay",
|
||||
translation_key="autoplay",
|
||||
options=list(AUTOPLAY_MAP.values()),
|
||||
current_value=lambda device: device.autoplay,
|
||||
select_fn=lambda device, option: device.async_set_autoplay(option),
|
||||
),
|
||||
OasisMiniSelectEntityDescription(
|
||||
key="playlist",
|
||||
translation_key="playlist",
|
||||
current_value=lambda device: (device.playlist.copy(), device.playlist_index),
|
||||
select_fn=lambda device, option: device.async_change_track(option),
|
||||
update_handler=playlist_update_handler,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -39,16 +39,15 @@ async def async_setup_entry(
|
||||
DESCRIPTORS = {
|
||||
SensorEntityDescription(
|
||||
key="download_progress",
|
||||
translation_key="download_progress",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
name="Download progress",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
} | {
|
||||
SensorEntityDescription(
|
||||
key=key,
|
||||
name=key.replace("_", " ").capitalize(),
|
||||
translation_key=key,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
@@ -65,8 +64,8 @@ DESCRIPTORS = {
|
||||
CLOUD_DESCRIPTORS = (
|
||||
SensorEntityDescription(
|
||||
key="drawing_progress",
|
||||
translation_key="drawing_progress",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
name="Drawing progress",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=1,
|
||||
|
||||
@@ -38,7 +38,53 @@
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"button": {
|
||||
"random_track": {
|
||||
"name": "Play random track"
|
||||
}
|
||||
},
|
||||
"binary_sensor": {
|
||||
"busy": {
|
||||
"name": "Busy"
|
||||
},
|
||||
"wifi_status": {
|
||||
"name": "Wi-Fi status"
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"led": {
|
||||
"name": "LED"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"ball_speed": {
|
||||
"name": "Ball speed"
|
||||
},
|
||||
"led_speed": {
|
||||
"name": "LED speed"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"autoplay": {
|
||||
"name": "Autoplay"
|
||||
},
|
||||
"playlist": {
|
||||
"name": "Playlist"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"download_progress": {
|
||||
"name": "Download progress"
|
||||
},
|
||||
"drawing_progress": {
|
||||
"name": "Drawing progress"
|
||||
},
|
||||
"error": {
|
||||
"name": "Error"
|
||||
},
|
||||
"led_color_id": {
|
||||
"name": "LED color ID"
|
||||
},
|
||||
"status": {
|
||||
"name": "Status",
|
||||
"state": {
|
||||
@@ -54,5 +100,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
"device_busy": {
|
||||
"message": "{name} is currently busy and cannot be modified"
|
||||
},
|
||||
"invalid_media": {
|
||||
"message": "Invalid media: {media}"
|
||||
},
|
||||
"playlists_unsupported": {
|
||||
"message": "Playlists are not currently supported"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,53 @@
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"button": {
|
||||
"random_track": {
|
||||
"name": "Play random track"
|
||||
}
|
||||
},
|
||||
"binary_sensor": {
|
||||
"busy": {
|
||||
"name": "Busy"
|
||||
},
|
||||
"wifi_status": {
|
||||
"name": "Wi-Fi status"
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"led": {
|
||||
"name": "LED"
|
||||
}
|
||||
},
|
||||
"number": {
|
||||
"ball_speed": {
|
||||
"name": "Ball speed"
|
||||
},
|
||||
"led_speed": {
|
||||
"name": "LED speed"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"autoplay": {
|
||||
"name": "Autoplay"
|
||||
},
|
||||
"playlist": {
|
||||
"name": "Playlist"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"download_progress": {
|
||||
"name": "Download progress"
|
||||
},
|
||||
"drawing_progress": {
|
||||
"name": "Drawing progress"
|
||||
},
|
||||
"error": {
|
||||
"name": "Error"
|
||||
},
|
||||
"led_color_id": {
|
||||
"name": "LED color ID"
|
||||
},
|
||||
"status": {
|
||||
"name": "Status",
|
||||
"state": {
|
||||
@@ -54,5 +100,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"exceptions": {
|
||||
"device_busy": {
|
||||
"message": "{name} is currently busy and cannot be modified"
|
||||
},
|
||||
"invalid_media": {
|
||||
"message": "Invalid media: {media}"
|
||||
},
|
||||
"playlists_unsupported": {
|
||||
"message": "Playlists are not currently supported"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user