Skip to content

View your medication from Medisafe Cloud in Home Assistant

License

Notifications You must be signed in to change notification settings

c99koder/ha-medisafe

Repository files navigation

Medisafe

GitHub Release GitHub Activity License

pre-commit Black

hacs Project Maintenance

View your medication from Medisafe Cloud in Home Assistant. This integration adds sensors for today's upcoming, taken, skipped, and missed doses, plus sensors for each medication's remaining pills. The integration also provides a calendar of upcoming events and a to-do list of medication that need to be refilled.

example

Installation

Install with HACS (recommended)

  1. Add https://github.com/c99koder/ha-medisafe as a custom repository as Type: Integration
  2. Click install under "Medisafe" in the Integration tab
  3. Restart Home Assistant
  4. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Medisafe"

Install manually

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called medisafe.
  4. Download all the files from the custom_components/medisafe/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Medisafe"

Using your HA configuration directory (folder) as a starting point you should now also have this:

custom_components/medisafe/sensor.py
custom_components/medisafe/__init__.py
custom_components/medisafe/api.py
custom_components/medisafe/manifest.json
custom_components/medisafe/translations
custom_components/medisafe/translations/en.json
custom_components/medisafe/const.py
custom_components/medisafe/config_flow.py

Configuration is done in the UI

Data is updated every 15 minutes, which can be adjusted by changing SCAN_INTERVAL in __init__.py.

The sample card above was built using auto-entities:

type: horizontal-stack
cards:
  - type: entity
    entity: sensor.medication_taken
    name: Taken
  - type: entity
    entity: sensor.medication_missed
    name: Missed
  - type: entity
    entity: sensor.medication_dismissed
    name: Skipped
type: custom:auto-entities
filter:
  include:
    - attributes:
        integration: medisafe
  exclude:
    - entity_id: sensor.medication_*
    - entity_id: calendar.*
    - entity_id: todo.*
sort:
  method: state
  numeric: true
card:
  type: glance
  title: Remaining Medication
  columns: 4

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Credits

This project was generated from @oncleben31's Home Assistant Custom Component Cookiecutter template.

Code template was mainly taken from @Ludeeus's integration_blueprint template

License

Copyright (C) 2024 Sam Steele. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.