Discovery
Energy devices can be automatically discovered on your network using Multicast DNS (also known as mDNS
, Zeroconf
, or Bonjour
). This technology enables your application to discover devices without requiring the user to know the IP address.
Services
Devices can broadcast one or two services on the network, depending on the available API version(s) of this device:
_hwenergy._tcp
- to discover devices that are using API v1 over HTTP_homewizard._tcp
- to discover devices that are using API v2 and later over HTTPS
_hwenergy._tcp
This service is used to discover devices that are using API v1, which uses HTTP (port 80). Devices with API v1 are available on the _hwenergy._tcp
service.
TXT Records
A discovery response contains additional data to enhance the setup in your application.
Data | Description |
---|---|
api_enabled | Indicates if the API is enabled. The API is disabled when set to 0 and enabled when set to 1 . See how to enable the API. |
path | Set to /api/v1 . Can be used to verify that your application supports this device and API version. |
serial | Device serial number, also used as the MAC address. This unique value per device consists of 12 hexadecimal characters. |
product_name | A user-friendly name that may change at any time. |
product_type | The product type; refer to supported devices. Your application should support additional values for future products. |
_homewizard._tcp
This service is used to discover devices that are using API v2 and later, which uses HTTPS (port 443). Devices with this API version are available on the _homewizard._tcp
service.
TXT Records
A discovery response includes additional data to enhance the setup in your application.
Data | Description |
---|---|
api_version | The latest API version. |
id | Device identifier used during validation of the SSL certificate, formatted as appliance/<product_type>/<serial> . |
serial | Device serial number, also used as the MAC address. This value is unique per device and consist of 12 hexadecimal characters. |
product_name | A user-friendly name that may change at any time. |
product_type | The product type; refer to supported devices. Your application should support additional values for future products. |
Example
Run the following command to discover devices on your network: dns-sd -B _hwenergy._tcp .
$ dns-sd -B _hwenergy._tcp .
Browsing for _hwenergy._tcp
DATE: ---Tue 29 Oct 2024---
14:51:03.565 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
14:51:03.566 Add 3 7 local. _hwenergy._tcp. energysocket-AABBCC
14:51:03.566 Add 3 7 local. _hwenergy._tcp. energysocket-DDEEFF
14:51:03.566 Add 3 7 local. _hwenergy._tcp. energysocket-001122
14:51:03.566 Add 3 7 local. _hwenergy._tcp. p1meter-334455
14:51:03.566 Add 3 7 local. _hwenergy._tcp. kwhmeter-667788
14:51:03.566 Add 3 7 local. _hwenergy._tcp. watermeter-ABCDEF