Skip to content

Commit 35616d8

Browse files
committed
Add usage example
1 parent 8ab2d05 commit 35616d8

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

example.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Sample code to use the wrapper for interacting with the dingz device."""
2+
import asyncio
3+
4+
from dingz.dingz import Dingz
5+
6+
IP_ADDRESS = "192.168.0.103"
7+
8+
9+
async def main():
10+
"""Sample code to work with a dingz unit."""
11+
async with Dingz(IP_ADDRESS) as dingz:
12+
13+
# Collect the data of the current state
14+
await dingz.get_device_info()
15+
print("Device details:", dingz.device_details)
16+
17+
# Get the temperature
18+
await dingz.get_temperature()
19+
print("Temperature:", dingz.temperature)
20+
21+
22+
if __name__ == "__main__":
23+
loop = asyncio.get_event_loop()
24+
loop.run_until_complete(main())

0 commit comments

Comments
 (0)