shannonhochkins/ha-component-kit

Card for Calendar entries

Closed this issue · 7 comments

Can we have a card to show future events from a Calendar(Google) entity or if there is already some card that can be used for similar purposes.

Can you please include feature requests in the discussions area, Calendar card is on the roadmap it's listed on storybook, but it's not the highest on my priority list

Screenshot 2023-10-16 at 3 43 08 pm
Still a work in progress, but i've started to get something going for you @pdhruv93

Thanks, waiting for a long time, can we also have it in a list view?

Yes I've made it identical to the Lovelace one

Can you please install the latest and let me know what you think / if you have any problems @pdhruv93 ?

CalendarCard has been released, if you run into problems with the new api flow, there's documentation of what's needed to install here: https://shannonhochkins.github.io/ha-component-kit/?path=/docs/hooks-usehass-callapi--docs

As the calendar entries are only retrievable (in a nice format) from the rest api, i had to include a new hook from the useHass store called "callApi"

This does mean that you may need to follow the steps on the mentioned page to get this to work :)

Was just working on my own calendar card when I found this.

Seems to work just fine except for a few small Typescript issues. When using callApi, the options parameter seems to be required but all the properties of RequestInit are optional.
You can work around this by passing an empty object of course but might be nice to fix that.

Another issue is the Event type (although this is probably just an example you provided). It doesn't match the object that you would get as a response.
https://developers.home-assistant.io/docs/core/entity/calendar/#calendarevent

I used the following types:

export type DateFormat = {
  dateTime: string;
  date: string;
};

export interface CalendarEvent {
  start: DateFormat;
  end: DateFormat;
  summary: string;
  location?: string;
  description?: string;
  uid?: string;
  recurrence_id?: string;
  rrule?: string;
}

Great work!

Thanks for the feedback! I'm glad there's only a few small bugs there, easy fixes!

I'll have those sorted in the next patch, ive started working on a camera card and I've had some success so far retrieving live streams, but if you notice anything else reach out!