From 61e6e56d16d211d86e35710bde62d3b5aae8b21d Mon Sep 17 00:00:00 2001 From: DutchmanNL Date: Sat, 2 Dec 2023 13:57:40 +0100 Subject: [PATCH] add option for listening interface Awaiting https://github.com/twocolors/esphome-native-api/issues/28 --- admin/jsonConfig.json5 | 27 ++++++++++++--------------- main.js | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/admin/jsonConfig.json5 b/admin/jsonConfig.json5 index 80b7d8b..5593ca4 100644 --- a/admin/jsonConfig.json5 +++ b/admin/jsonConfig.json5 @@ -108,24 +108,21 @@ "autodiscovery": { "newLine": true, "type": "checkbox", - "sm": 4, - "md": 4, + "sm": 3, + "md": 3, "label": "lblAutoDiscovery" }, -// "discoveryListeningAddress" : { -// "type": "ip", -// "disabled": "true", -// "sm": 2, -// "md": 2, -// "default": "0.0.0.0", -// "label": "lblDiscoveryListeningAddress", -// "help": "hlpDiscoveryListeningAddress", -// "listenOnAllPorts" : true, -// "onlyIp4" : true -// }, - - + "discoveryListeningAddress" : { + "type": "ip", + "sm": 3, + "md": 3, + "default": "0.0.0.0", + "label": "lblDiscoveryListeningAddress", + "help": "hlpDiscoveryListeningAddress", + "listenOnAllPorts" : true, + "onlyIp4" : true + }, // Text to explain adapter must be running to load this table "details-1": { diff --git a/main.js b/main.js index 3854427..75638c9 100644 --- a/main.js +++ b/main.js @@ -223,7 +223,7 @@ class Esphome extends utils.Adapter { } // Start device discovery - discovery = new Discovery(); + discovery = new Discovery({interface: this.config.discoveryListeningAddress ? this.config.discoveryListeningAddress : '0.0.0.0'}); discovery.run(); discovery.on('info', ( message ) => {