Skip to content

Commit

Permalink
Use zeroconf unicast requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shutgun committed Jul 25, 2023
1 parent f62e163 commit 2e2d5f9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Defining the system requirements with exact versions typically is difficult. But
* httpx 0.21.0
* protobuf 3.17.3
* segno 1.5.2
* zeroconf 0.36.8
* zeroconf 0.70.0

Other versions and even other operating systems might work. Feel free to tell us about your experience. If you want to run our unit tests, you also need:

Expand Down
6 changes: 4 additions & 2 deletions devolo_plc_api/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,15 @@ def _state_change(self, zeroconf: Zeroconf, service_type: str, name: str, state_
async def _get_service_info(self, zeroconf: Zeroconf, service_type: str, name: str) -> None:
"""Get service information, if IP matches."""
service_info = AsyncServiceInfo(service_type, name)
question_type = DNSQuestionType.QM if self._multicast else DNSQuestionType.QU
update = {
DEVICEAPI: self._get_device_info,
PLCNETAPI: self._get_plcnet_info,
}
with suppress(RuntimeError):
await service_info.async_request(zeroconf, timeout=1000, question_type=question_type)
if not self._multicast:
await service_info.async_request(zeroconf, timeout=1000, question_type=DNSQuestionType.QU, addr=self.ip)
else:
await service_info.async_request(zeroconf, timeout=1000, question_type=DNSQuestionType.QM)

if not service_info.addresses or self.ip not in service_info.parsed_addresses():
return # No need to continue, if there are no relevant service information
Expand Down
3 changes: 2 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [v1.4.0] - 2023/07/26

### Added

- Generate QR codes from wifi guest settings
- Make use of zeroconf unicast requests to be able to respond across subnets

## [v1.3.2] - 2023/07/13

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"httpx>=0.21.0",
"protobuf>=4.22.0",
"segno>=1.5.2",
"zeroconf>=0.32.0",
"zeroconf>=0.70.0",
]
dynamic = [
"version",
Expand Down

0 comments on commit 2e2d5f9

Please sign in to comment.