File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 11"""Sample code to use the wrapper for interacting with the dingz device."""
22import asyncio
3+ import logging
34
45from dingz .dingz import Dingz
6+ from dingz .discovery import discover_dingz_devices
7+
58
69IP_ADDRESS = "192.168.0.103"
710
811
912async def main ():
1013 """Sample code to work with a dingz unit."""
14+ # Discover dingz devices
15+ devices = await discover_dingz_devices ()
16+
17+ print (f"Found { len (devices )} devices" )
18+ for device in devices :
19+ print (
20+ f" MAC address: { device .mac } , IP address: { device .host } , HW: { device .hardware } "
21+ )
22+
23+ # Work with one dingz unit
1124 async with Dingz (IP_ADDRESS ) as dingz :
1225
1326 # Collect the data of the current state
@@ -39,7 +52,6 @@ async def main():
3952 await dingz .get_button_action ()
4053 print ("Button actions:" , dingz .button_action )
4154
42-
4355 # # Turn on the front LED
4456 print ("Turning Front LED on..." )
4557 await dingz .turn_on ()
@@ -50,5 +62,6 @@ async def main():
5062
5163
5264if __name__ == "__main__" :
65+ logging .basicConfig (level = logging .DEBUG )
5366 loop = asyncio .get_event_loop ()
5467 loop .run_until_complete (main ())
You can’t perform that action at this time.
0 commit comments