Skip to content

Commit e53cce0

Browse files
authored
Merge pull request #247 from loopj/non-ssl-examples
Add SSL flags to every example
2 parents ceedc0a + 536f275 commit e53cce0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+171
-45
lines changed

examples/anemo_sensors/dump_anemo_sensors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
parser.add_argument("--username", help="username for Vantage controller")
1414
parser.add_argument("--password", help="password for Vantage controller")
1515
parser.add_argument("--debug", help="enable debug logging", action="store_true")
16+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1617
args = parser.parse_args()
1718

1819

@@ -22,7 +23,9 @@ async def main() -> None:
2223
logging.basicConfig(level=logging.DEBUG)
2324

2425
# Connect to the Vantage controller
25-
async with Vantage(args.host, args.username, args.password) as vantage:
26+
async with Vantage(
27+
args.host, args.username, args.password, ssl=args.ssl
28+
) as vantage:
2629
# Print out the id, name, and speed of each anemo sensor
2730
async for sensor in vantage.anemo_sensors:
2831
print(f"[{sensor.id}] '{sensor.name}' = {sensor.speed}")

examples/anemo_sensors/monitor_anemo_sensors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
parser.add_argument("--username", help="username for Vantage controller")
1616
parser.add_argument("--password", help="password for Vantage controller")
1717
parser.add_argument("--debug", help="enable debug logging", action="store_true")
18+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1819
args = parser.parse_args()
1920

2021

@@ -31,7 +32,9 @@ async def main() -> None:
3132
logging.basicConfig(level=logging.DEBUG)
3233

3334
# Connect to the Vantage controller
34-
async with Vantage(args.host, args.username, args.password) as vantage:
35+
async with Vantage(
36+
args.host, args.username, args.password, ssl=args.ssl
37+
) as vantage:
3538
# Fetch all known sensors from the controller
3639
await vantage.anemo_sensors.initialize()
3740

examples/areas/dump_areas.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
parser.add_argument("--username", help="username for Vantage controller")
1414
parser.add_argument("--password", help="password for Vantage controller")
1515
parser.add_argument("--debug", help="enable debug logging", action="store_true")
16+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1617
args = parser.parse_args()
1718

1819

@@ -22,7 +23,9 @@ async def main() -> None:
2223
logging.basicConfig(level=logging.DEBUG)
2324

2425
# Connect to the Vantage controller
25-
async with Vantage(args.host, args.username, args.password) as vantage:
26+
async with Vantage(
27+
args.host, args.username, args.password, ssl=args.ssl
28+
) as vantage:
2629
# Print out the id and name of each area
2730
async for area in vantage.areas:
2831
print(f"[{area.id}] '{area.name}'")

examples/blind_groups/dump_blind_groups.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
parser.add_argument("--username", help="username for Vantage controller")
1414
parser.add_argument("--password", help="password for Vantage controller")
1515
parser.add_argument("--debug", help="enable debug logging", action="store_true")
16+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1617
args = parser.parse_args()
1718

1819

@@ -22,7 +23,9 @@ async def main() -> None:
2223
logging.basicConfig(level=logging.DEBUG)
2324

2425
# Connect to the Vantage controller
25-
async with Vantage(args.host, args.username, args.password) as vantage:
26+
async with Vantage(
27+
args.host, args.username, args.password, ssl=args.ssl
28+
) as vantage:
2629
# Print out details of each blind group
2730
async for blind_group in vantage.blind_groups:
2831
print(f"[{blind_group.id}] '{blind_group.name}'")

examples/blinds/dump_blinds.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
parser.add_argument("--username", help="username for Vantage controller")
1414
parser.add_argument("--password", help="password for Vantage controller")
1515
parser.add_argument("--debug", help="enable debug logging", action="store_true")
16+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1617
args = parser.parse_args()
1718

1819

@@ -22,7 +23,9 @@ async def main() -> None:
2223
logging.basicConfig(level=logging.DEBUG)
2324

2425
# Connect to the Vantage controller
25-
async with Vantage(args.host, args.username, args.password) as vantage:
26+
async with Vantage(
27+
args.host, args.username, args.password, ssl=args.ssl
28+
) as vantage:
2629
# Print out the id and name of each blind
2730
async for blind in vantage.blinds:
2831
print(f"[{blind.id}] '{blind.name}'")

examples/blinds/monitor_blinds.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
parser.add_argument("--username", help="username for Vantage controller")
1616
parser.add_argument("--password", help="password for Vantage controller")
1717
parser.add_argument("--debug", help="enable debug logging", action="store_true")
18+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1819
args = parser.parse_args()
1920

2021

@@ -31,7 +32,9 @@ async def main() -> None:
3132
logging.basicConfig(level=logging.DEBUG)
3233

3334
# Connect to the Vantage controller
34-
async with Vantage(args.host, args.username, args.password) as vantage:
35+
async with Vantage(
36+
args.host, args.username, args.password, ssl=args.ssl
37+
) as vantage:
3538
# Fetch all known blinds from the controller
3639
await vantage.blinds.initialize()
3740

examples/buttons/dump_buttons.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
parser.add_argument("--username", help="username for Vantage controller")
1414
parser.add_argument("--password", help="password for Vantage controller")
1515
parser.add_argument("--debug", help="enable debug logging", action="store_true")
16+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1617
args = parser.parse_args()
1718

1819

@@ -22,7 +23,9 @@ async def main() -> None:
2223
logging.basicConfig(level=logging.DEBUG)
2324

2425
# Connect to the Vantage controller
25-
async with Vantage(args.host, args.username, args.password) as vantage:
26+
async with Vantage(
27+
args.host, args.username, args.password, ssl=args.ssl
28+
) as vantage:
2629
# Print out the id, name, and labels of each button
2730
async for button in vantage.buttons:
2831
print(

examples/buttons/monitor_buttons.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
parser.add_argument("--username", help="username for Vantage controller")
1616
parser.add_argument("--password", help="password for Vantage controller")
1717
parser.add_argument("--debug", help="enable debug logging", action="store_true")
18+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1819
args = parser.parse_args()
1920

2021

@@ -31,7 +32,9 @@ async def main() -> None:
3132
logging.basicConfig(level=logging.DEBUG)
3233

3334
# Connect to the Vantage controller
34-
async with Vantage(args.host, args.username, args.password) as vantage:
35+
async with Vantage(
36+
args.host, args.username, args.password, ssl=args.ssl
37+
) as vantage:
3538
# Fetch all known buttons from the controller
3639
await vantage.buttons.initialize()
3740

examples/command_client/event_log.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
parser.add_argument("--username", help="username for Vantage controller")
1515
parser.add_argument("--password", help="password for Vantage controller")
1616
parser.add_argument("--debug", help="enable debug logging", action="store_true")
17+
parser.add_argument("--ssl", action=argparse.BooleanOptionalAction, default=True)
1718
args = parser.parse_args()
1819

1920

@@ -33,7 +34,9 @@ async def main() -> None:
3334
logging.basicConfig(level=logging.DEBUG)
3435

3536
# Create an EventStream client
36-
async with EventStream(args.host, args.username, args.password) as events:
37+
async with EventStream(
38+
args.host, args.username, args.password, ssl=args.ssl
39+
) as events:
3740
# Subscribe to connection events
3841
events.subscribe(Connected, on_connected)
3942

examples/command_client/status_load.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ async def main() -> None:
4343
logging.basicConfig(level=logging.DEBUG)
4444

4545
# Create an EventStream client
46-
async with EventStream(args.host, args.username, args.password) as events:
46+
async with EventStream(
47+
args.host, args.username, args.password, ssl=args.ssl
48+
) as events:
4749
# Subscribe to connection events
4850
events.subscribe(Connected, on_connected)
4951
events.subscribe(Disconnected, on_disconnected)

0 commit comments

Comments
 (0)