How to use the pywemo.ouimeaux_device.lightswitch.LightSwitch function in pywemo

To help you get started, we’ve selected a few pywemo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pavoni / pywemo / pywemo / discovery.py View on Github external
def device_from_uuid_and_location(uuid, mac, location,
                                  rediscovery_enabled=True):
    """Determine device class based on the device uuid."""
    if uuid is None:
        return None
    if uuid.startswith('uuid:Socket'):
        return Switch(url=location, mac=mac,
                      rediscovery_enabled=rediscovery_enabled)
    if uuid.startswith('uuid:Lightswitch'):
        return LightSwitch(url=location, mac=mac,
                           rediscovery_enabled=rediscovery_enabled)
    if uuid.startswith('uuid:Dimmer'):
        return Dimmer(url=location, mac=mac,
                      rediscovery_enabled=rediscovery_enabled)
    if uuid.startswith('uuid:Insight'):
        return Insight(url=location, mac=mac,
                       rediscovery_enabled=rediscovery_enabled)
    if uuid.startswith('uuid:Sensor'):
        return Motion(url=location, mac=mac,
                      rediscovery_enabled=rediscovery_enabled)
    if uuid.startswith('uuid:Maker'):
        return Maker(url=location, mac=mac,
                     rediscovery_enabled=rediscovery_enabled)
    if uuid.startswith('uuid:Bridge'):
        return Bridge(url=location, mac=mac,
                      rediscovery_enabled=rediscovery_enabled)
github pavoni / pywemo / pywemo / upnp.py View on Github external
def device_from_uuid_and_location(uuid, location):
    """ Tries to determine which device it is based on the uuid. """
    if uuid.startswith('uuid:Socket'):
        return Switch(location)
    elif uuid.startswith('uuid:Lightswitch'):
        return LightSwitch(location)
    elif uuid.startswith('uuid:Insight'):
        return Insight(location)
    elif uuid.startswith('uuid:Sensor'):
        return Motion(location)
    else:
        return None