Code Monkey home page Code Monkey logo

anniversary's People

Contributors

amaximus avatar cyrosy avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

resomnus cyrosy

anniversary's Issues

"Event Type" - using "state_attr"

I am trying to set up an anniversary list to coincide with our state and national holidays, which I have created as independent sensors using Calendarific. This way the holiday dates are always accurate, because it would pull the current information from the api that Cakenarific uses.

Here is the code I am trying to run, but the sensor: sensor.holidays does not contain any data:

  • platform: anniversary
    name: holidays
    multiple: true
    anniversaries:
    • event: '{{state_attr("binary_sensor.new_year_s_day2", "friendly_name")}}'
      date: '{{state_attr("binary_sensor.new_year_s_day2", "date")}}'
      icon: mdi:part-popper

Calendarific Created sensor attributes:

date: '2022-01-01'
description: >-
New Year's Day is the first day of the Gregorian calendar, which is widely
used in many countries such as the USA.
attribution: Data provided by calendarific.com
unit_of_measurement: Days
friendly_name: New Year's Day
icon: mdi:calendar-blank

Multiple events not shown in custom button-card

Hi! Great idea! Thanks for creating this.

I have 0.2.2 version installed but I can't see in the button-card to events that will happen the same day.

That's what I have in configuration.yaml:

  • platform: anniversary
    name: anniversary_events
    anniversaries:
    • event: 'Inés y Anna'
      date: '2008-10-07'
      icon: mdi:cake-variant
    • event: 'Test-Test'
      date: '2008-10-07'
      icon: mdi:cake-variant

And that's the custom button-card (it is the one you published as an example):

type: custom:button-card
size: 30px
styles:
label:
- font-size: 90%
card:
- height: 80px
icon:
- color: var(--paper-item-icon-color)
grid:
- position: relative
custom_fields:
notification:
- background-color: |
[[[
if (states['sensor.anniversary_events'].state > 1)
return "var(--light-primary-color)";
return "var(--accent-color)";
]]]
- border-radius: 50%
- position: absolute
- left: 62%
- top: 10%
- height: 20px
- width: 20px
- font-size: 9px
- line-height: 20px
custom_fields:
notification: |
[[[ return states['sensor.anniversary_events'].state ]]]
label: |
[[[
var label = states['sensor.anniversary_events'].attributes.first_event_name
return label.replace("|","
");
]]]
color_type: icon
show_label: true
show_name: false
entity: sensor.anniversary_events

Thanks in advance for your help.

Two events on different start years, but the same month and day only the first one shows.

In my event list have have two people listed who share a birthday
eg

` - event: 'Person 1'
date: '1982-05-13'
icon: mdi:cake-variant
type: 'birthday'

- event: 'Person 2'
  date:  '2003-05-13'
  icon:  mdi:cake-variant
  type:  'birthday' `

However using
{{state_attr('sensor.events','events')|list}}

Only returns person 2 and not both. Obviously as they have different birth years I would prefer both so I know what birthday cards I need. We have 23 nephews and nieces so it would be helpful, not to miss any.

event type

Hi. Is it possible to do below? I want to add type for the anniversary so when i have my button card i can use entity_picture and change the picture based on if state is equal to birthday or new year for example.
sensor:
platform: anniversary
name: events
multiple: true
anniversaries:
- event: 'Jasons birthday'
date: '1987-06-22'
type: birthday
- event: 'Johannas birthday'
date: '1991-10-18'
type: birthday
- event: 'new year'
date: '12-31'
type: 'new year'

The sensor shows nothing

Is this add-on still in development? The sensor shows nothing. I have HA version 2022.10 with example code. State and attributes are empty.

sensor:
  - platform: anniversary
    name: events
    multiple: true
    anniversaries:
      - event: 'Doug birthday'
        date: '2000-1-15'
      - event: 'Steve Butabi'
        date: '2000-09-15'
        icon: mdi:cake-variant
      - event: 'Chazz birthday'
        date: '9-15'
        icon: mdi:cake-variant
      - event: 'Frank the tank'
        date: '1998-8-18'

feature request: Ability to define a type field

Thank you very much for this useful integration.

I currently have Birthdays and Anniversaries in the set up and use a different icon for each, however this is not included in the events list, so I can not include when outputting the list of upcoming events using a template.

Ideally I would like to be able to define a type field to use to condition the output easily for notifications on my morning schedule like

Nick's 52nd birthday in 4 days, Nick and Jeannnette's 25th wedding anniversary in 39 days.

and if possible include the type and the icon in the events list on the sensor attributes.

Not working with Home Assistant Core 2023.06.0

After the update it stopped working giving the following error:

ButtonCardJSTemplateError: TypeError: Cannot read properties of undefined (reading 'attributes') in 'var label = states['sensor.events'].attributes.first_event_name return label.replace("|","<br>")...'
tap_action:
  action: more-info
type: custom:button-card
group_expand: false
hold_action:
  action: none
double_tap_action:
  action: none
layout: vertical
size: 30px
color_type: icon
show_name: false
show_state: false
show_icon: true
show_units: true
show_label: true
show_entity_picture: false
show_live_stream: false
card_size: 3
styles:
  label:
    - font-size: 90%
  card:
    - height: 80px
  icon:
    - color: var(--paper-item-icon-color)
  grid:
    - position: relative
  custom_fields:
    notification:
      - background-color: |
          [[[
            if (states['sensor.events'].state > 1)
              return "var(--light-primary-color)";
            return "var(--accent-color)";
          ]]]
      - border-radius: 50%
      - position: absolute
      - left: 62%
      - top: 10%
      - height: 20px
      - width: 20px
      - font-size: 9px
      - line-height: 20px
custom_fields:
  notification: |
    [[[ return states['sensor.events'].state ]]]
label: |
  [[[
    var label = states['sensor.events'].attributes.first_event_name
    return label.replace("|","<br>");
  ]]]
entity: sensor.events
default_color: var(--primary-text-color)
color_off: var(--paper-item-icon-color)
color_on: var(--paper-item-icon-active-color)
lock:
  enabled: false
  duration: 5
  unlock: tap

trying to reuse example of button card

Thanks for this integration ,
I'd like to add the example button card to my ui ,
i actually copy paste it as is:

type: custom:button-card
size: 30px
styles:
  label:
    - font-size: 90%
  card:
    - height: 80px
  icon:
    - color: var(--paper-item-icon-color)
  grid:
    - position: relative
  custom_fields:
    notification:
      - background-color: >
          [[[
            if (states['sensor.events'].state > 1)
              return "var(--light-primary-color)";
            return "var(--accent-color)";
          ]]]
      - border-radius: 50%
      - position: absolute
      - left: 62%
      - top: 10%
      - height: 20px
      - width: 20px
      - font-size: 9px
      - line-height: 20px
custom_fields:
  notification: >
    [[[ return states['sensor.events'].state ]]]
label: >
  [[[
    var label = states['sensor.events'].attributes.first_event_name
    return label.replace("|","<br>");
  ]]]
color_type: icon
show_label: true
show_name: false
entity: sensor.events

getting error:

ButtonCardJSTemplateError: TypeError: Cannot read properties of undefined (reading 'attributes') in 'var label = states['sensor.events'].attributes.first_event_name return label.replace("|","<br>")...'
tap_action:
  action: more-info
type: custom:button-card
....

anniversary: Error on device update!

  • Anniversary sensor for upcoming events for Home Assistant version 0.0.1
  • Home Assistant CORE 2021.8.8
  1. installed Anniversary via HACS
  2. manually added the config below to my configuration.yaml file
sensor:
  - platform: anniversary
    name: Anniversarys
    date_format: '%A %d %B %Y'
    multiple: true
    anniversaries:
      - event: 'name1'
        date: '1979-5-22'
        icon: mdi:face-man
      - event: 'name2'
        date: '2007-1-1'
        icon: mdi:face-man-outline

after a restart of HA the following appears in the log:

Logger: homeassistant.components.sensor
Source: custom_components/anniversary/sensor.py:57
Integration: Sensor (documentation, issues)
First occurred: 9:11:11 AM (1 occurrences)
Last logged: 9:11:11 AM

anniversary: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 646, in async_device_update
    await task
  File "/config/custom_components/anniversary/sensor.py", line 149, in async_update
    anni_date_p = _get_anniversary_date(self, i, today_p.year)
  File "/config/custom_components/anniversary/sensor.py", line 57, in _get_anniversary_date
    mydate_p = datetime.strptime(self._anniversaries[i]['date'], self._date_format)
  File "/usr/local/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.9/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '1979-5-22' does not match format '%A %d %B %Y'

4 anniversaries visible

Hi, I have not found any mistake but I would like to ask whether it would not be added to integration see the attributes of the entity next 4 anniversaries. Currently, only the first is visible. thank you

no card display

hello, I put the card as an example, with a birthday test on 2/09 but the card is not displayed. However I put this in the map:

Sensor.yaml

  • platform: anniversary
    name: events
    multiple: true
    anniversaries:
    • event: "Schumi"
      date: "1969-09-23"
    • event: "Quentin"
      date: "1999-09-24"
      icon: mdi:cake-variant
    • event: "Chazz birthday"
      date: "2000-09-02"
      icon: mdi:cake-variant
    • event: "Frank the tank"
      date: "1998-8-18"

Card:

type: conditional
conditions:

  • entity: binary_sensor.event_in_15d
    state: 'on'

in edit mode, the card is present, with the birthday, but in normal mode, it disappears
What is the cause ?
thanks.

Create schedule

I want to create event every week, month. How I can do it?

Incorrect value for

I have an event as follows

- platform: anniversary
  name: events
  multiple: true
  items: 3
  anniversaries:
    - event: 'Jeannette'
      date: '1970-01-02'
      icon: mdi:cake-variant
      type: birthday

However the value for the age at next birthday is currently showing as 51, when it should be 52. I suspect this might be to do with the fact the birthday is in the following year, as the other two birthday ages which are in December are showing correctly.

first_event_name: Christa
first_event_in: 15
first_event_on: '2021-12-25'
anniversary: 76
events:
  - event: Christa
    event_in: '15'
    event_on: '2021-12-25'
    anniversary: '76'
    type: birthday
    icon: mdi:cake-variant
  - event: Stephen
    event_in: '16'
    event_on: '2021-12-26'
    anniversary: '60'
    type: birthday
    icon: mdi:cake-variant
  - event: Jeannette
    event_in: '23'
    event_on: '2022-01-02'
    anniversary: '51'
    type: birthday
    icon: mdi:cake-variant
friendly_name: events
icon: mdi:cake-variant

Anniversary value miscalculated

I have events configured like this:

platform: anniversary
name: events
multiple: true
anniversaries:
  - event: 'Name'
    date: '1998-10-9'

The card properly shows up in the UI. When I open the card and also open attributes, it shows the details. The last line shows Anniversary: 22 and I guess this is the number of years since the original event. Shouldn't that be 23 in my example?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.