File: test_switch.py

package info (click to toggle)
pyatmo 9.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,292 kB
  • sloc: python: 4,474; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 1,498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Define tests for switch module."""

from pyatmo import DeviceType
from pyatmo.modules.device_types import DeviceCategory


async def test_async_switch_NLP(async_home):
    """Test NLP Legrand plug."""
    module_id = "12:34:56:80:00:12:ac:f2"
    assert module_id in async_home.modules
    module = async_home.modules[module_id]
    assert module.device_type == DeviceType.NLP
    assert module.firmware_revision == 62
    assert module.on
    assert module.power == 0


async def test_async_switch_NLF(async_home):
    """Test NLF Legrand dimmer."""
    module_id = "00:11:22:33:00:11:45:fe"
    assert module_id in async_home.modules
    module = async_home.modules[module_id]
    assert module.device_type == DeviceType.NLF
    assert module.firmware_revision == 57
    assert module.on is False
    assert module.brightness == 63
    assert module.power == 0


async def test_async_switch_NLIS(async_home):
    """Test NLIS Legrand module."""
    module_id = "12:34:56:00:01:01:01:b6"
    assert module_id in async_home.modules
    module = async_home.modules[module_id]
    assert module.device_category is None
    module_id = "12:34:56:00:01:01:01:b6#1"
    assert module_id in async_home.modules
    module = async_home.modules[module_id]
    assert module.device_category == DeviceCategory.switch
    module_id = "12:34:56:00:01:01:01:b6#2"
    assert module_id in async_home.modules
    module = async_home.modules[module_id]
    assert module.device_category == DeviceCategory.switch