
The Shelly Plug S is a compact Wi-Fi smart plug with built-in energy monitoring, rated at 12A / 2500W. TapHome communicates with the device over MQTT — the plug subscribes to a broker and publishes relay state, power consumption, energy counter, and internal temperature data.
The template exposes two devices: an Electric Meter for energy monitoring and a Switch for relay control. A module-level service attribute reports the internal device temperature.
Configuration
Device ID
Each Shelly Plug S has a unique MQTT Device ID in the format shellyplug-s-<MAC6>, where <MAC6> is the last 6 characters of the MAC address in lowercase hex (e.g., shellyplug-s-112233).
The Device ID can be found:
- In the Shelly web UI: Settings → Device Info → Device ID (use the first string of characters, not in brackets)
- Via API:
GET http://<device-ip>/settings→mqtt.idfield
Enabling MQTT
To enable MQTT on the Shelly Plug S:
- Open the device web interface in a browser (navigate to the device IP address)
- Go to Internet and Security → Advanced - Developer Settings
- Tick “Enable action execution via MQTT”
- Fill the “Server” input with
{MQTT broker IP}:{port}(default port1883) - Press SAVE
Template setup
After importing the template in TapHome:
- Open the Shelly Plug S MQTT module
- Set the MQTT Broker IP and Port (default
1883) - Set the deviceID custom variable to the Device ID of the Shelly Plug S (e.g.,
112233— just the last 6 hex characters of the MAC address)
The module subscribes to shellies/# and the listener scripts filter messages by the configured device ID prefix shellyplug-s-{deviceID}.
Device capabilities
Energy monitoring
The Electric Meter device reads two values from the plug:
- Total consumption — cumulative energy from the
relay/0/energytopic. The device reports energy in Watt-minutes; the template converts to kWh by dividing by 60000. - Instantaneous demand — current power draw from the
relay/0/powertopic. The device reports power in Watts; the template converts to kW by dividing by 1000.
Both values update according to the MQTT reporting interval (default 30 seconds, configurable in the Shelly web UI via mqtt_update_period).
The energy counter resets on device reboot. For persistent energy tracking, use TapHome’s built-in energy logging which stores cumulative values independently of the device counter.
Relay control
The Switch device controls the plug’s relay:
- Read state — listens to
shellies/shellyplug-s-{deviceID}/relay/0and mapson→ 1,off→ 0 - Write state — publishes to
shellies/shellyplug-s-{deviceID}/relay/0/commandwithonoroff
The relay supports up to 2500W / 12A load.
Temperature monitoring
A module-level service attribute reports the internal device temperature in °C, read from the shellies/shellyplug-s-{deviceID}/temperature topic. This is the temperature of the plug’s electronics, not ambient room temperature.
Additional capabilities
The Shelly Plug S also publishes an online/offline status via the MQTT LWT topic, overtemperature alerts (when the device exceeds safe operating temperature), a human-readable temperature status classification (Normal/High/Very High), and button input events (short press, long press, double press). These capabilities can be added in a future template update.
Troubleshooting
No data from the plug
- Verify the Shelly Plug S is connected to Wi-Fi and MQTT is enabled in the device settings (Internet and Security → Advanced - Developer Settings)
- Check that the deviceID custom variable matches the Device ID exactly (e.g.,
112233) - Use an MQTT client (e.g., MQTT Explorer) to subscribe to
shellies/#and verify the plug publishes messages
Power readings show zero
- Confirm a load is connected and the relay is switched on
- Check the
relay/0/powertopic with an MQTT client — the value should be non-zero when a load is drawing power - Verify the Electric Meter device shows values in TapHome — total consumption in kWh, demand in kW
Relay not responding to commands
- Verify MQTT is enabled and the broker address is correct in the Shelly web UI
- Check that TapHome can reach the MQTT broker (correct IP and port in the module settings)
- Test by publishing
onorofftoshellies/shellyplug-s-{deviceID}/relay/0/commandvia an MQTT client
Gen1 Shelly devices do not support MQTT over TLS. Communication between the plug and the MQTT broker is unencrypted (plain MQTT, port 1883). Ensure the MQTT broker is on a trusted local network.