A custom Home Assistant integration to monitor the maintenance of any device. It supports three types of maintenance monitors: Runtime, Power On Count, and Fixed Interval.
Maintaining the various devices in our homes can be challenging, especially when their usage varies greatly. Standard maintenance schedules often don't account for actual usage, leading to either overdue maintenance or unnecessary servicing. This is particularly problematic for devices with variable usage patterns, like air conditioners or water heaters. The Device Maintenance Monitor custom component for Home Assistant addresses this issue by providing a tailored maintenance reminder system based on actual device usage rather than just fixed intervals. This ensures that each device gets the attention it needs based on how much it is actually used.
- Track the last maintenance date.
- Monitor total runtime hours, power on count, or fixed interval depending on the type of monitor.
- Calculate remaining hours or counts until the device needs maintenance.
- Provide a boolean sensor indicating if the device needs maintenance.
- Include a button to reset the maintenance data.
- Air Conditioners: Different usage patterns in different rooms can result in varied maintenance needs. This integration helps track actual usage to provide accurate reminders.
- Water Filters: Monitor the amount of water passed through the filter to ensure regular maintenance and prevent unexpected breakdowns.
- Washing Machines: Track the number of times a device is used to clean filters after a set number of uses.
- Download the
device_maintenance_monitor
directory from the latest release. - Copy the
device_maintenance_monitor
directory to yourcustom_components
directory in your Home Assistant configuration directory.
- Open Home Assistant and go to HACS.
- Click on "Integrations" and then the three dots in the top right corner.
- Select "Custom repositories".
- Add the repository URL:
https://github.com/rafael-zilberman/device-maintenance-monitor-custom-component
and select the category as "Integration". - Find "Device Maintenance Monitor" in the HACS store and install it.
- Click here to add Device Maintenance Monitor to your Home Assistant
- After installation, go to Home Assistant and navigate to
Configuration
->Integrations
. - Click on
Add Integration
and search forDevice Maintenance Monitor
. - Follow the configuration flow to set up the integration:
- Select the device you want to monitor.
- Choose the type of monitor: "Runtime", "Power On Count", or "Fixed Interval".
- Depending on the monitor type, provide additional information such as:
- Interval: The duration for the "Runtime" or "Fixed Interval" monitor types.
- Count: The count for the "Power On Count" monitor type.
The Device Maintenance Monitor integration provides the following entities:
-
Sensor Entities:
sensor.<device_name>_predicted_maintenance_date
: Displays the predicted date for the next maintenance based on the device's usage.
-
Button Entities:
button.reset_maintenance
: Resets the maintenance data for the device.
-
Binary Sensor Entities:
binary_sensor.<device_name>_maintenance_needed
: Indicates whether the device needs maintenance based on the configured criteria.
Replace <device_name>
with the actual name of your device as configured in Home Assistant.
After performing maintenance on the device, press the button.reset_maintenance
to reset the maintenance data and start a new tracking period.
Another option is to reset the maintenance data is using a service call. You can call the device_maintenance_monitor.reset_maintenance
service with the following data:
service: device_maintenance_monitor.reset_maintenance
data: {}
target:
entity_id: binary_sensor.my_device_maintenance_needed
You can update the maintenance data manually by calling the device_maintenance_monitor.update_maintenance_info
service with the following data:
service: device_maintenance_monitor.update_maintenance_info
data:
last_maintenance_date: 2022-01-01
target:
entity_id: binary_sensor.my_device_maintenance_needed
You can create automations based on the entities provided by this integration. For example, send a notification when the device needs maintenance using the Home Assistant "alert" integration:
alert:
ac_maintenance_needed:
name: "AC Maintenance Needed"
done_message: "AC Maintenance has been performed"
entity_id: binary_sensor.ac_maintenance_needed
state: "on"
repeat: 60
can_acknowledge: true
skip_first: false
notifiers:
- mobile_app_your_device
You can create a dashboard to monitor the maintenance status of your devices. Here is an example of a Lovelace card to display the maintenance status of a devices using the auto-entities
card:
type: custom:auto-entities
filter:
include:
- integration: device_maintenance_monitor
domain: binary_sensor
options:
type: tile
exclude: []
sort:
method: attribute
attribute: predicted_maintenance_date
card:
type: vertical-stack
title: 'Devices'
card_param: cards
You can also use the custom card device-maintenance-monitor-card
to display the maintenance status of your devices. You can find the card template here.
type: custom:auto-entities
filter:
include:
- integration: device_maintenance_monitor
domain: binary_sensor
options:
type: 'custom:button-card'
template: card_device_maintenance
variables:
ulm_card_card_device_maintenance_force_background_color: true
exclude: []
sort:
method: attribute
attribute: predicted_maintenance_date
card:
type: vertical-stack
title: 'Devices'
card_param: cards
Contributions are welcome! If you have any ideas, feel free to open an issue or submit a pull request.
To set up a development environment, clone the repository and install the dependencies:
git clone git@github.com:rafael-zilberman/device-maintenance-monitor-custom-component.git
cd device_maintenance_monitor_custom_component
pip install -r requirements.txt
You can use Docker Compose to set up a Home Assistant development environment with the custom component.
First, ensure Docker and Docker Compose are installed on your machine.
Use the provided compose.yaml file to start the Home Assistant container with the custom component:
docker-compose -f compose.yaml up
Home Assistant instance with the component installed will be accessible at http://localhost:8123. You can now develop and test the custom component within this environment. The custom component files are mounted to the Home Assistant container, so any changes you make to the files will be reflected in the Home Assistant instance after a restart.
If you submit a pull request, please follow these guidelines:
- Fork the repository and create your branch from
dev
. - Create a new branch following the naming convention:
feature/<Feature requests issue id>-your-feature-name
orbugfix/<Bug report issue id>-your-fix-name
. - Update documentation to reflect any changes or additions (including README.md if necessary).
- Ensure your code adheres to the project's coding standards.
- Run
black .
to format your code and make sure it passes the linting checks. - Make sure to add docstrings to your functions and classes.
- Run
- Provide a clear description of the changes and the problem they solve.
- Reference any relevant issues in your pull request description.
- Be prepared to make revisions based on feedback from maintainers.
- Address PR agent AI comments before requesting a review from maintainers.
- Squash your commits before merging.
This project is licensed under the MIT License. See the LICENSE file for details.
Special thanks to the Home Assistant community for their support and contributions.
For any issues or feature requests, please open an issue on the GitHub repository.