Giter VIP home page Giter VIP logo

entities_calendar's People

Contributors

gadgetchnnel avatar teleksterling avatar web-flow 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

Watchers

 avatar  avatar  avatar  avatar

entities_calendar's Issues

Entity xx implements device_state_attributes

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:

  1. Install Home Assistant Core 2021.12
  2. Check Logs

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 {}

AttributeError: 'NoneType' object has no attribute 'strftime'

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.

Cannot set unique_id for calendar entities

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?

Get 4 hours back on calendar

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:
sensor

image

But on Calendar:

image

Any suggestions? What I’m doing wrong?

Support for "state" dates

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'

Manifest file for custom integration

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'

error in log with template sensor

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") }}

which displays as:
image
image

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'

Error in logs

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?

Entity has event date as attributes

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?

CalendarEventDevice is deprecated

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

HA 2023.4 (beta) no longer works with entities calendar

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)  <<<<<<=================

...

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.