Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions custom_components/opendisplay/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def _refresh_type_value(value: Any) -> RefreshMode:
vol.Optional("rotate", default=0): vol.All(vol.Coerce(int), vol.In([0, 90, 180, 270])),
vol.Optional("dither", default="ordered"): _dither_value,
vol.Optional("refresh_type", default="full"): _refresh_type_value,
vol.Optional(ATTR_TONE_COMPRESSION): vol.All(
vol.Coerce(float), vol.Range(min=0.0, max=100.0)
),
vol.Optional("dry-run", default=False): cv.boolean,
},
extra=vol.REMOVE_EXTRA, # silently drop legacy keys (ttl, preload_type, preload_lut, ...)
Expand Down Expand Up @@ -598,13 +601,18 @@ async def _drawcustom_for_device(

dither_mode: DitherMode = call.data["dither"]
refresh_mode: RefreshMode = call.data["refresh_type"]
tone_compression_pct: float | None = call.data.get(ATTR_TONE_COMPRESSION)
tone_compression: float | str = (
tone_compression_pct / 100.0 if tone_compression_pct is not None else "auto"
)

await _async_send_image(
hass,
entry,
img,
dither_mode=dither_mode,
refresh_mode=refresh_mode,
tone=tone_compression,
rotate=Rotation(rotate),
)

Expand Down
11 changes: 11 additions & 0 deletions custom_components/opendisplay/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ drawcustom:
options:
- "full"
- "fast"
tone_compression:
name: Tone compression
description: Tone compression strength (0–100%). Omit to use automatic tone mapping.
required: false
selector:
number:
min: 0
max: 100
step: 1
mode: slider
unit_of_measurement: "%"
dry-run:
name: Dry run
description: Generate image without sending to device
Expand Down