Code Monkey home page Code Monkey logo

anniversaries's People

Contributors

beardedtinker avatar boyng avatar cchrkk avatar dependabot[bot] avatar fredrikbaberg avatar guille-mas-coll avatar hudsonbrendon avatar kernehed avatar nicolaivds avatar petersoniq avatar pinkywafer avatar reconos87 avatar repsionu avatar robweber avatar royto avatar sebrut avatar tmcarr avatar viper5000 avatar yuvalabou avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anniversaries's Issues

IT translation

Hello,
I've seen you add the german translation on the latest update. I'm not really sure how to make a pull request, but here's the italian translation if you want to add it. 🇮🇹
Thanks for this integration 👍

{
    "config": {
        "title": "Anniversari",
        "step": {
            "user": {
                "title": "Anniversari",
                "description": "Inserisci il nome sensore e configura i parametri. Altre informazioni su https://github.com/pinkywafer/Anniversaries",
                "data": {
                    "name": "Nome",
                    "date": "Prima data (yyyy-mm-dd)",
                    "icon_normal": "Icona",
                    "icon_today": "Icona quando occorre l'anniversario",
                    "days_as_soon": "Numero di giorni da considerarsi imminente",
                    "icon_soon": "Icona quando l'anniversario è imminente",
                    "date_format": "Formato data (vedi http://strftime.org/)"
                }
            }
        },
        "error": {
            "invalid_date": "La data non è valida. Inseriscine una con formato 'YYYY-MM-DD'"
        }
    },
    "options": {
        "step": {
            "init": {
                "title": "Anniversari",
                "description": "Configura i parametri del sensore. Altre informazioni su https://github.com/pinkywafer/Anniversaries",
                "data": {
                    "date": "Prima data (yyyy-mm-dd)",
                    "icon_normal": "Icona",
                    "icon_today": "Icona quando occorre l'anniversario",
                    "days_as_soon": "Numero di giorni da considerarsi imminente",
                    "icon_soon": "Icona quando l'anniversario è imminente",
                    "date_format": "Formato data (vedi http://strftime.org/)"
                }
            }
        },
        "error": {
            "invalid_date": "La data non è valida. Inseriscine una con formato 'YYYY-MM-DD'"
        }
    }
}

Can't install requirements in 0.115

2020-09-02 20:48:02 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package uuid: ERROR: Could not find a version that satisfies the requirement uuid==1000000000.0.0 (from -c /usr/src/homeassistant/homeassistant/package_constraints.txt (line 51)) (from versions: 1.30)

ERROR: No matching distribution found for uuid==1000000000.0.0 (from -c /usr/src/homeassistant/homeassistant/package_constraints.txt (line 51))

2020-09-02 20:48:02 ERROR (MainThread) [homeassistant.setup] Setup failed for anniversaries: Requirements for anniversaries not found: ['uuid'].

2020-09-02 20:50:45 ERROR (MainThread) [frontend.js.latest.202009010] http://192.168.191.88:8123/frontend_latest/chunk.4306ccd840fa2cbe0f2d.js:130:138 TypeError: this._params is undefined

Calendar Panel integration

Sorry, Fat fingered the enter key when typing out the ticket.

But I saw that hassio has a new calendar panel in which my garbage collection has already integrated, wondering if it's possible to integrate this into, that so to speak?

Cheers.

Non-recurring dates

Hi! Really like this integration as it gives an simple and easy "calendar" in my lovelace views.

I have one feature request, that is to be able to set non-recurring anniversaries.

Example:
I have anniversaries for Christmas and New Year. These always occur on the 24 or 25 (depending on the country) and New Year is always on December 31st. So this integration works great for these holidays (except that i don't care the year of this "anniversary")

But I would also like to add some other, "relative" holidays, those that can move a few days every year.
For example: Easter or the Swedish Midsummer holiday

One way would be to have a property called "absolute" that when set to "true"
=> Makes the anniversary only occur once.

Companion lovelace card

I've been looking for ways to display my list of anniversaries in lovelace, and I came across https://github.com/erlsta/homeassistant-lovelace-birthday-reminder-card, which gives what I'm looking for in terms of lovelace displays. The issue is that card hard-codes all the data into the javascript and I would prefer to use this plugin's sensors as the data source, so that I only have to define the anniversary dates once, but I could use them in both lovelace displays and automations.

My vision would be a Lovelace card that can be defined like the following and it would generate a Lovelace card like the screenshot in that repo.

type: "custom:anniversaries"
title: "Important Dates"
numberofdays: 30
entities:
  - sensor.gladys_birthday
  - sensor.grandfather_passing
  - sensor.adam_birthday
  - sensor.amanda_birthday
  - sensor.wedding_anniversary
  - sensor.peter_birthday

give the option to remove the year?

is it possible to remove the year requirement? For some of my friends bdays/anniversaries, I don't know the year and would rather not guess. I'm more interested in a reminder for how many days away it is.

Glance pop up graph

Hi, I couldn't find any forum thread for this. So sorry if this is the wrong spot.

I was wondering how I can use/modify Anniversaries in my glance card pop up. Currently it shows a graph for the last 24 hours of the day. Is there any way you can increase this to display something different? Ie. Longer period of time or something better?
screenshot 2020-02-23

Issue with dates more than a year away

Hello

I know this is an anniversary card so may be out of the scope of the project
But if a date that I'm tracking is over a year away it will show the countdown as if its the same year
For example ;

image

The countdown shows there are 322 days but that is until its one year away - ideally this would show as 687 days

Translate unit_of_measurement. Possible??

I use home assistant in another language but english. Is it possible or correct to have a translation of the unit_of_measurement?

I had like to have "dias" instead of "days".

Invalid config

The readme seem to have invalid config with the new breaking change, since the example does not work.
The issue seem to be resolved through removing platform: anniversaries, which is no longer needed with the new setup.

anniversaries:
  sensors:
  - name: Shakespeare's Birthday
    date: '1564-04-23'
  - name: Shakespeare's Wedding Anniversary
    date: '1582-11-27'

Atributtes and dates on anniversary day

hi,with the last upgrade i think u forgot the underscore on the new attributes,I've also seen that if it's birthday, it will mark one year less,so i edit the sensor.py changing the date format to my country too,
changes are on lines 14/15 and 70 for my format date
thanks for your work:
i tried to fix the problem with years on birthday day but i dont be able,i hope you can fix this issues in a next update,thanks again

"""Platform for sensor integration."""

import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_NAME,
)

from homeassistant.helpers.entity import Entity
from datetime import datetime, date, timedelta

CONF_DATE = "date"
ATTR_YEARS_NEXT = "years_at_next_anniversary"
ATTR_YEARS_CURRENT = "current_years"
ATTR_DATE = "date"
CONF_ICON_NORMAL = "icon_normal"
CONF_ICON_TODAY = "icon_today"
CONF_ICON_TOMORROW = "icon_tomorrow"

DEFAULT_ICON_NORMAL = "mdi:calendar-clock"
DEFAULT_ICON_TODAY = "mdi:calendar-star"
DEFAULT_ICON_TOMORROW = "mdi:calendar"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_DATE): cv.date,
vol.Required(CONF_NAME): cv.string,
vol.Optional(CONF_ICON_NORMAL, default=DEFAULT_ICON_NORMAL): cv.icon,
vol.Optional(CONF_ICON_TODAY, default=DEFAULT_ICON_TODAY): cv.icon,
vol.Optional(CONF_ICON_TOMORROW, default=DEFAULT_ICON_TOMORROW): cv.icon,

})

TRACKABLE_DOMAINS = ["sensor"]

async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Setup the sensor platform."""
async_add_entities([anniversaries(config)],True)

class anniversaries(Entity):
def init(self, config):
"""Initialize the sensor."""
self._name = config.get(CONF_NAME)
self._date = config.get(CONF_DATE)
self._icon_normal = config.get(CONF_ICON_NORMAL)
self._icon_today = config.get(CONF_ICON_TODAY)
self._icon_tomorrow = config.get(CONF_ICON_TOMORROW)
self._icon = self._icon_normal
self._years_next = 0
self._years_current = 0
self._state = 0

@property
def name(self):
    """Return the name of the sensor."""
    return self._name

@property
def state(self):
    """Return the name of the sensor."""
    return self._state

@property 
def device_state_attributes(self):
    """Return the state attributes."""
    res = {}
    res[ATTR_YEARS_NEXT] = self._years_next
    res[ATTR_YEARS_CURRENT] = self._years_current
    res[ATTR_DATE] = datetime.strftime(self._date,"%d-%m-%Y")
    return res

@property
def icon(self):
    return self._icon

async def async_update(self):
    today = date.today()
    nextDate = date(today.year, self._date.month, self._date.day)
    daysRemaining = 0
    years = today.year - self._date.year
    if today < nextDate:
        daysRemaining = (nextDate - today).days
    elif today == nextDate:
        daysRemaining = 0
    elif today > nextDate:
        nextDate = date(today.year + 1, self._date.month, self._date.day)
        daysRemaining = (nextDate - today).days
        years = years + 1

    if daysRemaining == 0:
        self._icon = self._icon_today
    elif daysRemaining == 1:
        self._icon = self._icon_tomorrow
    else:
        self._icon = self._icon_normal
    self._state = daysRemaining
    self._years_next = years 
    self._years_current = years - 1

'datetime.date' object has no attribute 'date'

Getting the following exception in my logs for a person who just had a birthday yesterday.

2020-02-17 08:55:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.redacteds_birthday fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
    await self.async_update()
  File "/config/custom_components/anniversaries/sensor.py", line 104, in async_update
    if today < self._date.date():
AttributeError: 'datetime.date' object has no attribute 'date'

The person's bday is listed in my yaml file as follows:

    - name: redacteds Birthday
      date: "02-16"

Thoughts?

Weekly Digest (19 July, 2020 - 26 July, 2020)

Here's the Weekly Digest for pinkywafer/Anniversaries:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there was 1 stargazer.
bonelifer
You are the star! 🌟


RELEASES

Last week there were no releases.


That's all for last week, please 👀 Watch and Star the repository pinkywafer/Anniversaries to receive next weekly updates. 😃

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. 📆

Integration screen

When using the integration method for configuration dates, each date is its own line in the configuration screen. It would benice if this worked like other integrations where each date was just an icon on the line. (like mqtt, ecobee, etc)

Add custom entity_id prefix

It would be great to have a property next to the date, that could specify a custom label. Instead of using the entity id.

I currently have a this setup:

/configuration.yaml

homeassistant:
  customize: !include_dir_merge_named "yaml/customizations/"

anniversaries: !include "yaml/root/anniversaries.yaml"

/yaml/root/anniversaries.yaml

sensors:
  - name: "anniversary_event_first_may"
    date: '2000-05-01'
  - name: "anniversary_may_the_forth"
    date: '1977-05-04'
  - name: "anniversary_event_christmas"
    date: '2000-12-24'
  - name: "anniversary_event_newyear"
    date: '1999-12-31'

/yaml/customizations/anniversaries.yaml

sensor.anniversary_event_first_may:
  friendly_name: Första maj
sensor.anniversary_may_the_forth:
  friendly_name: May the 4th be with you
sensor.anniversary_event_christmas:
  friendly_name: Jul
sensor.anniversary_event_newyear:
  friendly_name: Nyår

I would not be needing the customizations file, if only I could set a label directly on the sensor.
It would help a lot but not having to make sure that the files are in sync, whenever I add a new anniversary.
Is this possible to implement?

Allow monthly/weekly recurrence

More of a feature request. Would be useful to be able to select whether an "anniversary" should reoccur on a weekly / monthly / yearly basis. This would allow one to use the add-on for weekly events such as garbage collection, monthly such as payday or yearly such as anniversaries.

One day too many?

I just set up "Days to Christmas" and it reports 233 days. I'm guessing this is including Christmas Day itself? That's not really how many more days there is to go until Christmas Day really is there.
Today's date = 6th May so 25 days left of May. Plus there is of course 30 days in June, 31 in July, 31 in August, 30 in September, 31 in October and 30 in November. Then just 24 days to go in December until Christmas Day. 25+30+31+31+30+31+30+24 = 232 days left until Christmas Day.

Bug? Mis-calculation?

0.109 has deprecation warning about .translations folder

Upgraded to 0.109 and this issue showed up in my log:

 Log Details (WARNING)

Logger: homeassistant.helpers.translation
Source: helpers/translation.py:206
First occurred: 3:56:35 PM (10 occurrences)
Last logged: 3:56:40 PM

• anniversaries: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this 

Feb 29th BUG

February 29th is not repeatable every year giving
ValueError: day is out of range for month

Error in years

You need to add 1 to the years

years at next anniversary 59
current years 58
date 19/05 1961
weeks remaining -3097
half anniversary date 19/11 1961
days until half anniversary 0

unable to change the date format.

I have a list of BD like this
anniversaries:
sensors:

  • name: Tommaso Tenconi
    date: '01/10/2019'
    date_format: '%d/%m/%Y'

Could you help me?

is a way to chang the default date tipe?

Typo

First Date (yyyy-mm-dd) or (mm-yy) if year is unknown is shown on the setup box, should be (mm-dd) ?

Configuration option for unit_of_measurement

Add a configuration option to customize the unit_of_measurement.
May be possible to pull from translations file.
Not an ideal solution. Better would be to have 'days' translated by the front-end depending on user settings, but as that is not currently possible, give the option to modify the unit_of_measturement in the config rather than needing to use a customize.

Half Anniversary Attributes

Your integration has been very helpful, thank you for creating and sharing it.

I have a few things for your consideration I wanted to share.

I've been researching how to do this w/ a template in a card but I can't seem to find a straight forward way to do it with the custom cards I've looked into.

secondaryinfo-entity-row Doesn't support jinaj2 templates or timestamp formatting
lovelace-multiple-entity-row Didn't allow me to combine multiple attributes/text on a a row

I have not gone down the path of the other custom card/custom entity value cards yet. The above is about as far as I was wanting to go down the custom card rabbit hole.

That said, what I am trying to do is

  1. Calculate and display info about the half-birthday for a birthday (days-til, date of). (We look for any opportunity to eat more cake). Its simply 6 months before the actual birthday.
  2. Show the day of the week for the coming date.

I could spawn a template sensor and calculate these in the new entity but I felt others could benefit from them being included. And I try to avoid chains of entities.

In addition to your card I display similar info for upcoming events in my google calendar. For that I used a template sensor to calculate and expose the days-til and then schedule a daily automation to update. If you were looking for other enhancements perhaps there's a way you can refer to an existing sensor to create your sensors in addition to your native events.

Thanks!

Make date templateable

I have a sensor based off a input_datetime that changes date/time every 10 days. I wanted to use this to show the days remaining from that sensor value. This possible; or is the only acceptable date format “YYYY-MM-DD”?

After upgrade it is not working

Hello,

I used this cool stuff until today. I upgraded it to latest version and I'm sad now :(

Log Details (ERROR)
Thu Nov 28 2019 08:50:11 GMT+0100 (Central European Standard Time)
Error while setting up platform anniversaries
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/anniversaries/sensor.py", line 33, in async_setup_platform
    async_add_entities([anniversaries(hass, discovery_info)], True)
  File "/config/custom_components/anniversaries/sensor.py", line 44, in __init__
    self._name = config.get(CONF_NAME)
AttributeError: 'NoneType' object has no attribute 'get'

I have 3 sensor, each of them throw this message.

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.