mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add icons for prusalink sensors and buttons (#87256)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
923abdb02a
commit
e77e49a87a
@ -39,6 +39,7 @@ BUTTONS: dict[str, tuple[PrusaLinkButtonEntityDescription, ...]] = {
|
|||||||
PrusaLinkButtonEntityDescription[PrinterInfo](
|
PrusaLinkButtonEntityDescription[PrinterInfo](
|
||||||
key="printer.cancel_job",
|
key="printer.cancel_job",
|
||||||
name="Cancel Job",
|
name="Cancel Job",
|
||||||
|
icon="mdi:cancel",
|
||||||
press_fn=lambda api: cast(Coroutine, api.cancel_job()),
|
press_fn=lambda api: cast(Coroutine, api.cancel_job()),
|
||||||
available_fn=lambda data: any(
|
available_fn=lambda data: any(
|
||||||
data["state"]["flags"][flag]
|
data["state"]["flags"][flag]
|
||||||
@ -48,6 +49,7 @@ BUTTONS: dict[str, tuple[PrusaLinkButtonEntityDescription, ...]] = {
|
|||||||
PrusaLinkButtonEntityDescription[PrinterInfo](
|
PrusaLinkButtonEntityDescription[PrinterInfo](
|
||||||
key="job.pause_job",
|
key="job.pause_job",
|
||||||
name="Pause Job",
|
name="Pause Job",
|
||||||
|
icon="mdi:pause",
|
||||||
press_fn=lambda api: cast(Coroutine, api.pause_job()),
|
press_fn=lambda api: cast(Coroutine, api.pause_job()),
|
||||||
available_fn=lambda data: (
|
available_fn=lambda data: (
|
||||||
data["state"]["flags"]["printing"]
|
data["state"]["flags"]["printing"]
|
||||||
@ -57,6 +59,7 @@ BUTTONS: dict[str, tuple[PrusaLinkButtonEntityDescription, ...]] = {
|
|||||||
PrusaLinkButtonEntityDescription[PrinterInfo](
|
PrusaLinkButtonEntityDescription[PrinterInfo](
|
||||||
key="job.resume_job",
|
key="job.resume_job",
|
||||||
name="Resume Job",
|
name="Resume Job",
|
||||||
|
icon="mdi:play",
|
||||||
press_fn=lambda api: cast(Coroutine, api.resume_job()),
|
press_fn=lambda api: cast(Coroutine, api.resume_job()),
|
||||||
available_fn=lambda data: cast(bool, data["state"]["flags"]["paused"]),
|
available_fn=lambda data: cast(bool, data["state"]["flags"]["paused"]),
|
||||||
),
|
),
|
||||||
|
@ -86,6 +86,7 @@ SENSORS: dict[str, tuple[PrusaLinkSensorEntityDescription, ...]] = {
|
|||||||
PrusaLinkSensorEntityDescription[JobInfo](
|
PrusaLinkSensorEntityDescription[JobInfo](
|
||||||
key="job.progress",
|
key="job.progress",
|
||||||
name="Progress",
|
name="Progress",
|
||||||
|
icon="mdi:progress-clock",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
value_fn=lambda data: cast(float, data["progress"]["completion"]) * 100,
|
value_fn=lambda data: cast(float, data["progress"]["completion"]) * 100,
|
||||||
available_fn=lambda data: data.get("progress") is not None,
|
available_fn=lambda data: data.get("progress") is not None,
|
||||||
@ -101,6 +102,7 @@ SENSORS: dict[str, tuple[PrusaLinkSensorEntityDescription, ...]] = {
|
|||||||
key="job.start",
|
key="job.start",
|
||||||
name="Print Start",
|
name="Print Start",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
|
icon="mdi:clock-start",
|
||||||
value_fn=ignore_variance(
|
value_fn=ignore_variance(
|
||||||
lambda data: (
|
lambda data: (
|
||||||
utcnow() - timedelta(seconds=data["progress"]["printTime"])
|
utcnow() - timedelta(seconds=data["progress"]["printTime"])
|
||||||
@ -112,6 +114,7 @@ SENSORS: dict[str, tuple[PrusaLinkSensorEntityDescription, ...]] = {
|
|||||||
PrusaLinkSensorEntityDescription[JobInfo](
|
PrusaLinkSensorEntityDescription[JobInfo](
|
||||||
key="job.finish",
|
key="job.finish",
|
||||||
name="Print Finish",
|
name="Print Finish",
|
||||||
|
icon="mdi:clock-end",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
value_fn=ignore_variance(
|
value_fn=ignore_variance(
|
||||||
lambda data: (
|
lambda data: (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user