ha_hatch Home Assistant Integration

repository·main·Indexed 41 days ago

https://github.com/dahlb/ha_hatch

A custom Home Assistant integration for Hatch Rest and Restore sound machines. It enables control of lights, sounds, and alarms, including support for Restore series wake times, Rest+ 2nd gen favorites, and standard media player services for sound modes like PinkNoise, Ocean, and Rain.

Tokens
916
Snippets
1
Records
6
Agent score
2%

What's inside ha_hatch

  1. Manage Hatch alarms (Restore, Restore 2, Restore 3)

    main

    For Restore series devices, you can manage existing alarms using the following methods:

    • Enable/Disable Alarms: Use the alarm switch entity.
    • Change Wake Times: Use the alarm wake time entity. Note that the sunrise light start shifts automatically with the wake time.
    • Set Wake Time via Automations: Use the time.set_value action. Example format: time: "06:45:00".
    • Set Repeat Days: Use the ha_hatch.set_alarm_weekdays action in automations or Developer Tools.

    Important Notes:

    • If Hatch omits an endTime, the wake time is derived from startTime plus the alarm sunrise duration.
    • Alarm changes made in the Hatch app refresh automatically every 10 minutes. To see changes immediately, reload the integration.
    • Unsupported operations: Creating new alarms, deleting alarms, or editing alarm sounds/lights.
    # Example: Setting wake time in an automation
    action: time.set_value
    data:
      time: "06:45:00"
    
    # Example: Setting repeat days
    service: ha_hatch.set_alarm_weekdays
    data:
      # (Follow documentation for specific weekday parameters)
  2. Install the ha_hatch integration

    main

    You can install the ha_hatch integration using one of two methods:

    1. HACS (Home Assistant Community Store): The recommended method for most users.
    2. Manual Installation: Manually copy the integration files into your Home Assistant configuration directory.

    Configuration: After installation, configuration is performed via the Home Assistant UI. You will be required to enter your Hatch username and password.

  3. Troubleshoot ha_hatch issues

    main

    If you encounter errors, follow these steps to provide useful diagnostics to the maintainers:

    1. Enable Debug Logging: Go to /config/integrations/integration/ha_hatch and enable debug logging.
    2. Capture Initialization: Restart Home Assistant to capture the startup process with debug logging enabled, then reproduce the issue.
    3. Download Logs: Disable debug logging at /config/integrations/integration/ha_hatch to trigger the log download.
    4. Download Diagnostics:
      • Go to the device in Home Assistant.
      • Click the three-dots menu.
      • Click Download Diagnostics.
    5. Submit Issue: Attach both the downloaded logs and the diagnostics file to your issue ticket.
  4. Control sound modes on Media Player entities

    main

    If your Hatch device is exposed as a media player, you can select specific sound modes. The available options are:

    • Stream
    • PinkNoise
    • Dryer
    • Ocean
    • Wind
    • Rain
    • Bird
    • Crickets
    • Brahms
    • Twinkle
    • RockABye

    You can also use standard media player services: Play, Stop, and Set volume.

  5. Activate Hatch favorites (Rest+ 2nd gen)

    main

    For Rest+ 2nd gen devices, you can start a defined favorite by activating a scene.

    Note: If you add new favorites within the Hatch app, you must reload the integration or restart Home Assistant to make the new scenes available in Home Assistant.

  6. Control Hatch light colors and brightness

    main

    Hatch devices exposed as light entities support standard light controls including brightness, hs_color, rgb_color, and xy_color.

    Below are the color values used by the Hatch app for reference:

    Colorhs_colorrgb_colorxy_color
    Orange25.767, 69.658234, 141, 710.547, 0.379
    Dark blue212.368, 67.55673, 143, 2250.173, 0.197
    Light blue187.586, 80.9341, 193, 2150.158, 0.301
    Green153.051, 56.1992, 210, 1570.208, 0.441
    Pink330.811, 60.163246, 98, 1700.476, 0.248