We help you choose the right device for your system Ask an expert →
← Back to the blog

Shelly → Ada P1 Meter Script Translator

▣ 2025-12-04 ◉ 1016 views

What does this Shelly Plug Script generator do?

This little tool automatically generates the Shelly Plug Script code, which allows you to send the consumption meter data (power, voltage, current, total energy, and the switch state) to the ADA P1 Meter / hmke.app system. This way, your Shelly socket will appear on the HMKE.app interface and can be controlled from there directly.


You provide the Shelly device name, the index (01–50) and the IP address in the form, and the generator creates the complete script from these, which you only need to paste into the Shelly browser Script interface. You can copy the code to the clipboard with one click on the "Copy" button.

How to configure the Shelly Plug device?

  1. First, set up Wi-Fi on the Shelly device (SSID, password). Once it connects to the network, note or check its IP address in the router.
  2. Open its IP address in the browser (e.g. http://192.168.31.185), and update the Shelly firmware to the latest official version (in the web interface under settings / firmware update). The script function only works reliably with updated firmware.
  3. Then open the Shelly Script interface in the browser:
    http://<SHELLY IP ADDRESS>/#/script/1
    Example: http://192.168.31.185/#/script/1
  4. Copy the full script generated by the generator below using the "Copy" button, then paste it into the Shelly script editor. Name it as you like, then enable it and save it.
  5. The script requests the measured data from the Shelly Plug every 10 seconds and sends it to the http://okosvillanyora.local:8989/write endpoint. If everything is fine, the Shelly plugin fields (power, voltage, current, total energy, status) will show up in the ADA P1 system and the HMKE.app interface.

Shelly Plug Script Generator

Shelly Device Name
Shelly IP Address
Index (01–50) 0102030405060708091011121314151617181920212223242526272829303132333435363738394041424344454647484950
Copy // === SETTINGS === let IDX = "01"; // <-- index (01–50) let NAME = "Shelly Plug"; // <-- device name let IP = "192.168.31.185"; // <-- Shelly IP address // === START SCRIPT === let INTERVAL_MS = 10000, POST_URL = "http://okosvillanyora.local:8989/write"; function K(k){return "Shelly_" + k + "_" + IDX;} Timer.set(INTERVAL_MS, true, function () { Shelly.call("Switch.GetStatus", {id: 0}, function (r) { if (!r || r.apower === undefined) { print("ERR status"); return; } let v = {}; v[K("total")] = (r.aenergy.total / 1000).toFixed(3); v[K("voltage")] = (r.voltage !== undefined ? r.voltage.toFixed(1) : ""); v[K("current")] = (r.current !== undefined ? r.current.toFixed(3) : ""); v[K("power")] = (r.apower / 1000).toFixed(3); v[K("ip")] = IP; v[K("status")] = r.output; v[K("name")] = NAME; Shelly.call("HTTP.POST", { url: POST_URL, headers: {"Content-Type": "application/json"}, body: JSON.stringify({device: "plugins", values: v}) }, function (res, ec, em) { print(ec === 0 ? "send -> success" : "ERR " + ec + " " + em); }); }); }); // === END SCRIPT ===