Troubleshooting Shelly 1PM with Home Assistant via MQTT

Hey there! I wanted to share my experience and troubleshooting tips for integrating a Shelly 1PM switch with Home Assistant using MQTT. If you’re having issues similar to mine, where sending an ‘on’ command works but you don’t receive feedback for the ‘off’ command, this might help!

Step 1: Verify MQTT Configuration
First, ensure your MQTT configuration in configuration.yaml is correctly set up. Here’s a template I used:
yaml
light:

  • platform: mqtt
    name: “Shelly 1PM”
    state_topic: “shellies/shelly1pm-xx/relay/0”
    command_topic: “shellies/shelly1pm-xx/relay/0/command”
    payload_on: “on”
    payload_off: “off”
    qos: 1

Step 2: Test MQTT Connectivity
Use a tool like MQTT Explorer to manually send commands to your Shelly 1PM. This helps isolate whether the issue is with Home Assistant or the device itself. I found that manually sending ‘on’ and ‘off’ commands worked perfectly, which indicated the problem was within Home Assistant’s configuration.

Step 3: Check for Firmware Updates
Ensure your Shelly 1PM is running the latest firmware. Outdated firmware can sometimes cause unexpected behavior with MQTT integrations. You can update the firmware through the Shelly app or web interface.

Step 4: Review Home Assistant Logs
Take a look at your Home Assistant logs for any errors or warnings related to MQTT or the Shelly 1PM. This can provide valuable insights. Here’s an example of what to look for:
plaintext
Logger: homeassistant.components.mqtt
Source: components/mqtt/init.py:245
Integration: MQTT (documentation, issues)
First occurred: 10:00:00 (1 occurrences)
Last logged: 10:00:00
MQTT error: No response received from the device.

If you see similar messages, it might indicate a connectivity issue between Home Assistant and your Shelly device.

Step 5: Reset MQTT Connection
As a last resort, try resetting the MQTT connection. This can be done by restarting both Home Assistant and the Shelly device. Sometimes, a clean restart can resolve persistent issues.

I hope these steps help you get your Shelly 1PM working seamlessly with Home Assistant! If you have any additional questions or tips, feel free to share them below. Happy automating! :rocket: