mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Bugfix voluptuous acer_projector (#3598)
This commit is contained in:
parent
08bacd8e31
commit
01435f7f42
@ -4,6 +4,7 @@ Use serial protocol of Acer projector to obtain state of the projector.
|
|||||||
For more details about this component, please refer to the documentation
|
For more details about this component, please refer to the documentation
|
||||||
at https://home-assistant.io/components/switch.acer_projector/
|
at https://home-assistant.io/components/switch.acer_projector/
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -45,8 +46,18 @@ CMD_DICT = {LAMP: '* 0 Lamp ?\r',
|
|||||||
STATE_ON: '* 0 IR 001\r',
|
STATE_ON: '* 0 IR 001\r',
|
||||||
STATE_OFF: '* 0 IR 002\r'}
|
STATE_OFF: '* 0 IR 002\r'}
|
||||||
|
|
||||||
|
|
||||||
|
def isdevice(dev):
|
||||||
|
"""Check if dev a real device."""
|
||||||
|
try:
|
||||||
|
os.stat(dev)
|
||||||
|
return str(dev)
|
||||||
|
except OSError:
|
||||||
|
raise vol.Invalid("No device found!")
|
||||||
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
vol.Required(CONF_FILENAME): cv.isfile,
|
vol.Required(CONF_FILENAME): isdevice,
|
||||||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
||||||
vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
|
vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int,
|
||||||
vol.Optional(CONF_WRITE_TIMEOUT, default=DEFAULT_WRITE_TIMEOUT):
|
vol.Optional(CONF_WRITE_TIMEOUT, default=DEFAULT_WRITE_TIMEOUT):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user