The question comes up often: can a Shelly Pro EM-50 tell a heat pump to start on solar surplus? Yes, and it is one of the uses it was designed for. What is worth understanding is how it gives that order and when it should withdraw it, because the intuitive stop condition makes the compressor cycle.
What the Pro EM-50 has
It is the only Shelly meter with a built-in relay. Over RPC it shows two metering channels, em1:0 and em1:1, each with its 50 A clamp, and one relay, switch:0. Metering is bidirectional: act_power in EM1.GetStatus is positive when you import from the grid and negative when you export, provided the clamp faces the direction of consumption current.
http://<ip>/rpc/EM1.GetStatus?id=0
Check it at midday in sunshine: if the value is positive with the panels producing and the house idle, the clamp is the wrong way round. Turn it before building any logic on top.
The relay is a signal, and SG-Ready is a signal
The output is a 2 A / 240 V potential-free contact. The heat pump’s SG-Ready input is exactly that: two terminals waiting for something to close them, with almost no current flowing. The relay goes straight to that input, with nothing in between.
- SG-Ready: Pro EM-50 relay to the input, directly. The usual case.
- Real power (a backup heating element, say): the relay drives the coil of a contactor sized for the load, and the contactor switches the power.
- Never the compressor or an element hung off the meter’s relay: 2 A will not carry it.
SG-Ready defines four states with two contacts. With one relay you drive one of them, normally recommended run (state 3): “there is surplus, use it”. How it is used — raising the hot-water setpoint, charging the buffer tank — is the heat pump’s decision, per its SG-Ready settings.
| State | Contacts | Meaning |
|---|---|---|
| 1 | 1 : 0 | Blocked (utility order) |
| 2 | 0 : 0 | Normal operation |
| 3 | 0 : 1 | Recommended run (surplus) |
| 4 | 1 : 1 | Forced run |
Which contact is which, and how they are wired, is set by each manufacturer’s manual. All four states would need two contacts; using the surplus needs one.
The stop-condition trap
The intuitive logic is “start if export exceeds the threshold, stop if it falls below”. It does not work, and it is worth seeing why. The Pro EM-50 meters at the supply point: it sees the whole house’s balance. As soon as the heat pump starts, its own draw comes off the export. If you were exporting 2 kW and a 1.5 kW unit starts, the meter now sees 0.5 kW of export, below the threshold, and stops it. A minute later it sees 2 kW again and starts it. The compressor cycles.
The right condition is asymmetric: start on export (at least the heat pump’s draw plus a margin) and stop on import: when the house starts drawing from the grid steadily, the sun no longer covers the heat pump. Both with a delay, so a passing cloud does not count.
The script
It runs on the Pro EM-50 itself (Settings → Scripts), with no internet needed. It reads em1:0 every 10 seconds and drives switch:0. The values are starting points: set START to your heat pump’s real draw, which you can read on the meter itself with it running.
// Heat pump on surplus: em1:0 meters the supply, switch:0 drives SG-Ready
let START = 1800; // W exported before starting (heat pump draw + margin)
let IMPORT = 200; // W imported from the grid above which it stops
let T_ON = 30; // consecutive readings (x 10 s = 5 min) before starting
let T_OFF = 60; // consecutive readings (x 10 s = 10 min) before stopping
let n = 0;
Timer.set(10000, true, function () {
Shelly.call("EM1.GetStatus", { id: 0 }, function (r) {
if (!r) return;
let grid = r.act_power; // > 0 importing, < 0 exporting
let running = Shelly.getComponentStatus("switch:0").output;
if (!running) {
n = (-grid > START) ? n + 1 : 0;
if (n >= T_ON) { Shelly.call("Switch.Set", { id: 0, on: true }); n = 0; }
} else {
n = (grid > IMPORT) ? n + 1 : 0;
if (n >= T_OFF) { Shelly.call("Switch.Set", { id: 0, on: false }); n = 0; }
}
});
});
Tick “run on startup”. If the supply channel is the second one, change id: 0 to id: 1 in the EM1.GetStatus call. The heat pump also has its own minimum run and rest times: the script’s five and ten minutes add to them, they do not replace them.
Before fitting it
| Question | If yes | If no |
|---|---|---|
| SG-Ready input? | Relay straight to the input | Another control input, or Modbus |
| Single-phase? | Pro EM-50 | Pro 3EM + Pro 3EM Switch Add-on |
| Only using surplus? | One contact (state 3) | Two contacts for all four states |
On three-phase the equivalent is the Shelly Pro 3EM with the Pro 3EM Switch Add-on, which supplies the relay: the three-phase meters do not have one built in. The logic is the same, using the total power of the three phases instead of one channel.
Frequently asked questions
Do I need a contactor?
For SG-Ready, normally not: the relay closes a signal, not a load. Only if you are switching real power, and then the relay drives the contactor’s coil.
Can it modulate the heat pump by how much sun there is?
Not with a relay: it is on or off. Modulation is the heat pump’s own SG-Ready logic. If your unit supports Modbus and you want to pass it a power setpoint, that is a different integration.
Does it depend on the internet?
No. The script runs on the device, which also keeps 60 days of history and has its own clock, so it keeps managing the surplus if the connection drops.
In short: the Pro EM-50’s dry relay straight to SG-Ready; start on sustained export, stop on sustained import; and the clamp facing so that export reads negative. On three-phase, Pro 3EM with the Switch Add-on.