Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces support for Avahi ZeroConf. With this implementation, the PiKVM will show up in Nautilus/Dolphin under Network or in Finder on Mac.
Details
The implementation allows for auto-discovery and unique identification of the PiKVM without relying on dynamic information such as MAC address, IP address, or HTTPS certificate. This feature is particularly useful for adding devices to Home Assistant.
ZeroConf Data
The ZeroConf data broadcasts the following
_pikvm._tcp
registration:The same data is also replicated with the
_https._tcp
registration.Benefits
Script Flow
Retrieve Serial and Model Numbers: The script reads the serial number from
/proc/device-tree/serial-number
and the model number from/proc/device-tree/model
.Generate Avahi Configuration: The script defines the new Avahi service configuration, including HTTP and HTTPS services with associated TXT records for serial and model numbers.
Compute Configuration Hashes: The script computes the MD5 hash of the current and new configurations to determine if updates are necessary.
Update Avahi Service File: If the configuration has changed, the script writes the new configuration to the Avahi service file.
Install and Start Avahi: The script checks if Avahi is installed, installs it if necessary, and ensures the Avahi daemon is enabled and started, if not disabled by the user.