gadgetchnnel / entities_calendar Goto Github PK
View Code? Open in Web Editor NEWA custom component for Home Assistant to allow regular entities to be used as a calendar
A custom component for Home Assistant to allow regular entities to be used as a calendar
Log Details (ERROR)
Logger: homeassistant.helpers.entity
Source: custom_components/entities_calendar/calendar.py:287
First occurred: 12:29:38 AM (1 occurrences)
Last logged: 12:29:38 AM
Update for calendar.pet_feedings failsTraceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 263, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 456, in async_device_update await self.hass.async_add_executor_job( File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/entities_calendar/calendar.py", line 173, in update self.data.update() File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper result = method(*args, **kwargs) File "/config/custom_components/entities_calendar/calendar.py", line 287, in update self.event = events[0] IndexError: list index out of range
I have been seeing this error in the last few updates and the entities are not displaying I'm my calendar any more. Do you have any insight on what might be causing it?
The issue of #1 AttributeError: 'NoneType' object has no attribute 'strftime'
is coming by pretty frequently in my logs (running HASS 0.110.7
or 0.111.0
).
Full traceback:
2020-06-10 17:37:35 ERROR (MainThread) [homeassistant.helpers.entity] Update for calendar.trash fails
Traceback (most recent call last):
File "/srv/hass/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/srv/hass/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 472, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/hass/.homeassistant/custom_components/entities_calendar/calendar.py", line 168, in update
self.data.update()
File "/srv/hass/lib/python3.8/site-packages/homeassistant/util/__init__.py", line 239, in wrapper
result = method(*args, **kwargs)
File "/home/hass/.homeassistant/custom_components/entities_calendar/calendar.py", line 251, in update
"date": start.strftime('%Y-%m-%d'),
AttributeError: 'NoneType' object has no attribute 'strftime'
Perhaps a check could be added to see if start
is not None before trying to apply strftime on it to prevent this from clogging up the logs.
Home Assistant Core: 2023.4.0b2
Entities_Calendar: 0.0.9
Breaking Change: home-assistant/core#89533
Since the upgrade of HA 2023.4.0, the calendar update fails when end date is not specified or the same as start.
Update for calendar.holidays fails
Update for calendar.vacations fails
Update for calendar.other_events fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 550, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 755, in async_device_update
raise exc
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/entities_calendar/calendar.py", line 178, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/entities_calendar/calendar.py", line 270, in update
event = CalendarEvent(
File "<string>", line 11, in __init__
File "/usr/src/homeassistant/homeassistant/components/calendar/__init__.py", line 345, in __post_init__
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Failed to validate CalendarEvent: Expected positive event duration (2023-04-04 20:00:00-04:00, 2023-04-04 20:00:00-04:00)
I was able to temporarily fix this issue by modifying the logic:
async def async_get_events(self, hass, start_date, end_date):
...
if start and not entity[CONF_END_TIME]:
# If there is a start time and no end time options are defined
# also use the start time as the end time
end = start + timedelta(days=1) <<<<<<=================
else:
end = _get_date(entity[CONF_END_TIME], state_object)
# If start time and end time are the same
if end == start:
end = start + timedelta(days=1) <<<<<<=================
...
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:
In “Developer Tools” time is correct:
sensor
But on Calendar:
Any suggestions? What I’m doing wrong?
Because a unique_id
cannot be set in the configuration.yaml file, the entities cannot be controlled in the Lovelace UI. Is it possible to add support for the unique_id
value?
Received an early release warning of deprecated attribute.
Home Assistant Core 2022.5.0b3
CalendarEventDevice is deprecated, modify EntitiesCalendarDevice to extend CalendarEntity
Let me know if you need more details.
Thank you
Since Home Assistant version 2021.3, custom integrations now require a version
key in the manifest file, as you can see here :
For now, it only create a warning at startup, but it will eventually be blocked from loading.
[homeassistant.loader] No 'version' key in the manifest file for custom integration 'entities_calendar'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'entities_calendar'
This is not an issue. I have some entities that have the event dates in the attributes and the states shows the days until that date. Could you add a feature to use the date in the attribute?
I have a template sensor I use to pull an attribute from a binary sensor to display in lovelace. I was trying to use this integration to add the sensor to my calendar but I am getting an error in the logs.
template sensor:
- platform: template
sensors:
dollars_food:
friendly_name: Dollar Fed
icon_template: mdi:dog
device_class: timestamp
value_template: >
{% set t = state_attr('binary_sensor.wyzesense_dollars', 'timestamp') %}
{% set u = as_timestamp(strptime(t,'%Y-%m-%dT%h:%m:%s')) %}
{{ u | timestamp_custom("%-I:%M%p %m-%d-%Y") }}
but when I add the sensor to my config using:
- platform: entities_calendar
calendars:
- name: Pet Feedings
entities:
- entity: sensor.dollars_food
- entity: sensor.bennys_food
I get this error:
Logger: homeassistant.helpers.entity
Source: custom_components/entities_calendar/calendar.py:251
First occurred: 12:33:06 AM (1 occurrences)
Last logged: 12:33:06 AM
Update for calendar.pet_feedings 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 472, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/entities_calendar/calendar.py", line 168, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 239, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/entities_calendar/calendar.py", line 251, in update
"date": start.strftime('%Y-%m-%d'),
AttributeError: 'NoneType' object has no attribute 'strftime'
The ROVA trash integration doesn't use last_changed
but puts the date in the state instead.
It would be nice if this integration could support that as well, right now it's throwing exceptions because the entity doesn't contain a date/last_changed
field:
2020-05-29 13:41:54 ERROR (MainThread) [homeassistant.helpers.entity] Update for calendar.trash fails
Traceback (most recent call last):
File "/srv/hass/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/srv/hass/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 472, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/hass/.homeassistant/custom_components/entities_calendar/calendar.py", line 111, in update
self.data.update()
File "/srv/hass/lib/python3.8/site-packages/homeassistant/util/__init__.py", line 239, in wrapper
result = method(*args, **kwargs)
File "/home/hass/.homeassistant/custom_components/entities_calendar/calendar.py", line 195, in update
"date": start.strftime('%Y-%m-%d'),
AttributeError: 'NoneType' object has no attribute 'strftime'
Describe the bug
Warning in Home Assistant 2021.12
WARNING (MainThread) [homeassistant.helpers.entity] Entity <> implements device_state_attributes. Please report it to the custom component author.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No warning errors
Log
[homeassistant.helpers.entity] Entity ?? <> implements device_state_attributes. Please report it to the custom component author.
HASS Environment
HASS OS
Additional context
Change device_state_attributes --> extra_state_attributes
calendar.py
@property
def extra_state_attributes(self):
"""Return the device state attributes."""
if self.data.event is None:
# No tasks, we don't REALLY need to show anything.
return None
return {}
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.