How to use the pysmartthings.device.Status function in pysmartthings

To help you get started, we’ve selected a few pysmartthings 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 andrewsayre / pysmartthings / tests / test_device.py View on Github external
def test_apply_attribute_update_preserve_unit():
        """Tests the apply_attribute_update preserves the old unit."""
        # Arrange
        data = get_json('device_status.json')
        device = DeviceStatus(None, DEVICE_ID, data)
        device.attributes[Capability.switch_level] = Status(40, '%', None)
        # Act
        device.apply_attribute_update(
            'main', Capability.switch_level, Attribute.level, 50)
        # Assert
        status = device.attributes[Attribute.level]
        assert status.unit == '%'
github home-assistant / home-assistant / tests / components / smartthings / test_climate.py View on Github external
device = device_factory(
        "Basic Thermostat",
        capabilities=[
            Capability.temperature_measurement,
            Capability.thermostat_cooling_setpoint,
            Capability.thermostat_heating_setpoint,
            Capability.thermostat_mode,
        ],
        status={
            Attribute.cooling_setpoint: 74,
            Attribute.heating_setpoint: 68,
            Attribute.thermostat_mode: "off",
            Attribute.supported_thermostat_modes: ["off", "auto", "heat", "cool"],
        },
    )
    device.status.attributes[Attribute.temperature] = Status(70, "F", None)
    return device
github home-assistant / home-assistant / tests / components / smartthings / test_climate.py View on Github external
def legacy_thermostat_fixture(device_factory):
    """Fixture returns a legacy thermostat."""
    device = device_factory(
        "Legacy Thermostat",
        capabilities=[Capability.thermostat],
        status={
            Attribute.cooling_setpoint: 74,
            Attribute.heating_setpoint: 68,
            Attribute.thermostat_fan_mode: "auto",
            Attribute.supported_thermostat_fan_modes: ["auto", "on"],
            Attribute.thermostat_mode: "auto",
            Attribute.supported_thermostat_modes: climate.MODE_TO_STATE.keys(),
            Attribute.thermostat_operating_state: "idle",
        },
    )
    device.status.attributes[Attribute.temperature] = Status(70, "F", None)
    return device
github home-assistant / home-assistant / tests / components / smartthings / test_lock.py View on Github external
async def test_lock(hass, device_factory):
    """Test the lock locks successfully."""
    # Arrange
    device = device_factory("Lock_1", [Capability.lock])
    device.status.attributes[Attribute.lock] = Status(
        "unlocked",
        None,
        {
            "method": "Manual",
            "codeId": None,
            "codeName": "Code 1",
            "lockName": "Front Door",
            "usedCode": "Code 2",
        },
    )
    await setup_platform(hass, LOCK_DOMAIN, devices=[device])
    # Act
    await hass.services.async_call(
        LOCK_DOMAIN, "lock", {"entity_id": "lock.lock_1"}, blocking=True
    )
    # Assert
github home-assistant / home-assistant / tests / components / smartthings / test_climate.py View on Github external
Attribute.heating_setpoint: 68,
            Attribute.thermostat_fan_mode: "on",
            Attribute.supported_thermostat_fan_modes: ["auto", "on"],
            Attribute.thermostat_mode: "heat",
            Attribute.supported_thermostat_modes: [
                "auto",
                "heat",
                "cool",
                "off",
                "eco",
            ],
            Attribute.thermostat_operating_state: "idle",
            Attribute.humidity: 34,
        },
    )
    device.status.attributes[Attribute.temperature] = Status(70, "F", None)
    return device
github home-assistant / home-assistant / tests / components / smartthings / test_climate.py View on Github external
"""Fixture returns a buggy thermostat."""
    device = device_factory(
        "Buggy Thermostat",
        capabilities=[
            Capability.temperature_measurement,
            Capability.thermostat_cooling_setpoint,
            Capability.thermostat_heating_setpoint,
            Capability.thermostat_mode,
        ],
        status={
            Attribute.thermostat_mode: "heating",
            Attribute.cooling_setpoint: 74,
            Attribute.heating_setpoint: 68,
        },
    )
    device.status.attributes[Attribute.temperature] = Status(70, "F", None)
    return device
github home-assistant / home-assistant / tests / components / smartthings / test_climate.py View on Github external
"low",
                "medium",
                "high",
                "turbo",
            ],
            Attribute.power_consumption: {
                "start": "2019-02-24T21:03:04Z",
                "power": 0,
                "energy": 500,
                "end": "2019-02-26T02:05:55Z",
            },
            Attribute.switch: "on",
            Attribute.cooling_setpoint: 23,
        },
    )
    device.status.attributes[Attribute.temperature] = Status(24, "C", None)
    return device