Shelly H&T Gen 3 Integration and Light Automation Tips

Hello everyone, I wanted to share my recent experiences with integrating the Shelly H&T Gen 3 into Home Assistant and setting up a light automation based on motion and brightness. I hope this helps someone else who might be going through a similar process!

First, let me talk about the Shelly H&T Gen 3. I’ve been trying to get this device connected to Home Assistant, but it wasn’t showing up under the Shelly section. After some research, I realized I needed to configure the outbound WebSocket connection properly. I set the address to ws://[home-assistant-ip]:8123/api/shelly/ws and retried the setup. It finally showed up! If you’re having trouble, make sure your WebSocket settings are correct and that the device is within range.

Now, onto the light automation. I wanted my ceiling light to turn on when motion is detected at night and turn off after a period of inactivity. Here’s what I learned:

  1. Motion Detection and Nighttime Check: I used a motion sensor to trigger the automation. To ensure it only activates at night, I added a condition to check if it’s after sunset or before sunrise. This was crucial to avoid unnecessary light usage during the day.

  2. Brightness Control: I set the light to a dim brightness (8%) when it turns on. This provides enough light without being too harsh. However, I ran into an issue where the light wouldn’t turn off if the brightness was below a certain threshold. I realized I needed to adjust the condition to check the brightness level before turning the light off.

  3. Delay Before Turning Off: To prevent the light from turning off immediately after motion stops, I added a delay using a wait action. This ensures that the light stays on for a few minutes, giving me enough time to move around without it turning off prematurely.

Here’s a simplified version of my automation setup:

yaml
alias: Motion-Activated Night Light
trigger:

  • platform: motion
    entity_id: binary_sensor.motion_sensor
    condition:
  • condition: sun
    after: sunset
    before: sunrise
    action:
  • service: light.turn_on
    entity_id: light.ceiling_light
    data:
    brightness_pct: 8
  • wait: 5 minutes
  • service: light.turn_off
    entity_id: light.ceiling_light

This setup has been working great for me! The light turns on softly when I enter the room at night and stays on just long enough for me to adjust. It’s a small but significant improvement to my home’s comfort.

I’d love to hear if anyone else has tips or tricks for similar automations or has had success with the Shelly H&T Gen 3 in Home Assistant. Happy automating! :rocket: