can’t get the friendly_name to work
if I take the name: out of the config i get this
and nothing show up in calendar
putting name back in I see the name in the config not the friendly_name
can’t get the friendly_name to work
if I take the name: out of the config i get this
and nothing show up in calendar
putting name back in I see the name in the config not the friendly_name
Can you try updating to the latest release version, 0.0.4, which should fix this issue?
Yes, those were the lines
I have release version 0.0.5 now.
This has one new feature and one fix.
It will determine if an event is all-day as follows:
This may sometimes be incorrect (e.g. due to time zones or daylight saving). In this case you can override the default handling by using the new all_day option for entities, for example:
calendar:
- platform: entities_calendar
calendars:
- name: Test
entities:
- entity: sensor.not_allday
name: Not All Day
all_day: false
- entity: sensor.allday
name: All Day
all_day: true
If any entities or their states or attributes are missing (unavailable or None) they will be filtered out until they are available.
I’m using a modified version of mf_social’s date_countdown technique to produce “countdown sensors” that look like this:
The sensor’s state
shows the number of days remaining until the event (John’s birthday). “Days remaining” is a very handy value but it’s not the timestamp your Entities Calendar integration needs to use this sensor (plus the sensor lacks a timestamp device_class).
What this countdown sensor does have is a date
attribute that could be used to represent an all-day event. However, I’ve been unable to find the correct combination of options to make it work. For example, I tried this:
start_time:
timestamp_attribute: date
but that failed to work. I then added this:
end_time:
timestamp_attribute: date
but the combination made no improvement nor did adding all_day: true
.
My guess is what I’m attempting to do (use the sensor’s date
attribute to represent an all-day event) is not currently supported. Or is there some successful combination I haven’t tried?
FWIW, I have control over the countdown sensor’s design so I could easily swap the values in state
and date
(i.e. the state would hold the event’s date and an attribute would report the remaining days until the event date) plus add a device_class: timestamp
.
Although it would satisfy the needs of Entities Calendar, it would eliminate the convenience of seeing the countdown in the States column (and bury it within Attributes). Not horrible but awkward considering it’s supposed to be a countdown sensor.
What would be handy is a dedicated option to specify which attribute to use in order to create an all-day event.
think you have to have the
timestamp_attribute:
in a right time format
“YYYY-MM-DD HH:MM:SS”
With that example, the date attribute appears to be the date they were born, rather than their next birthday. It looks like there is also a nextoccur attribute, which looks like the one you would need, so:
start_time:
timestamp_attribute: nextoccur
end_time:
timestamp_attribute: nextoccur
should do the trick.
You shouldn’t need to worry about the timestamp format, entities_calendar works OK with date-only timestamps.
Thanks! Came back to say that, after some experimentation, it occurred to me that it can’t assume anything about a given date (like, it’s a birthday so it recurs every year). So, duh, just specifying a birth date won’t make it magically appear every year in the Calendar view.
I proved that to myself using a simple Template Sensor like this:
event_birthday_ed:
friendly_name: "Ed's birthday"
value_template: "2020-08-05"
device_class: "timestamp
That automatically appears in the Calendar view, as an all-day event, using this:
calendar:
- platform: entities_calendar
calendars:
- name: Birthday
entities:
- entity: sensor.event_birthday_ed
OK, so now that’s clear in my mind, it’s clear I have to use nextoccur
.
I don’t mean to sound lazy and ungrateful but it would be nice if there was a single option to specify an all-day event, based on a single attribute, as opposed to pointing two options (start_time
and end_time
) to the same attribute. For example, specifying just start_time
alone, without an end_time
, would default to creating an all-day event. This would be all that’s needed to do the trick:
start_time:
timestamp_attribute: nextoccur
I’ve checked the logic and, you shouldn’t need the end_time option if you are creating all-day events which only cover a single day. If the end_time option is not present, it just uses the same settings as for start_time. Have you tried with just start_time defined?
Not yet but I will (later; on mobile now and on the run). Thanks again!
Hi Steven,
Can you show an example how we can set a date entry to have it occurred on a yearly basis? I have tried your suggested config setup buy it is not working when I set the ‘nextoccur’ as a timestamp_attribute as per your suggestion. Here a copy of my config
sensor:
- platform: template
sensors:
birthday_lisa:
friendly_name_template: Lisa's Birthday
value_template: '2020-11-09'
device_class: timestamp
calendar:
- platform: entities_calendar
calendars:
- name: Key Dates
#icon: 'mdi:cake-variant'
entities:
- entity: sensor.birthday_lisa
name: "Lisa's Birthday"
all_day: true
#start_time:
# timestamp_attribute: nextoccur
Thanks for your help.
You can use something like this:
sensor:
- platform: template
sensors:
birthday_lisa:
friendly_name: "Lisa's Birthday"
device_class: timestamp
value_template: >
{% set bday_lisa = {
"thisyear": strptime(now().year | string + '1109', '%Y%m%d'),
"nextyear": strptime((now().year+1) | string + '1109', '%Y%m%d')
} %}
{% if (bday_lisa.thisyear | as_timestamp() > now() | as_timestamp()) %}
{{ bday_lisa.thisyear }}
{% else %}
{{ bday_lisa.nextyear }}
{% endif %}
When the current date is before the birthday, the sensor value will be this year, if not then next year’s birthday
Thanks Rom, appears to work very well. Smart use of template scripting
Kudos to you. Grateful for your help/
Hello, strange but I get 4 hours back on calendar.
Sensor template:
- platform: template
sensors:
event_appointments_echo:
friendly_name: "Vlad Lenox Hill Echo"
value_template: "2021-04-09"
device_class: "timestamp"
attribute_templates:
start_time: '2021-04-09 09:25:00'
end_time: '2021-04-09 10:25:00'
- platform: entities_calendar
calendars:
- name: Appointments
entities:
- entity: sensor.event_appointments_echo
all_day: false
start_time:
timestamp_attribute: start_time
end_time:
timestamp_attribute: end_time
In “Developer Tools” time is correct:
But on Calendar:
Any suggestions? What I’m doing wrong?
I did study your calendar.py file and after adding “-04:00” to start_time and end_time everything is good. Solved
Is it possible to dynamically create the name? I’m pulling my last 20 cards from ClickUp and trying to get them in a calendar but no matter what I do, it won’t actually evaluate the expression. I’ve tried all sorts of combinations like below, but the name is always just whatever I put in (in this case: {{ state_attr(‘sensor.clickup’,‘name’) }}). It evaluates fine in Developer tools, just not here. Any ideas?
I’m pretty new to this so this is probably something obvious.
calendar:
- platform: entities_calendar
calendars:
- name: Entities
entities:
- entity: sensor.clickup
name: "{{ state_attr('sensor.clickup','name') }}"
start_time:
timestamp_in_state: true
end_time:
timestamp_in_state: true
Please forgive what is probably a stupid question but where exactly (which .yaml) do I add this “calendar” data ??
calendar:
- platform: entities_calendar
calendars:
name: My Entities
entities:
- sensor.first_entity
- sensor.second_entity
- sensor.third_entity
I have installed the integration thru HACS (0.08) and restarted HA, but I can find no evidence of this integration and have no idea where to add any configs
I tried adding this as a sensor:
- platform: entities_calendar
calendars:
- name: Appointments
entities:
- entity: sensor.event_appointments_echo
all_day: false
start_time:
timestamp_attribute: start_time
end_time:
timestamp_attribute: end_time
But the validation failed:
Platform error sensor.entities_calendar - No module named 'custom_components.entities_calendar.sensor'
Is there a getting started guide for dummies like me
OK, firat part solved:
configuration.yaml:
calendar: !include my_calendar.yaml
my_calendar.yaml:
- platform: entities_calendar
calendars:
- name: Bin Collection
entities:
- entity: sensor.bin_collection_general
name: General Waste Collection
- entity: sensor.bin_collection_recycling
name: Recycling Collection
- entity: sensor.bin_collection_garden
name: Garden Waste Collection
- name: Other Calendar
entities:
- entity: sensor.date
name: Today
And then a new menu “Calendar” appears in the left panel.
Hmm, there does not seem to be any activity with this thread, is this integration still active / supported ?
How can I create calendar entities from a json source ?
I have a REST sensor that returns the Refuse collection in the following format:
{
"20220509": [ "GARDEN" ],
"20220514": [ "RECYCLING", "REFUSE" ],
"20220519": [ "RECYCLING" ],
"20220523": [ "GARDEN" ],
"20220526": [ "RECYCLING" ]
}
I know how to iterate through dictionaries using templating, but how would I go about converting multiple calendar entities from a sensor / template that returns a JSON object as per the sample above ?