All Projects → Miicroo → ha-birthdays

Miicroo / ha-birthdays

Licence: other
Birthday integration for HomeAssistant

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ha-birthdays

ha-eskom-loadshedding
Fetches loadshedding data from Eskom
Stars: ✭ 48 (+242.86%)
Mutual labels:  integration, homeassistant, custom-component
container
Custom containers for various usecases
Stars: ✭ 12 (-14.29%)
Mutual labels:  integration, homeassistant, custom-component
ha-zoom-automation
Custom Home Assistant component for Zoom. Tracks when you are connected to a Zoom call by default but may allow you to track more.
Stars: ✭ 47 (+235.71%)
Mutual labels:  integration, homeassistant, custom-component
home assistant omnik solar
Home Assistant Omnik Solar sensor component
Stars: ✭ 15 (+7.14%)
Mutual labels:  integration, homeassistant
DahuaVTO
Control Dahua VTO/VTH devices from Home Assistant
Stars: ✭ 98 (+600%)
Mutual labels:  integration, homeassistant
Appdaemon Scripts
Scripts running in Appdaemon for Homeassistant Automations
Stars: ✭ 108 (+671.43%)
Mutual labels:  homeautomation, homeassistant
panasonic smart app
Panasonic Smart App integration for Home Assistant.
Stars: ✭ 22 (+57.14%)
Mutual labels:  integration, homeassistant
Pyscript
Pyscript adds rich Python scripting to HASS
Stars: ✭ 219 (+1464.29%)
Mutual labels:  integration, homeassistant
lennoxs30
Home Assistant Lennox S30 / E30 / M30 integration
Stars: ✭ 31 (+121.43%)
Mutual labels:  integration, homeassistant
Tuya-v2-Supported-Devices
A collection of all of the known working Tuya v2 Devices
Stars: ✭ 30 (+114.29%)
Mutual labels:  integration, homeassistant
home-assistant-p2000
🚒 This component tracks P2000 emergency events in The Netherlands.
Stars: ✭ 45 (+221.43%)
Mutual labels:  homeassistant, custom-component
Home Assistant Configuration
My Home Assistant Config. For more Information visit ->
Stars: ✭ 102 (+628.57%)
Mutual labels:  homeautomation, homeassistant
Homeassistant Config
Configuration for @brianjking & @KinnaT's Home Assistant Installation
Stars: ✭ 80 (+471.43%)
Mutual labels:  homeautomation, homeassistant
Homeassistant
Example Home Assistant Configs
Stars: ✭ 168 (+1100%)
Mutual labels:  homeautomation, homeassistant
Streamdeck Homeassistant
🏠 Use the Elgato Stream Deck as Home Assistant controller. Call any available service and toggle lights or resume your music.
Stars: ✭ 69 (+392.86%)
Mutual labels:  homeautomation, homeassistant
Home Assistant Config
🏠 My Home Assistant configuration, a bit different that others :) Be sure to 🌟 this repository for updates!
Stars: ✭ 1,050 (+7400%)
Mutual labels:  homeautomation, homeassistant
Haswitchplate
LCD touchscreen for Home Automation
Stars: ✭ 666 (+4657.14%)
Mutual labels:  homeautomation, homeassistant
Homeassistant
Example Home Assistant Configs
Stars: ✭ 846 (+5942.86%)
Mutual labels:  homeautomation, homeassistant
visonic
Visonic Custom Component for integration with Home Assistant
Stars: ✭ 57 (+307.14%)
Mutual labels:  integration, homeassistant
Audi connect ha
Adds an audi connect integration to home assistant
Stars: ✭ 63 (+350%)
Mutual labels:  integration, homeassistant

Birthdays

This is a HomeAssistant component for tracking birthdays, where the state of each birthday is equal to how many days are left. All birthdays are updated at midnight.

Installation

HACS (recommended)

  1. Go to integrations
  2. Press the dotted menu in the top right corner
  3. Choose custom repositories
  4. Add the URL to this repository
  5. Choose category Integration
  6. Click add

Manual

  1. In your homeassistant config directory, create a new directory. The path should look like this: **my-ha-config-dir/custom_components
  2. Copy the contents of /custom_components in this git-repo to your newly created directory in HA

Set up

Set up the component:

# Example configuration.yaml entry
birthdays:
  - name: 'Frodo Baggins'
    date_of_birth: 1921-09-22
  - name: 'Bilbo Baggins'
    date_of_birth: 1843-09-22
  - name: Elvis
    date_of_birth: 1935-01-08
    icon: 'mdi:music'

Restart homeassistant

Entities

All entities are exposed using the format birthdays.{name}. Any character that does not fit the pattern a-z, A-Z, 0-9, or _ will be changed. For instance Frodo Baggins will get entity_id frodo_baggins, and Swedish names like Sven-Göran Eriksson will get entity_id sven_goran_eriksson.

Automation

All birthdays are updated at midnight, and when a birthday occurs an event is sent on the HA bus that can be used for automations. The event is called birthday and contains the data name and age. Note that there will be two events fired if two persons have the same birthday.

Sending a push notification for each birthday (with PushBullet) looks like this:

automation:
  trigger:
    platform: event
    event_type: 'birthday'
    action:
      service: notify.pushbullet
      data_template:
        title: 'Birthday!'
        message: "{{ trigger.event.data.name }} turns {{ trigger.event.data.age }} today!"

If you want to trigger an automation based on a specific name or age, you can use the following:

automation:
  trigger:
    platform: event
    event_type: 'birthday'
    event_data:
      name: Kalle
      # age: 40
    action:
      service: notify.pushbullet
      data_template:
        title: 'Birthday!'
        message: "{{ trigger.event.data.name }} turns {{ trigger.event.data.age }} today!"

If you want to have a notification sent to you at a specific time (instead of midnight), you can use a custom templated sensor and a time trigger. Create the sensor:

sensor:
  - platform: template
    sensors:
      next_birthday:
        friendly_name: "Next birthday"
        value_template: >
          {%- set ns = namespace(days=365) -%}
          {%- for birthday in states.birthdays -%}
            {%- set daysLeft = birthday.state | int -%}
            {%- if daysLeft < ns.days -%}
              {%- set ns.days = daysLeft -%}
            {%- endif -%}
          {%- endfor -%}
          {{ ns.days }}
        attribute_templates:
          name: >
            {%- set ns = namespace(days=365, name='') -%}
            {%- for birthday in states.birthdays -%}
              {%- set daysLeft = birthday.state | int -%}
              {%- if daysLeft < ns.days -%}
                {%- set ns.days = daysLeft -%}
                {%- set ns.name = birthday.attributes.friendly_name -%}
              {%- endif -%}
            {%- endfor -%}
            {{ ns.name }}
          age: >
            {%- set ns = namespace(days=365, age=0) -%}
            {%- for birthday in states.birthdays -%}
              {%- set daysLeft = birthday.state | int -%}
              {%- if daysLeft < ns.days -%}
                {%- set ns.days = daysLeft -%}
                {%- set ns.age = birthday.attributes.age_at_next_birthday -%}
              {%- endif -%}
            {%- endfor -%}
            {{ ns.age }}

and the automation:

automation:
  trigger:
    platform: time
    at: "19:00:00"
  condition:
    condition: state
    entity_id: sensor.next_birthday
    state: 0
  action:
    service: notify.pushbullet
    data_template:
      title: 'Birthday!'
      message: "{{ state_attr('sensor.next_birthday', 'name') }} turns {{ state_attr('sensor.next_birthday', 'age') }} today!"

Lovelace UI

I use the birthdays as a simple entity list in lovelace, given the above example I use:

# Example use in lovelace
- type: entities
  title: Birthdays
  show_header_toggle: false
  entities:
    - birthdays.frodo_baggins
    - birthdays.bilbo_baggins
    - birthdays.elvis
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].