pinkywafer / anniversaries Goto Github PK
View Code? Open in Web Editor NEWAnniversary Countdown Sensor for Home Assistant
License: MIT License
Anniversary Countdown Sensor for Home Assistant
License: MIT License
Here's the Weekly Digest for pinkywafer/Anniversaries:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there was 1 stargazer.
⭐ bonelifer
You are the star! 🌟
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. 📆
We can currently change the icon used based on the days_as_soon and icon_today/soon
Is it possible to adjust this so it also changed the icon colour?
Is the date supposed to show up as an attribute?
HA VM 0.108.8
Anniversaries is 2.0.3
I have the important days shown in a card with number of days left, and instad of it showing 'dage' in danish, it's showing days.
Is that on purpose or is it a bug, or a setup problem?
Hi,
Can someone help me to make an automation, for a general announcement everytime the anniversaries module reach 0?
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”?
I have added my own birthday and it came up that I'm 26 but I am actually 25
February 29th is not repeatable every year giving
ValueError: day is out of range for month
attribution should be in the sensors, but was never initially included as an oversight.
reminded by @yuvalabou in #79
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
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
I have added a configuration option. I would be very grateful if anyone could please supply translations for their languages.
related to: #34
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?
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
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 ;
The countdown shows there are 322 days but that is until its one year away - ideally this would show as 687 days
Hi,
How can I used translations files ?
Thanks
First Date (yyyy-mm-dd) or (mm-yy) if year is unknown is shown on the setup box, should be (mm-dd) ?
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.
HA now allows you to have a custom icon for Integrations page.
All you need is two files and a quick PR, see https://github.com/home-assistant/brands
In 0.115b0 to b2 it is giving up a config error so they had changed something and broke aniversaries.
Hi,
Is it possible to show entries only before a certain date, so birthdays 5 days before or something like that?
formatting the sensor to allow more convinient look.
something like
"days until {days}"
or
"{days} more days"
Options flow has changed in HA0.107
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
Somewhere in the 0.104.x or 0.105.x I started getting this message in my logs. Did I miss something in my config during an upgrade or did recent HA break anniversaries?
Hello since the update 3.0.0 I encounter problems, indeed, it does not show me any more the remaining days but a yellow icon with a triangle in it.
Works in 2.2.0
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?
I have a list of BD like this
anniversaries:
sensors:
Could you help me?
is a way to chang the default date tipe?
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?
requested on youTube
can anyone help?
@SebRut
@cherokee93
@Reconos87
@kernehed
@NicolaiVdS
@yuvalabou
@Guille-Mas-Coll
@petersoniq
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.
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?
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
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!
When I bought it up in the discord they said you might have to remove that from the setup.py
It would be nice to be able to translate the unit to as "days" is pretty much the only thing visible most of the time
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.
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)
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
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.
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.
last update breaking homeassistant. missing comma delimiters in json data
looking for dependancies?
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".
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'
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.
Hi here are the French translation of Anniversaries, I hope it help someone.
Thank you
fr.json.zip
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'"
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.