File: test_sensor.py

package info (click to toggle)
python-aioguardian 2023.12.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 772 kB
  • sloc: python: 1,387; sh: 45; makefile: 13
file content (33 lines) | stat: -rw-r--r-- 1,036 bytes parent folder | download
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
"""Run an example script to quickly test the guardian."""
import asyncio
import logging

from aioguardian import Client
from aioguardian.errors import GuardianError

_LOGGER = logging.getLogger(__name__)


async def main() -> None:
    """Create the aiohttp session and run the example."""
    logging.basicConfig(level=logging.INFO)

    async with Client("172.16.11.208") as guardian:
        try:
            pair_dump_response = await guardian.sensor.pair_dump()
            _LOGGER.info("pair_dump_response command response: %s", pair_dump_response)

            for uid in pair_dump_response["data"]["paired_uids"]:
                paired_sensor_status_resp = await guardian.sensor.paired_sensor_status(
                    uid
                )
                _LOGGER.info(
                    "paired_sensor_status command response (UID: %s): %s",
                    uid,
                    paired_sensor_status_resp,
                )
        except GuardianError as err:
            _LOGGER.info(err)


asyncio.run(main())