Skip to content

Commit

Permalink
Fix socket demo example (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouwh authored Jan 2, 2024
1 parent e9aa96b commit 5221ffa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion elro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Elro connects P1 API."""

__version__ = "0.5.5.1"
__version__ = "0.5.5.2"
12 changes: 10 additions & 2 deletions examples/socket_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ async def async_test_socket(self, device_id: int, command_code_hex: str) -> None


if __name__ == "__main__":
# argv: 1 = IP_ADDRESS, 2 = API_KEY, 3 = device_id
ARG_DEVICE_ID = int(sys.argv.get[3]) if len(sys.argv) > 3 else None
# argv: 1 = IP_ADDRESS, 2 = API_KEY, 3 = device_id, 4 = command_hex
if len(sys.argv) == 1:
print(
f"Elro Connects socket test util.\n"
f"Query only:\n{sys.argv[0]} ip-adress api-key\n\n"
f"Execute a command:\n{sys.argv[0]} "
"ip-adress api-key device_id command_hex"
)
sys.exit(0)
ARG_DEVICE_ID = int(sys.argv[3]) if len(sys.argv) > 3 else None
ARG_COMMAND_HEX = sys.argv[4] if len(sys.argv) > 4 else None
k1_hub = SocketDemo(sys.argv[1], sys.argv[2])
if ARG_COMMAND_HEX is not None:
Expand Down

0 comments on commit 5221ffa

Please sign in to comment.