prefixkit Ask an engineerAsk Support RU

Zigbee devices Smart plugs with energy metering

Shelly S4SW-002P16EU-SWITCH

2PM Gen4 (Switch mode). Works with Zigbee2MQTT with no vendor hub or cloud: it pairs with a Zigbee stick and shows up in Home Assistant.

Vendor
Shelly
Model
S4SW-002P16EU-SWITCH
Type
Smart plugs with energy metering
Power
mains: usually a router that extends the mesh
Firmware updates (OTA)
yes, through Zigbee2MQTT

Find it in shops: AliExpress

Links open a search in the shop; some are affiliate links: buying through them costs you nothing extra and supports this site. We do not sell devices or get them from manufacturers.

What it exposes

FeaturePropertyValuesControl
Action (button press)actioninput_1_on, input_1_off, input_1_toggle, input_1_single, input_1_double, input_1_triple, input_1_hold, input_2_on …read only
Switch type (sw1)switch_type_sw1toggle, momentarysettable
Switch type (sw2)switch_type_sw2toggle, momentarysettable
On / off (l1)state_l1—settable
On / off (l2)state_l2—settable
Power (l1)power_l1Wread only
Power (l2)power_l2Wread only
Voltage (l1)voltage_l1Vread only
Voltage (l2)voltage_l2Vread only
AC frequency (l1)ac_frequency_l1Hzread only
AC frequency (l2)ac_frequency_l2Hzread only
Current (l1)current_l1Aread only
Current (l2)current_l2Aread only
Energy (l1)energy_l1kWhread only
Energy (l2)energy_l2kWhread only
Produced energy (l1)produced_energy_l1kWhread only
Produced energy (l2)produced_energy_l2kWhread only
Wi-Fi statuswifi_status—read only
IP addressip_address—read only
DHCP enableddhcp_enabled—read only
Wi-Fi Configurationwifi_config—read only
Identifyidentifyidentifysettable

MQTT: state and commands

Zigbee2MQTT publishes the device state to zigbee2mqtt/my_device (my_device is the name you give the device). An example message:

{
  "switch_type_sw1": "toggle",
  "switch_type_sw2": "toggle",
  "state_l1": "ON",
  "state_l2": "ON",
  "power_l1": 12.4,
  "power_l2": 12.4,
  "voltage_l1": 230,
  "voltage_l2": 230,
  "ac_frequency_l1": 0,
  "ac_frequency_l2": 0,
  "current_l1": 0.06,
  "current_l2": 0.06,
  "energy_l1": 3.21,
  "energy_l2": 3.21,
  "linkquality": 120
}

Send commands to zigbee2mqtt/my_device/set:

mosquitto_pub -t zigbee2mqtt/my_device/set -m '{"state_l1":"TOGGLE"}'
mosquitto_pub -t zigbee2mqtt/my_device/set -m '{"state_l2":"TOGGLE"}'
mosquitto_pub -t zigbee2mqtt/my_device/set -m '{"switch_type_sw1":"momentary"}'
mosquitto_pub -t zigbee2mqtt/my_device/set -m '{"switch_type_sw2":"momentary"}'

Watch the topics live from the browser: MQTT client.

Home Assistant automation example

Zigbee2MQTT creates Home Assistant entities from the device name. If it is called my_device, an automation in automations.yaml can look like this:

- alias: "Turn off when idle"
  mode: single
  triggers:
    - trigger: numeric_state
      entity_id: sensor.my_device_power
      below: 2
      for: "00:15:00"
  actions:
    - action: switch.turn_off
      target:
        entity_id: switch.my_device_l1

Check the YAML: YAML checker.

How to pair it

  1. In Zigbee2MQTT click Permit join.
  2. Put the device in pairing mode: usually a long press of the reset button (5–10 s) until the LED blinks; bulbs: switch the power off and on 5–6 times.
  3. Keep the device close to the coordinator or a router while pairing.
  4. Give it a clear name: MQTT topics and Home Assistant entities are built from it.

Exact procedure and model notes: the device page in the Zigbee2MQTT docs. No coordinator yet: coordinator picker.

Similar devices

Idea?