Shelly → Ada P1 Meter Script Translator

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 / okosvillanyora.hu 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

// === 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 ===
PZIOT-E02 consumption meter – with native okosvillanyora.hu support

PZIOT-E02 consumption meter – with native okosvillanyora.hu support

2025.10.16.    513

The Swiss army knife of phase measurement The PZIOT-E02 can provide great help in two situations: 1. If you don’t have an electricity meter with a P1 port In this case, the PZIOT-E02 functions as a…

More
Why is it important to also measure inverter production?

Why is it important to also measure inverter production?

2025.10.16.    430

For owners of household-scale small power plants (HMKE), it is natural to monitor the feedback to the grid. This value shows how much of the produced energy the house does not use immediately, but sen…

More
More than a thousand households already use the Hungarian-developed ADA P1 Meter for more conscious energy use

More than a thousand households already use the Hungarian-developed ADA P1 Meter for more conscious energy use

2025.12.22.    558

In recent times, it has become increasingly important for more Hungarian households not only to see their electricity bill but also to understand what is actually happening behind the scenes. The Debr…

More

Featured

ADA P1 Meter - smart meter for electricity meter +15 cm RJ12 data cable

ADA P1 Meter - smart meter for electricity meter +15 cm RJ12 data cable

The device collects nearly 40 data points (consumption, feedback, phase parameters, reactive energie..

15,900 Forint Ex Tax: 12,520 Forint

PZIOT-E02 – with native okosvillanyora.hu and hmke.app support

PZIOT-E02 – with native okosvillanyora.hu and hmke.app support

The PZIOT-E02 is a compact, DIN rail mountable consumption meter, capable of accurately measuring th..

9,900 Forint 12,899 Forint Ex Tax: 7,795 Forint

3pcs 1-phase PZIOT-E02 current meter – native okosvillanyora.hu support

3pcs 1-phase PZIOT-E02 current meter – native okosvillanyora.hu support

The package contains 3 pieces of PZIOT-E02 phase meters. The above price applies to 3 pcs.The PZIOT-..

24,900 Forint 29,900 Forint Ex Tax: 19,606 Forint

ADA P1 Bridge - Bridge for P1 reader +1m USB cable

ADA P1 Bridge - Bridge for P1 reader +1m USB cable

Compatible with any P1 meter that provides telegram/P1 data on the local network via HTTP GET (URL) ..

5,900 Forint Ex Tax: 4,646 Forint

Comments

No comments yet. Be the first!