TapHome

Shelly 1PM

Packet Parser → MQTT
Submitted by
Last updated: 04. 2026
Shelly 1PM

The Shelly 1PM is a compact single-channel Wi-Fi relay switch with built-in power metering. It fits behind a standard wall switch and can control one circuit up to 16 A (3500 W at 230 V). TapHome communicates with the device over MQTT — this is the MQTT variant of the Shelly 1PM template, suitable when you prefer local MQTT communication over HTTP polling.

The template supports up to 5 Shelly 1PM units per module. Each unit is distinguished by a pulgNtopic custom variable pointing to the device’s MQTT Client ID. Each unit exposes a relay switch and an electricity meter.

Configuration

Device ID

Each Shelly 1PM has a unique MQTT Device ID in the format shelly1pm-<MAC6>, where <MAC6> is the last 6 characters of the MAC address in lowercase hex (e.g., shelly1pm-112233).

The Device ID can be found:

  • On the device label (MAC address)
  • In the Shelly web UI: SettingsDevice Info
  • Via API: GET http://<device-ip>/settingsmqtt.id field

This device supports mDNS discovery. You can use the hostname shelly1pm-{MAC}.local instead of an IP address when configuring TapHome. Replace {MAC} with the last 6 characters of the device’s MAC address in lowercase hex (e.g., shelly1pm-112233.local). Using a hostname prevents connectivity issues when the device’s IP address changes.

Template setup

After importing the template in TapHome:

  1. Open the Shelly 1PM MQTT module
  2. Set the MQTT Broker IP and Port (default 1883)
  3. For each Shelly 1PM unit, set the pulgNtopic custom variable to the Device ID of the corresponding Shelly 1PM (e.g., shelly1pm-112233)

The module subscribes to shellies/# and the listener scripts filter messages by the configured topic prefix.

Only configure the unit slots you actually use. Unconfigured slots (with the default shelly1pm-deviceidN value) will not match any real device and can be ignored.

Device capabilities

Relay control

Each unit exposes a switch device in TapHome. The relay state is read from the shellies/<id>/relay/0 topic and controlled by publishing on or off to shellies/<id>/relay/0/command.

Power metering

Each unit includes an electricity meter that reads two values:

  • Real-time powershellies/<id>/relay/0/power reported in watts, converted to kW by the template
  • Total consumptionshellies/<id>/relay/0/energy reported in watt-minutes, converted to kWh by the template

The meter is read-only — it updates automatically whenever the device publishes new data.

Thermal and overpower monitoring

Each switch device exposes four service attributes:

  • Internal temperature — device temperature in °C read from shellies/<id>/temperature
  • Temperature status — thermal level: Normal, High, or Very High (shellies/<id>/temperature_status)
  • Overheated — overtemperature alarm flag (shellies/<id>/overtemperature)
  • Overpower — reports the load power (W) when an overpower condition was detected (shellies/<id>/overpower_value)
Additional capabilities

The Shelly 1PM also publishes an online/offline status via the MQTT Last Will and Testament (LWT) topic, a full JSON status message (firmware ≥1.8.0), physical input state, and input events (short/double/triple/long press). These capabilities can be added in a future template update.

Troubleshooting

Device not reporting data
  1. Verify the Shelly 1PM is connected to Wi-Fi and MQTT is enabled in the device settings
  2. Check that the pulgNtopic custom variable matches the Device ID exactly (e.g., shelly1pm-112233)
  3. Confirm the MQTT broker IP and port are correct in the module settings
  4. Use an MQTT client (e.g., MQTT Explorer) to subscribe to shellies/# and verify the device publishes messages
Power readings show zero
  1. Confirm the load is connected through the Shelly relay (not bypassed)
  2. Check that the relay is turned on — the meter only reads when current flows through the relay
  3. Subscribe to shellies/<id>/relay/0/power with an MQTT client and verify the device reports a non-zero value
Overtemperature warning

The Shelly 1PM has internal thermal protection. If the device temperature exceeds safe limits, the temperature_status changes to “High” or “Very High” and overtemperature becomes true. Ensure adequate ventilation around the device, especially when switching high loads.

Gen1 Shelly devices do not support MQTT over TLS. Communication between the device and the MQTT broker is unencrypted (plain MQTT, port 1883). Ensure the MQTT broker is on a trusted local network.

How to install in TapHome

Prerequisites

  • Shelly device connected to Wi-Fi (see HTTP connection guide if not done yet)
  • MQTT broker running on your local network (e.g., Mosquitto, Home Assistant, or TapHome built-in broker)
  • TapHome CCU on the same network as the broker

On Gen1 devices, enabling MQTT disables Shelly Cloud. Both cannot run simultaneously. On Gen2/Plus devices this limitation does not apply.

Step 1 — Enable MQTT on the Shelly device

Gen1 devices (Shelly 1, 1PM, 2.5, EM, 3EM, Plug S, RGBW2, Dimmer, TRV…)

  1. Open the Shelly web UI: http://<device-ip>/
  2. Navigate to Internet & SecurityAdvanced — MQTT
  3. Enable MQTT
  4. Set MQTT Server: <broker-ip>:<port> (e.g., 192.168.1.10:1883)
  5. Optionally set MQTT User and MQTT Password if your broker requires authentication
  6. Click Save — the device will reboot and connect to the broker

Gen2 / Plus devices (Shelly Plus 1, Plus 1PM, Plus 2PM, Plus Plug S, Plus H&T, Pro 3EM…)

  1. Open the Shelly web UI: http://<device-ip>/
  2. Navigate to SettingsMQTT
  3. Enable MQTT
  4. Set Server: <broker-ip>:<port> (e.g., 192.168.1.10:1883)
  5. The Client ID is pre-filled with the device ID (e.g., shellyplus1pm-AABBCCDDEE) — leave as-is unless you have a specific reason to change it
  6. Click Save and reboot the device

To verify MQTT is working, use an MQTT client (e.g., MQTT Explorer) and subscribe to shellies/# (Gen1) or <device-id>/# (Gen2). You should see status messages from the device.

Step 2 — Find the Device ID / MQTT Client ID

Some templates require a Device ID or MQTT Client ID parameter. This is the unique identifier used in MQTT topics.

  • Gen1: found on the label as MAC address (e.g., AABBCCDDEE). Device ID = shelly<model>-<mac>, e.g., shelly1pm-AABBCCDDEE
  • Gen2/Plus: found in the Shelly web UI under SettingsDevice InfoDevice ID, or on the device label

Step 3 — Configure in TapHome

  1. In TapHome, add a new Packet Parser (MQTT) module
  2. IP Address: enter the MQTT broker IP (e.g., 192.168.1.10)
  3. Port: 1883 (default; use 8883 for TLS)
  4. Device ID / MQTT Client ID: enter the value from Step 2 (if required by the template)
  5. Import the template — TapHome will subscribe to the device topics automatically

Available devices

Shelly 1PM MQTT Module
Custom Variables
pulg1topic (string) = shelly1pm-deviceid1MQTT device ID of the first Shelly 1PM unit — format is 'shelly1pm-DEVICEID' (find Device ID in Shelly web UI → Settings → Device Info)
Open http://shellyIpAddress → Settings → Device info → copy Device ID
pulg2topic (string) = shelly1pm-deviceid2MQTT device ID of the second Shelly 1PM unit
pulg3topic (string) = shelly1pm-deviceid3MQTT device ID of the third Shelly 1PM unit
pulg4topic (string) = shelly1pm-deviceid4MQTT device ID of the fourth Shelly 1PM unit
pulg5topic (string) = shelly1pm-deviceid5MQTT device ID of the fifth Shelly 1PM unit
Electric Meter 1 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) for Shelly 1PM unit 1

numeric Unit: kW / kWh

Electric Meter 1

Listener
IF(INDEXOF(pulg1topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg1topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg1topic + "/relay/0/") != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/relay/0/power")
    VAR valueP := TOSTRING(RECEIVEDMSG.PAYLOAD);

    Ed := IF(ISNULL(valueP), NaN, TODOUBLE(valueP) / 1000.0);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/relay/0/energy")
    VAR valueE := TOSTRING(RECEIVEDMSG.PAYLOAD);

    To := IF(ISNULL(valueE), NaN, TODOUBLE(valueE) / 60000.0);
END
Switch 1 Switch

Relay control for Shelly 1PM unit 1 — on/off switching with thermal and overpower monitoring

boolean
Values / States: ON · OFF

Switch 1

Write switch state
VAR value := IF(St = 1, "on", "off");
MQTTPUBLISH("shellies/" + pulg1topic + "/relay/0/command", value);
Listener
IF(INDEXOF(pulg1topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg1topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg1topic) != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/relay/0")
    VAR value := TOSTRING(RECEIVEDMSG.PAYLOAD);
    
    IF(value = "on")
        St := 1;
    ELSEIF(value = "off")
        St := 0;
    ELSE
        ADDERROR("Unknown switch state");
    END
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/temperature")
    internalTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/overtemperature")
    overTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/temperature_status")
    tempStatus := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg1topic + "/overpower_value")
    overPower := TOSTRING(RECEIVEDMSG.PAYLOAD);
END
Service Attributes
Internal temperature
IF(LENGTH(internalTemp) = 0, "Unknown", internalTemp + "°C");
Overheated
IF(LENGTH(overTemp) = 0, "Unknown", IF(overtemp = 0, "No", "Yes"));
Temperature status
IF(LENGTH(tempStatus) = 0, "Unknown", tempStatus);
Overpower
IF(LENGTH(overPower) = 0, "0W", overPower + "W");
Electric Meter 2 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) for Shelly 1PM unit 2

numeric Unit: kW / kWh

Electric Meter 2

Listener
IF(INDEXOF(pulg2topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg2topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg2topic + "/relay/0/") != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/relay/0/power")
    VAR valueP := TOSTRING(RECEIVEDMSG.PAYLOAD);

    Ed := IF(ISNULL(valueP), NaN, TODOUBLE(valueP) / 1000.0);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/relay/0/energy")
    VAR valueE := TOSTRING(RECEIVEDMSG.PAYLOAD);

    To := IF(ISNULL(valueE), NaN, TODOUBLE(valueE) / 60000.0);
END
Switch 2 Switch

Relay control for Shelly 1PM unit 2 — on/off switching with thermal and overpower monitoring

boolean
Values / States: ON · OFF

Switch 2

Write switch state
VAR value := IF(St = 1, "on", "off");
MQTTPUBLISH("shellies/" + pulg2topic + "/relay/0/command", value);
Listener
IF(INDEXOF(pulg2topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg2topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg2topic) != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/relay/0")
    VAR value := TOSTRING(RECEIVEDMSG.PAYLOAD);
    
    IF(value = "on")
        St := 1;
    ELSEIF(value = "off")
        St := 0;
    ELSE
        ADDERROR("Unknown switch state");
    END
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/temperature")
    internalTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/overtemperature")
    overTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/temperature_status")
    tempStatus := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg2topic + "/overpower_value")
    overPower := TOSTRING(RECEIVEDMSG.PAYLOAD);
END
Service Attributes
Internal temperature
IF(LENGTH(internalTemp) = 0, "Unknown", internalTemp + "°C");
Overheated
IF(LENGTH(overTemp) = 0, "Unknown", IF(overtemp = 0, "No", "Yes"));
Temperature status
IF(LENGTH(tempStatus) = 0, "Unknown", tempStatus);
Overpower
IF(LENGTH(overPower) = 0, "0W", overPower + "W");
Electric Meter 3 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) for Shelly 1PM unit 3

numeric Unit: kW / kWh

Electric Meter 3

Listener
IF(INDEXOF(pulg3topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg3topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg3topic + "/relay/0/") != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/relay/0/power")
    VAR valueP := TOSTRING(RECEIVEDMSG.PAYLOAD);

    Ed := IF(ISNULL(valueP), NaN, TODOUBLE(valueP) / 1000.0);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/relay/0/energy")
    VAR valueE := TOSTRING(RECEIVEDMSG.PAYLOAD);

    To := IF(ISNULL(valueE), NaN, TODOUBLE(valueE) / 60000.0);
END
Switch 3 Switch

Relay control for Shelly 1PM unit 3 — on/off switching with thermal and overpower monitoring

boolean
Values / States: ON · OFF

Switch 3

Write switch state
VAR value := IF(St = 1, "on", "off");
MQTTPUBLISH("shellies/" + pulg3topic + "/relay/0/command", value);
Listener
IF(INDEXOF(pulg3topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg3topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg3topic) != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/relay/0")
    VAR value := TOSTRING(RECEIVEDMSG.PAYLOAD);
    
    IF(value = "on")
        St := 1;
    ELSEIF(value = "off")
        St := 0;
    ELSE
        ADDERROR("Unknown switch state");
    END
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/temperature")
    internalTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/overtemperature")
    overTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/temperature_status")
    tempStatus := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg3topic + "/overpower_value")
    overPower := TOSTRING(RECEIVEDMSG.PAYLOAD);
END
Service Attributes
Internal temperature
IF(LENGTH(internalTemp) = 0, "Unknown", internalTemp + "°C");
Overheated
IF(LENGTH(overTemp) = 0, "Unknown", IF(overtemp = 0, "No", "Yes"));
Temperature status
IF(LENGTH(tempStatus) = 0, "Unknown", tempStatus);
Overpower
IF(LENGTH(overPower) = 0, "0W", overPower + "W");
Electric Meter 4 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) for Shelly 1PM unit 4

numeric Unit: kW / kWh

Electric Meter 4

Listener
IF(INDEXOF(pulg4topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg4topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg4topic + "/relay/0/") != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/relay/0/power")
    VAR valueP := TOSTRING(RECEIVEDMSG.PAYLOAD);

    Ed := IF(ISNULL(valueP), NaN, TODOUBLE(valueP) / 1000.0);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/relay/0/energy")
    VAR valueE := TOSTRING(RECEIVEDMSG.PAYLOAD);

    To := IF(ISNULL(valueE), NaN, TODOUBLE(valueE) / 60000.0);
END
Switch 4 Switch

Relay control for Shelly 1PM unit 4 — on/off switching with thermal and overpower monitoring

boolean
Values / States: ON · OFF

Switch 4

Write switch state
VAR value := IF(St = 1, "on", "off");
MQTTPUBLISH("shellies/" + pulg4topic + "/relay/0/command", value);
Listener
IF(INDEXOF(pulg4topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg4topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg4topic) != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/relay/0")
    VAR value := TOSTRING(RECEIVEDMSG.PAYLOAD);
    
    IF(value = "on")
        St := 1;
    ELSEIF(value = "off")
        St := 0;
    ELSE
        ADDERROR("Unknown switch state");
    END
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/temperature")
    internalTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/overtemperature")
    overTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/temperature_status")
    tempStatus := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg4topic + "/overpower_value")
    overPower := TOSTRING(RECEIVEDMSG.PAYLOAD);
END
Service Attributes
Internal temperature
IF(LENGTH(internalTemp) = 0, "Unknown", internalTemp + "°C");
Overheated
IF(LENGTH(overTemp) = 0, "Unknown", IF(overtemp = 0, "No", "Yes"));
Temperature status
IF(LENGTH(tempStatus) = 0, "Unknown", tempStatus);
Overpower
IF(LENGTH(overPower) = 0, "0W", overPower + "W");
Electric Meter 5 Electricity Meter Read-only

Real-time power (kW) and cumulative energy (kWh) for Shelly 1PM unit 5

numeric Unit: kW / kWh

Electric Meter 5

Listener
IF(INDEXOF(pulg5topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg5topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg5topic + "/relay/0/") != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/relay/0/power")
    VAR valueP := TOSTRING(RECEIVEDMSG.PAYLOAD);

    Ed := IF(ISNULL(valueP), NaN, TODOUBLE(valueP) / 1000.0);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/relay/0/energy")
    VAR valueE := TOSTRING(RECEIVEDMSG.PAYLOAD);

    To := IF(ISNULL(valueE), NaN, TODOUBLE(valueE) / 60000.0);
END
Switch 5 Switch

Relay control for Shelly 1PM unit 5 — on/off switching with thermal and overpower monitoring

boolean
Values / States: ON · OFF

Switch 5

Write switch state
VAR value := IF(St = 1, "on", "off");
MQTTPUBLISH("shellies/" + pulg5topic + "/relay/0/command", value);
Listener
IF(INDEXOF(pulg5topic, "shelly1pm-deviceid") = 0)
    ADDERROR("Set correct 'pulg5topic' value in module variables. Topic format is 'shelly1pm-<deviceid>'. The Device ID can be found by opening url 'http://shellyIpAddress', in Settings -> Device info.");
    RETURN(-1);
END

IF(INDEXOF(RECEIVEDMSG.TOPIC, "shellies/" + pulg5topic) != 0)
    RETURN(0);
END

IF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/relay/0")
    VAR value := TOSTRING(RECEIVEDMSG.PAYLOAD);
    
    IF(value = "on")
        St := 1;
    ELSEIF(value = "off")
        St := 0;
    ELSE
        ADDERROR("Unknown switch state");
    END
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/temperature")
    internalTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/overtemperature")
    overTemp := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/temperature_status")
    tempStatus := TOSTRING(RECEIVEDMSG.PAYLOAD);
ELSEIF(RECEIVEDMSG.TOPIC = "shellies/" + pulg5topic + "/overpower_value")
    overPower := TOSTRING(RECEIVEDMSG.PAYLOAD);
END
Service Attributes
Internal temperature
IF(LENGTH(internalTemp) = 0, "Unknown", internalTemp + "°C");
Overheated
IF(LENGTH(overTemp) = 0, "Unknown", IF(overtemp = 0, "No", "Yes"));
Temperature status
IF(LENGTH(tempStatus) = 0, "Unknown", tempStatus);
Overpower
IF(LENGTH(overPower) = 0, "0W", overPower + "W");
Connection: Packet Parser → MQTT
Possible improvements (5)
  • Connection Status — LWT topic — true on connect, false on disconnect. Could detect offline units.
  • Full Status JSON — Complete /status as JSON (fw ≥1.8.0). Could parse wifi_sta.rssi, uptime, has_update.
  • Input State — Physical input state (0/1). Shelly 1PM has one input — could be used for detached switch scenarios.
  • Input Event — JSON with event type (S=short, SS=double, SSS=triple, L=long) and event_cnt. Useful for button automation.
  • Internal Temperature (Fahrenheit) — Same as temperature topic but in Fahrenheit. Redundant — Celsius already implemented via service attribute.

Sources