Skip to content

Commit

Permalink
Fix WANPPPC service_type (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
unconnected authored Jan 24, 2025
1 parent 5ea4466 commit b73bbfa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 32 deletions.
77 changes: 45 additions & 32 deletions async_upnp_client/profiles/igd.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def external_ip_address(self) -> Optional[str]:
"""
Get the external IP address, from the state variable ExternalIPAddress.
This requires a subscription to the WANIPC/WANPPP service.
This requires a subscription to the WANIPC/WANPPPC service.
"""
services = ["WANIPC", "WANPPP"]
services = ["WANIPC", "WANPPPC"]
state_var = self._any_state_variable(services, "ExternalIPAddress")
if not state_var:
return None
Expand All @@ -269,9 +269,9 @@ def connection_status(self) -> Optional[str]:
"""
Get the connection status, from the state variable ConnectionStatus.
This requires a subscription to the WANIPC/WANPPP service.
This requires a subscription to the WANIPC/WANPPPC service.
"""
services = ["WANIPC", "WANPPP"]
services = ["WANIPC", "WANPPPC"]
state_var = self._any_state_variable(services, "ConnectionStatus")
if not state_var:
return None
Expand All @@ -284,9 +284,9 @@ def port_mapping_number_of_entries(self) -> Optional[int]:
"""
Get number of port mapping entries, from the state variable `PortMappingNumberOfEntries`.
This requires a subscription to the WANIPC/WANPPP service.
This requires a subscription to the WANIPC/WANPPPC service.
"""
services = ["WANIPC", "WANPPP"]
services = ["WANIPC", "WANPPPC"]
state_var = self._any_state_variable(services, "PortMappingNumberOfEntries")
if not state_var:
return None
Expand Down Expand Up @@ -404,9 +404,10 @@ async def async_get_external_ip_address(
"""
Get the external IP address.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetExternalIPAddress")
if not action:
return None
Expand All @@ -422,9 +423,10 @@ async def async_get_generic_port_mapping_entry(
Get generic port mapping entry.
:param port_mapping_index Index of port mapping entry
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetGenericPortMappingEntry")
if not action:
return None
Expand Down Expand Up @@ -462,9 +464,10 @@ async def async_get_specific_port_mapping_entry(
:param remote_host Address of remote host or None
:param external_port External port
:param protocol Protocol, 'TCP' or 'UDP'
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetSpecificPortMappingEntry")
if not action:
return None
Expand Down Expand Up @@ -512,10 +515,11 @@ async def async_add_port_mapping(
:param enabled Port mapping enabled
:param description Description for port mapping
:param lease_duration Lease duration
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
# pylint: disable=too-many-arguments,too-many-positional-arguments
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "AddPortMapping")
if not action:
return
Expand Down Expand Up @@ -544,9 +548,10 @@ async def async_delete_port_mapping(
:param remote_host Address of remote host or None
:param external_port External port
:param protocol Protocol, 'TCP' or 'UDP'
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "DeletePortMapping")
if not action:
return
Expand Down Expand Up @@ -632,9 +637,10 @@ async def async_get_connection_type_info(
"""
Get connection type info.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetConnectionTypeInfo")
if not action:
return None
Expand All @@ -651,9 +657,10 @@ async def async_set_connection_type(
Set connection type.
:param connection_type connection type
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "SetConnectionType")
if not action:
return
Expand All @@ -666,9 +673,10 @@ async def async_request_connection(
"""
Request connection.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "RequestConnection")
if not action:
return
Expand All @@ -681,9 +689,10 @@ async def async_request_termination(
"""
Request connection termination.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "RequestTermination")
if not action:
return
Expand All @@ -696,9 +705,10 @@ async def async_force_termination(
"""
Force connection termination.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "ForceTermination")
if not action:
return
Expand All @@ -711,9 +721,10 @@ async def async_get_status_info(
"""
Get status info.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetStatusInfo")
if not action:
return None
Expand All @@ -738,9 +749,10 @@ async def async_get_port_mapping_number_of_entries(
Note that this action is not officially supported by the IGD specification.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetPortMappingNumberOfEntries")
if not action:
return None
Expand All @@ -759,9 +771,10 @@ async def async_get_nat_rsip_status(
"""
Get NAT enabled and RSIP availability statuses.
:param services List of service names to try to get action from, defaults to [WANIPC,WANPPP]
:param services List of service names to try to get action from,
defaults to [WANIPC,WANPPPC]
"""
services = services or ["WANIPC", "WANPPP"]
services = services or ["WANIPC", "WANPPPC"]
action = self._any_action(services, "GetNATRSIPStatus")
if not action:
return None
Expand Down
1 change: 1 addition & 0 deletions changes/257.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix variable name for WANPPPConnection service. This will add external ipaddress, uptime and wan status for supported devices.

0 comments on commit b73bbfa

Please sign in to comment.