This repository contains a blueprint for toggling an alarm script in Home Assistant and a UI card for setting and displaying the alarm state.
-
This blueprint creates a script that toggles the next alarm on your device, either setting or canceling it based on its current state and the label.
Note:
Due to companion app limitations, this will only work with the 'next_alarm' sensor. If an alarm is set after the 'next_alarm' without a label, it will break the script.
Prerequisites:
-
The Home Assistant companion app must be installed.
-
The 'next_alarm' Sensor must be active.
-
The Sleep as Android app must be installed and used as your alarm.
-
- Create an input datetime helper.
- Create a timer helper.
Alternatively, you can use the provided YAML configuration to set up these entities along with a binary sensor: alarm_entities.yaml
To find the next_alarm
and notify
entities required by the blueprint, follow these steps:
- Install the Home Assistant Companion App on your mobile device from the App Store (iOS) or Google Play Store (Android).
- Open the app and go to App Configuration.
- Ensure that the sensors are enabled under App Configuration > Manage Sensors.
- Look for the
Next Alarm
sensor. This is typically named something likesensor.phone_next_alarm
.- On Android: This sensor is automatically created by the companion app.
- On iOS: You may need to configure the companion app to track alarms.
- Look for the
notify
entity for your device. It is usually named something likenotify.mobile_app_<your_device_name>
. - Note down these entity IDs as they will be required when setting up the blueprint.
- Open your Home Assistant instance and navigate to Configuration > Blueprints.
- Click on "Import Blueprint".
- Click the link below to import the blueprint:
Once installed:
- Create a script using the blueprint, using the created helpers.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (`git checkout -b feature/your-feature-name`).
- Make your changes and commit them (`git commit -am 'Add new feature'`).
- Push to the branch (`git push origin feature/your-feature-name`).
- Create a new Pull Request.
For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for details.