diff --git a/aioupnp/upnp.py b/aioupnp/upnp.py index ecfa229..b11f310 100644 --- a/aioupnp/upnp.py +++ b/aioupnp/upnp.py @@ -122,7 +122,7 @@ class UPnP: await self.gateway.commands.AddPortMapping( NewRemoteHost='', NewExternalPort=external_port, NewProtocol=protocol, NewInternalPort=internal_port, NewInternalClient=lan_address, - NewEnabled=1, NewPortMappingDescription=description, NewLeaseDuration=lease_time + NewEnabled=1, NewPortMappingDescription=description, NewLeaseDuration=str(lease_time) ) return None diff --git a/tests/test_cli.py b/tests/test_cli.py index dc7b0a1..a6399fa 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -62,7 +62,7 @@ Get the external ip address from the gateway """ expected_add_port_mapping_usage = """aioupnp [-h] [--debug_logging] add_port_mapping [--external_port=] [--protocol=] - [--internal_port=] [--lan_address=] [--description=] + [--internal_port=] [--lan_address=] [--description=] [--lease_time=] Add a new port mapping @@ -71,12 +71,13 @@ Add a new port mapping :param internal_port: (int) internal port :param lan_address: (str) internal lan address :param description: (str) mapping description +:param lease_time: (int) lease time in seconds :return: None """ expected_get_next_mapping_usage = """aioupnp [-h] [--debug_logging] get_next_mapping [--port=] [--protocol=] - [--description=] [--internal_port=] + [--description=] [--internal_port=] [--lease_time=] Get a new port mapping. If the requested port is not available, increment until the next free port is mapped @@ -84,6 +85,7 @@ Get a new port mapping. If the requested port is not available, increment until :param protocol: (str) UDP | TCP :param description: (str) mapping description :param internal_port: (int) internal port +:param lease_time: (int) lease time in seconds :return: (int) mapped port