Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. diff --git a/homeassistant/components/switch/wemo.py b/homeassistant/components/switch/wemo.py
  2. index 1d56944..4a996e1 100644
  3. --- a/homeassistant/components/switch/wemo.py
  4. +++ b/homeassistant/components/switch/wemo.py
  5. @@ -60,6 +60,28 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
  6. [WemoSwitch(switch) for switch in switches
  7. if isinstance(switch, pywemo.Switch)])
  8.  
  9. + static_types = {
  10. + 'switch': pywemo.Switch,
  11. + 'insight': pywemo.Insight,
  12. + }
  13. +
  14. + # Add manually-defined wemo devices
  15. + if discovery_info is None and 'static' in config:
  16. + static_wemos = []
  17. + for address, devtype in config['static'].items():
  18. + devclass = static_types.get(devtype)
  19. + if not devclass:
  20. + _LOGGER.warning('Unknown static wemo type %s' % devtype)
  21. + continue
  22. + port = pywemo.ouimeaux_device.probe_wemo(address)
  23. + if not port:
  24. + _LOGGER.warning('Unable to probe wemo at %s' % address)
  25. + continue
  26. + _LOGGER.info('Adding static wemo at %s:%i' % (address, port))
  27. + wemo = devclass('http://%s:%i/setup.xml' % (address, port), None)
  28. + static_wemos.append(wemo)
  29. + add_devices_callback([WemoSwitch(wemo) for wemo in static_wemos])
  30. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement