Skip to content

Latest commit

 

History

History
73 lines (49 loc) · 3.6 KB

File metadata and controls

73 lines (49 loc) · 3.6 KB

License HACS Custom Integration

MQTT Push Button Custom Integration

This Home Assistant custom integration enables the use of modified Xiaomi Aqara door and window contact sensors as smart light push buttons. By leveraging this tutorial, you can repurpose affordable Aqara contact sensors to smarten your light switches.

Features

  • Integrates modified Aqara contact sensors via Zigbee2MQTT.
  • Allows configuration of MQTT topics, device names, and value templates.
  • Detects short push, long push, and double push events.
  • Enables automation based on the contact sensor's state.

Installation

Prerequisites

Installation Steps

  1. Add Custom Repository to HACS:

    • In Home Assistant, navigate to HACS in the sidebar.
    • Click on Integrations.
    • Click on the three dots () in the top right corner and select Custom repositories.
    • In the dialog that appears:
      • Paste the repository URL: https://github.com/markusmauch/mqtt-push-button-custom-integration
      • Select Integration as the category.
      • Click Add.
  2. Install the Integration:

    • After adding the custom repository, search for "MQTT Push Button" in HACS.
    • Click on the integration and select Download to install it.
  3. Configure the Integration:

    • Restart Home Assistant to load the new integration.
    • Go to Settings > Devices & Services.
    • Click Add Integration and search for "MQTT Push Button".
    • Follow the setup wizard:
      • Name: Enter the device name (e.g., Lichtschalter Flur).
      • MQTT Topic: Enter the Zigbee2MQTT topic where the contact state is published (e.g., zigbee2mqtt/Lichtschalter Flur).
      • Value Template: Enter the template to extract the contact state from the JSON payload (e.g., {{ value_json.contact }}).

Usage

Once configured, the integration will create a sensor entity in Home Assistant that detects the following events:

  • Short Push: A quick press and release.
  • Long Push: A prolonged press.
  • Double Push: Two quick presses in succession.

You can use these events in automations to trigger actions like toggling lights, activating scenes, or controlling other smart devices.

Disclaimer

This integration involves hardware modification of the Aqara contact sensor. Please proceed with caution and understand that any modification may void warranties or cause unintended behavior. The author assumes no responsibility for any damage or issues arising from the use of this integration. Use at your own risk.

Resources

Support

If you want to support my work feel free to

"Buy Me A Coffee"