1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Service validation for media_player component

This commit is contained in:
Jan Harkes
2016-04-02 03:51:03 -04:00
parent 5c262753d4
commit afd1e6a5cc
2 changed files with 51 additions and 42 deletions

View File

@@ -47,6 +47,13 @@ def icon(value):
raise vol.Invalid('Icons should start with prefix "mdi:"')
def string(value):
"""Coerce value to string, except for None."""
if value is not None:
return str(value)
raise vol.Invalid('Value should not be None')
def temperature_unit(value):
"""Validate and transform temperature unit."""
if isinstance(value, str):