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?
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.
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.
Then open the Shelly Script interface in the browser: http://<SHELLY IP ADDRESS>/#/script/1
Example: http://192.168.31.185/#/script/1
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.
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 ===
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…
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…
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…
Comments
No comments yet. Be the first!