This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add panduza local broker discovery service function to script (#91)
* add panduza local broker discovery service function to script * Make client easier to create with local discovery, can precise a platform name to choose the platform you want to use on your local network * Delete panduza/core/panduza_local_broker_discovery.py * Local discovery works with alias * ask to the user if he wants to use the discover platform * Show the user a list of platform instead of asking him one after another * Comments has been changed to respect new function * change to follow new spec of local discovery answer * function to make user friendly moving state of relay * fix get_state_open (forgot to return the value) --------- Co-authored-by: Damien Albisson <[email protected]>
- Loading branch information
1 parent
8c00c91
commit 90e3c15
Showing
4 changed files
with
263 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from panduza import Client | ||
|
||
# Test the comportement of local discovery to connect a | ||
# client without precising url and port, the user can choose | ||
# to use a plaform name to look for a platform with his given | ||
# name on the local network, or just using it without parameters | ||
# to look fot the first platform found | ||
if __name__ == "__main__": | ||
|
||
platform_name = "panduza_platform" | ||
|
||
# Test with platform name | ||
|
||
print(f"Try to find a platform on the local network with the name {platform_name}") | ||
|
||
client = Client(platform_name=platform_name) | ||
client.connect() | ||
|
||
print(f"Success to connecting to the broker of the platform with the name {platform_name}\n") | ||
|
||
# Test looking for the fist platform found | ||
|
||
print(f"Try to find a platform on the local network") | ||
|
||
client2 = Client() | ||
client2.connect() | ||
|
||
print("Success to connect to the first platform found on the local network") |