Internal API - homebridge-plugins/homebridge-ewelink GitHub Wiki
The plugin has a built-in HTTP API which lets you query and control your eWeLink accessories from outside HomeKit - useful for scripts, dashboards or other home automation systems.
- Set the Internal API Port option (
apiPort) in the plugin settings:-
0(default) - the API is disabled -
1- the plugin picks a randomly available port (shown in the log at startup) - any other number - the API listens on that port
-
- Your eWeLink credentials must be present in the config (they are used to authenticate API requests)
- Restart Homebridge
- Open
http://<homebridge-ip>:<port>/in a browser - the API serves its own full documentation page there, listing every available query and control command with examples - In short:
- all requests are
HTTP GET - all requests need an
Authorization: Basic ...header, where the value is a base64-encodedusername:passwordof your eWeLink credentials - all responses are JSON with a
successproperty, and anerrorstring when something went wrong - devices are addressed by their Homebridge ID (e.g.
10000abcdeSWX), which you can find in the Homebridge log or via the API's device list command
- all requests are
# Obtain a device list
curl -H "Authorization: Basic $(echo -n '[email protected]:yourpassword' | base64)" \
http://192.168.1.10:12345/get/devicelistThe API accepts your eWeLink credentials over plain HTTP on your local network. Only enable it if you are comfortable with that, and never expose the port to the internet.