Advertisement
grea09

Broadlink config schema

Mar 15th, 2019
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. BROADLINK_ENTITY = {
  2. vol.Required(CONF_NAME): cv.string,
  3. vol.Optional(CONF_DOMAIN, default=DEFAULT_DOMAIN): cv.string
  4. }
  5.  
  6. BROADLINK_DEVICE = {
  7. vol.Required(CONF_HOST): cv.string,
  8. vol.Required(CONF_MAC): cv.string,
  9. vol.Required(CONF_TYPE): cv.string
  10. }
  11.  
  12. BROADLINK_COMMANDS = {
  13. vol.Optional(CONF_COMMAND_ON, default=None): cv.string,
  14. vol.Optional(CONF_COMMAND_OFF, default=None): cv.string
  15. }
  16.  
  17. BROADLINK_SP_SCHEMA = vol.Schema({
  18. **BROADLINK_DEVICE,
  19. **BROADLINK_ENTITY
  20. })
  21.  
  22. BROADLINK_MP_SCHEMA = vol.Schema({
  23. **BROADLINK_DEVICE,
  24. vol.Optional(CONF_SLOTS, default=DEFAULT_SLOT_ENTITIES): vol.All(cv.ensure_list,
  25. [vol.Schema(BROADLINK_ENTITY)])
  26. })
  27.  
  28. BROADLINK_RM_SCHEMA = vol.Schema({
  29. **BROADLINK_DEVICE,
  30. vol.Optional(CONF_COMMAND, default=[]): vol.All(cv.ensure_list,
  31. [vol.Schema({**BROADLINK_ENTITY, **BROADLINK_COMMANDS})])
  32. })
  33.  
  34.  
  35. CONFIG_SCHEMA = vol.Schema({
  36. DOMAIN: vol.Schema({
  37. vol.Optional(CONF_SP, default=[]): vol.All(cv.ensure_list,
  38. [BROADLINK_SP_SCHEMA]),
  39. vol.Optional(CONF_MP, default=[]): vol.All(cv.ensure_list,
  40. [BROADLINK_MP_SCHEMA]),
  41. vol.Optional(CONF_RM, default=[]): vol.All(cv.ensure_list,
  42. [BROADLINK_RM_SCHEMA]),
  43. vol.Optional('discovery', default=True): cv.boolean,
  44. vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int
  45. }),
  46. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement