mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-11-16 17:13:49 -05:00
Update translations and add icons.json file
This commit is contained in:
@@ -58,7 +58,7 @@ DESCRIPTORS = (
|
|||||||
),
|
),
|
||||||
OasisMiniButtonEntityDescription(
|
OasisMiniButtonEntityDescription(
|
||||||
key="random_track",
|
key="random_track",
|
||||||
name="Play random track",
|
translation_key="random_track",
|
||||||
press_fn=play_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()
|
await self.coordinator.async_request_refresh()
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = LightEntityDescription(key="led", name="LED")
|
DESCRIPTOR = LightEntityDescription(key="led", translation_key="led")
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
|
|||||||
@@ -165,11 +165,17 @@ class OasisMiniMediaPlayerEntity(OasisMiniEntity, MediaPlayerEntity):
|
|||||||
"""Play a piece of media."""
|
"""Play a piece of media."""
|
||||||
self.abort_if_busy()
|
self.abort_if_busy()
|
||||||
if media_type == MediaType.PLAYLIST:
|
if media_type == MediaType.PLAYLIST:
|
||||||
raise ServiceValidationError("Playlists are not currently supported")
|
raise ServiceValidationError(
|
||||||
|
translation_domain=DOMAIN, translation_key="playlists_unsupported"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
track = list(filter(None, map(get_track_id, media_id.split(","))))
|
track = list(filter(None, map(get_track_id, media_id.split(","))))
|
||||||
if not track:
|
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
|
device = self.device
|
||||||
enqueue = MediaPlayerEnqueue.NEXT if not enqueue else enqueue
|
enqueue = MediaPlayerEnqueue.NEXT if not enqueue else enqueue
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ class OasisMiniNumberEntity(OasisMiniEntity, NumberEntity):
|
|||||||
DESCRIPTORS = {
|
DESCRIPTORS = {
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key="ball_speed",
|
key="ball_speed",
|
||||||
name="Ball speed",
|
translation_key="ball_speed",
|
||||||
mode=NumberMode.SLIDER,
|
mode=NumberMode.SLIDER,
|
||||||
native_max_value=BALL_SPEED_MAX,
|
native_max_value=BALL_SPEED_MAX,
|
||||||
native_min_value=BALL_SPEED_MIN,
|
native_min_value=BALL_SPEED_MIN,
|
||||||
),
|
),
|
||||||
NumberEntityDescription(
|
NumberEntityDescription(
|
||||||
key="led_speed",
|
key="led_speed",
|
||||||
name="LED speed",
|
translation_key="led_speed",
|
||||||
mode=NumberMode.SLIDER,
|
mode=NumberMode.SLIDER,
|
||||||
native_max_value=LED_SPEED_MAX,
|
native_max_value=LED_SPEED_MAX,
|
||||||
native_min_value=LED_SPEED_MIN,
|
native_min_value=LED_SPEED_MIN,
|
||||||
|
|||||||
@@ -85,20 +85,20 @@ def playlist_update_handler(entity: OasisMiniSelectEntity) -> None:
|
|||||||
|
|
||||||
|
|
||||||
DESCRIPTORS = (
|
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(
|
OasisMiniSelectEntityDescription(
|
||||||
key="autoplay",
|
key="autoplay",
|
||||||
name="Autoplay",
|
translation_key="autoplay",
|
||||||
options=list(AUTOPLAY_MAP.values()),
|
options=list(AUTOPLAY_MAP.values()),
|
||||||
current_value=lambda device: device.autoplay,
|
current_value=lambda device: device.autoplay,
|
||||||
select_fn=lambda device, option: device.async_set_autoplay(option),
|
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 = {
|
DESCRIPTORS = {
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="download_progress",
|
key="download_progress",
|
||||||
|
translation_key="download_progress",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
name="Download progress",
|
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
} | {
|
} | {
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=key,
|
key=key,
|
||||||
name=key.replace("_", " ").capitalize(),
|
|
||||||
translation_key=key,
|
translation_key=key,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
@@ -65,8 +64,8 @@ DESCRIPTORS = {
|
|||||||
CLOUD_DESCRIPTORS = (
|
CLOUD_DESCRIPTORS = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="drawing_progress",
|
key="drawing_progress",
|
||||||
|
translation_key="drawing_progress",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
name="Drawing progress",
|
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
suggested_display_precision=1,
|
suggested_display_precision=1,
|
||||||
|
|||||||
@@ -38,7 +38,53 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entity": {
|
"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": {
|
"sensor": {
|
||||||
|
"download_progress": {
|
||||||
|
"name": "Download progress"
|
||||||
|
},
|
||||||
|
"drawing_progress": {
|
||||||
|
"name": "Drawing progress"
|
||||||
|
},
|
||||||
|
"error": {
|
||||||
|
"name": "Error"
|
||||||
|
},
|
||||||
|
"led_color_id": {
|
||||||
|
"name": "LED color ID"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"name": "Status",
|
"name": "Status",
|
||||||
"state": {
|
"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": {
|
"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": {
|
"sensor": {
|
||||||
|
"download_progress": {
|
||||||
|
"name": "Download progress"
|
||||||
|
},
|
||||||
|
"drawing_progress": {
|
||||||
|
"name": "Drawing progress"
|
||||||
|
},
|
||||||
|
"error": {
|
||||||
|
"name": "Error"
|
||||||
|
},
|
||||||
|
"led_color_id": {
|
||||||
|
"name": "LED color ID"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"name": "Status",
|
"name": "Status",
|
||||||
"state": {
|
"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