How to use the pysmartthings.capability.Attribute 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():
        """Tests the apply_attribute_update method."""
        # Arrange
        data = get_json('device_status.json')
        device = DeviceStatus(None, DEVICE_ID, data)
        # Act
        device.apply_attribute_update(
            'main', Capability.switch_level, Attribute.level, 50, '%',
            {'test': 'test'})
        # Assert
        status = device.attributes[Attribute.level]
        assert status.value == 50
        assert status.unit == '%'
        assert status.data == {'test': 'test'}
github andrewsayre / pysmartthings / pysmartthings / device.py View on Github external
async def set_air_conditioner_mode(
        self, mode: str, *, set_status: bool = False, component_id: str = "main"
    ):
        """Call the set air conditioner mode command."""
        result = await self.command(
            component_id,
            Capability.air_conditioner_mode,
            Command.set_air_conditioner_mode,
            [mode],
        )
        if result and set_status:
            self.status.update_attribute_value(Attribute.air_conditioner_mode, mode)
        return result
github andrewsayre / pysmartthings / pysmartthings / device.py View on Github external
def color(self) -> Optional[str]:
        """Get the color attribute."""
        return self._attributes[Attribute.color].value
github andrewsayre / pysmartthings / pysmartthings / device.py View on Github external
def lock(self):
        """Get the lock attribute."""
        return self._attributes[Attribute.lock].value
github andrewsayre / pysmartthings / pysmartthings / capability.py View on Github external
vid = "vid"
    voltage = "voltage"
    volume = "volume"
    washer_job_state = "washerJobState"
    washer_mode = "washerMode"
    water = "water"
    window_shade = "windowShade"


ATTRIBUTE_ON_VALUES = {
    Attribute.acceleration: "active",
    Attribute.contact: "open",
    Attribute.filter_status: "replace",
    Attribute.motion: "active",
    Attribute.mute: "muted",
    Attribute.presence: "present",
    Attribute.sound: "detected",
    Attribute.switch: "on",
    Attribute.tamper: "detected",
    Attribute.valve: "open",
    Attribute.water: "wet",
}
github andrewsayre / pysmartthings / pysmartthings / device.py View on Github external
async def open(
        self, set_status: bool = False, *, component_id: str = "main"
    ) -> bool:
        """Call the open device command."""
        capability = self.get_capability(
            Capability.door_control,
            Capability.window_shade,
            Capability.garage_door_control,
        )
        result = await self.command(component_id, capability, Command.open)
        if result and set_status:
            attribute = (
                Attribute.window_shade
                if capability == Capability.window_shade
                else Attribute.door
            )
            self.status.update_attribute_value(attribute, "opening")
        return result
github andrewsayre / pysmartthings / pysmartthings / capability.py View on Github external
ultraviolet_index = "ultravioletIndex"
    valve = "valve"
    vid = "vid"
    voltage = "voltage"
    volume = "volume"
    washer_job_state = "washerJobState"
    washer_mode = "washerMode"
    water = "water"
    window_shade = "windowShade"


ATTRIBUTE_ON_VALUES = {
    Attribute.acceleration: "active",
    Attribute.contact: "open",
    Attribute.filter_status: "replace",
    Attribute.motion: "active",
    Attribute.mute: "muted",
    Attribute.presence: "present",
    Attribute.sound: "detected",
    Attribute.switch: "on",
    Attribute.tamper: "detected",
    Attribute.valve: "open",
    Attribute.water: "wet",
}
github andrewsayre / pysmartthings / pysmartthings / capability.py View on Github external
valve = "valve"
    vid = "vid"
    voltage = "voltage"
    volume = "volume"
    washer_job_state = "washerJobState"
    washer_mode = "washerMode"
    water = "water"
    window_shade = "windowShade"


ATTRIBUTE_ON_VALUES = {
    Attribute.acceleration: "active",
    Attribute.contact: "open",
    Attribute.filter_status: "replace",
    Attribute.motion: "active",
    Attribute.mute: "muted",
    Attribute.presence: "present",
    Attribute.sound: "detected",
    Attribute.switch: "on",
    Attribute.tamper: "detected",
    Attribute.valve: "open",
    Attribute.water: "wet",
}
github andrewsayre / pysmartthings / pysmartthings / device.py View on Github external
async def set_air_flow_direction(
        self, direction: str, *, set_status: bool = False, component_id: str = "main"
    ):
        """Call the setAirFlowDirection command."""
        result = await self.command(
            component_id,
            Capability.air_flow_direction,
            Command.set_air_flow_direction,
            [direction],
        )
        if result and set_status:
            self.status.update_attribute_value(Attribute.air_flow_direction, direction)
        return result
github andrewsayre / pysmartthings / pysmartthings / capability.py View on Github external
tvoc_level = "tvocLevel"
    ultraviolet_index = "ultravioletIndex"
    valve = "valve"
    vid = "vid"
    voltage = "voltage"
    volume = "volume"
    washer_job_state = "washerJobState"
    washer_mode = "washerMode"
    water = "water"
    window_shade = "windowShade"


ATTRIBUTE_ON_VALUES = {
    Attribute.acceleration: "active",
    Attribute.contact: "open",
    Attribute.filter_status: "replace",
    Attribute.motion: "active",
    Attribute.mute: "muted",
    Attribute.presence: "present",
    Attribute.sound: "detected",
    Attribute.switch: "on",
    Attribute.tamper: "detected",
    Attribute.valve: "open",
    Attribute.water: "wet",
}