Skip to content

Commit

Permalink
Clarified device name / server thing parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
seime committed Jun 27, 2024
1 parent f7ea34b commit 5b76740
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public enum CommunicationError {
ENCRYPTION_KEY_INVALID("Invalid api encryption key"),
INVALID_PROTOCOL_PREAMBLE(
"Invalid protocol preamble - this indicates a new major protocol change has arrived, but this binding does not support it yet"),
DEVICE_NAME_MISMATCH("ESPHome device reported a different name than configured for the thing");
DEVICE_NAME_MISMATCH("ESPHome device reported a different esphome.name than configured for the thing");

private final String text;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void handleHello(byte[] packetData) throws ProtocolAPIError, ShortBuffer
byte[] serverName = Arrays.copyOfRange(packetData, 1, packetData.length - 1);
String server = new String(serverName, StandardCharsets.US_ASCII);

if (expectedServername != null && !server.equals(expectedServername)) {
if (expectedServername != null && !expectedServername.equals(server)) {
listener.onParseError(CommunicationError.DEVICE_NAME_MISMATCH);
return;
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/OH-INF/thing/thing-types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
</parameter>

<parameter name="server" type="text" required="false">
<label>ESPHome device server name</label>
<description>Used to verify that we're talking to the correct device</description>
<label>ESPHome device name (not hostname)</label>
<description>Used to verify that we're talking to the correct device. Use the esphome: -> name: value from the
ESPHome
device configuration yaml</description>
</parameter>

<parameter name="pingInterval" type="integer" min="1" max="600" required="false">
Expand Down

0 comments on commit 5b76740

Please sign in to comment.