
The Shelly Gas (model SHGS-1) is a mains-powered Wi-Fi detector for combustible gas. It plugs directly into a wall socket, measures gas concentration continuously and raises its own sound and light alarm when the concentration crosses a threshold. It is sold as two separate products — Shelly Gas CNG for compressed natural gas (methane) and Shelly Gas LPG for liquefied petroleum gas (propane / butane). Both share the same firmware and the same MQTT topics, so this one template works with either; only the sensor element and the recommended mounting height differ.
This template connects to an MQTT broker, not to the device directly. The module subscribes to shellies/# on the broker and filters out the messages belonging to one Shelly Gas unit by its Device ID. TapHome receives the alarm state and the gas concentration as the device publishes them, and can start a sensor self-test.
An HTTP variant of this template is also available (
Shelly Gas). Use this MQTT template when an MQTT broker already runs in the installation and push updates are preferred; use the HTTP template when there is no broker.
Shelly Gas is a safety device. The TapHome integration supplements its built-in buzzer and LED alarm — it does not replace them. The buzzer and the LED work independently of MQTT, of the broker and of the TapHome control unit, and keep working when any of those is unavailable.
Hardware
Placement
The unit plugs into a mains socket — there is no wiring. The correct mounting height depends on the gas variant, because the two gases behave differently in air.
| Variant | Gas detected | Behaviour in air | Recommended placement |
|---|---|---|---|
| Shelly Gas CNG | Compressed natural gas (methane) | Lighter than air, collects at the ceiling | 0.3–1 m below the ceiling, vertically, and 1.5 m from the gas source |
| Shelly Gas LPG | Liquefied petroleum gas (propane / butane) | Heavier than air, collects at floor level | 0.3 m above the floor, within 1.5 m of the gas source |
CNG and LPG are two separate products with different sensors, not a switchable mode. If the variant is unclear, check the markings on the back of the device.
Specification
| Parameter | Value |
|---|---|
| Power supply | 110–230 V ±10 %, 50/60 Hz AC |
| Power consumption | < 3 W |
| Alarm sensitivity | 6 % LEL (lower explosive limit) |
| Sound level | ≥ 70 dB |
| Wi-Fi | 802.11 b/g/n, 2400–2484 MHz |
| Range | up to 50 m outdoors, up to 30 m indoors |
| Operational temperature | −10 °C to +50 °C |
| Valve manipulator jack output | 11–13 V, 500 mA (external accessory, not controlled by this template) |
| Dimensions | 89.5 × 89.5 × 38 mm (plug not included) |
Local indication
The LED ring and the buzzer are the device’s own indication. TapHome sees only the two topics described under Device capabilities, so these signals carry information that does not reach the control unit.
| LED ring | Meaning |
|---|---|
| Solid green | Sensor in normal operation |
| Solid yellow | Sensor fault |
| Flashing red | Alarm |
| Flashing red / yellow / green in sequence | Sensor warming up |
| Buzzer pattern | Event |
|---|---|
| Two short beeps per second | Warm-up started after power on |
| One long beep per second | Warm-up finished |
| Long beep once per second until the fault clears | Sensor fault |
| Three short beeps twice per second | Self-test running |
| Long beep once per second | Self-test finished successfully |
| Long beep once per second, until the leak is gone or escalates | Mild gas leak |
| Five seconds of beeping with a one-second pause, until the leak is gone | Heavy gas leak |
After power-up the device runs a self-test that takes about three minutes. The LED ring cycles green → orange → red during it and the gas reading is not valid.
Configuration
Enabling MQTT on the device
- Open the device’s web interface in a browser.
- Go to Internet and Security → Advanced - Developer Settings.
- Tick Enable action execution via MQTT.
- Fill the Server field using the formula
{MQTT broker IP address}:{port}— for example192.168.1.10:1883. - Press SAVE. The device reconnects and starts publishing to the broker.
On Gen1 firmware, enabling MQTT disables the Shelly Cloud connection — the two cannot run at the same time. Gen1 devices also do not support MQTT over TLS, so the broker must accept plain MQTT on port 1883. Keep the broker on a trusted local network.
Reading the Device ID
In the web interface go to Settings → Device Info → Device ID. The value needed is the first string of characters, not the value in brackets. It is a Shelly-ID of six or more characters, for example 35FA58. The same identifier appears in the Wi-Fi network the device creates in access-point mode (ShellyGas-35FA58) and forms the MQTT topic prefix shellies/shellygas-35FA58/.
Template setup
The template asks for three import parameters:
| Import parameter | Default | Value to enter |
|---|---|---|
| Mqtt Broker IP address | 192.168.0.1 | IP address of the MQTT broker — not of the Shelly Gas |
| Mqtt Broker port | 1883 | Port the broker listens on |
| Device ID | — | The Shelly-ID read above, e.g. 35FA58 |
The Device ID import parameter fills the module-level deviceID variable, which builds the topic prefix for every topic the module uses. The module subscribes to shellies/# and its listener scripts filter the incoming messages by that prefix.
By default the device publishes an update every 30 seconds. Setting the device parameter mqtt_update_period to 0 switches it to reporting only on change.
Device capabilities
Gas alarm
Gas Alarm is a multi-value switch fed from shellies/shellygas-<deviceID>/sensor/gas. It carries the alarm level the device has already derived from the measured concentration.
| TapHome value | MQTT payload | Meaning |
|---|---|---|
| No alarm | none | Concentration below 1800 ppm |
| Mild gas leak | mild | Concentration at or above 1800 ppm |
| Heavy gas leak | heavy | Concentration at or above 3000 ppm |
| Self Test | test | Published after a successful self-test |
| Alarm state is unknown | unknown or any other payload | The device cannot state the alarm level |
The two thresholds are fixed in the device firmware and cannot be changed.
Gas concentration
Gas Concentration reads the raw value from shellies/shellygas-<deviceID>/sensor/concentration in parts per million, range 0–65535 ppm. It is the same physical measurement as Gas Alarm, before the firmware applies its thresholds.
Use Gas Alarm for alarm logic and Gas Concentration for trends, charts and custom early-warning limits below 1800 ppm. A rule should not re-derive its own alarm level from the ppm value and expect it to match the device — the buzzer and the LED follow the fixed firmware thresholds.
The device publishes
-1on the concentration topic whenever the reading is not valid — during the roughly three-minute warm-up after power-up, and while the sensor is faulted. The template stores that-1as it is; it is not a TapHome error code.
Self test
The module provides a Self test service action, which publishes to shellies/shellygas-<deviceID>/sensor/start_self_test. The device beeps three short beeps twice per second while the test runs and publishes test on the gas topic when it succeeds, which appears in TapHome as the Self Test value of Gas Alarm.
Known limitations
Mute Active Alarm does not reach the device
The template contains a Mute Active Alarm push button, but in the current template revision it has no effect. The button publishes to the literal topic shellies/shellygas-<deviceid>/sensor/mute — the <deviceid> placeholder is never replaced with the configured Device ID, so the message goes to a topic no real device subscribes to. The other three topics in the same template build their prefix correctly from the deviceID variable.
Do not rely on the Mute Active Alarm button. Muting an active alarm from TapHome will work only once the template is corrected to build the topic from the
deviceIDvariable. The alarm can always be muted on the device itself, using Mute in its web interface — and only while an alarm is actually active.
Troubleshooting
No values arrive in TapHome
- Verify MQTT is enabled on the device and the Server field holds the broker address in the form
{IP}:{port} - Check that the module endpoint points at the MQTT broker, not at the Shelly Gas IP address
- Confirm the Device ID matches exactly what Settings → Device Info → Device ID shows — the first string only, without the value in brackets
- Subscribe to
shellies/#with an MQTT client (for example MQTT Explorer) and check that messages arrive undershellies/shellygas-<your-id>/ - If the device was switched to change-only reporting (
mqtt_update_period = 0), run the Self test service action — a successful test publishes on the gas topic
Gas Concentration shows -1
The sensor reading is not valid. Either the device is still warming up — about three minutes after power-up — or the sensor has a fault. A fault shows on the device as a solid yellow LED and a long beep once per second. This template does not read the sensor state topic, so a fault reaches TapHome only as this -1.
Gas Alarm shows “Alarm state is unknown”
This value is the fallback branch of the template. It catches the documented unknown payload and any payload outside the four known values. Check the LED ring on the device to see what state the sensor is actually in.
The device disappeared from Shelly Cloud
Expected on Gen1 firmware — enabling MQTT disables the cloud connection. Reach the web interface over the local network instead, using the device IP address or the mDNS hostname shellygas-<MAC>.local.