Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
Update types, default config and README
Browse files Browse the repository at this point in the history
  • Loading branch information
AitorDB committed May 17, 2021
1 parent b2922bd commit 52d6c00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ Note: If `Custom: Sun card` doesn't appear you will have to reload cleaning the
| language | `'es'`/`'en'` | Changes card language | Home assistant language or english if not supported |
| showAzimuth | `boolean` | Displays azimuth in the footer | `false` |
| showElevation | `boolean` | Displays elevation in the footer | `false` |
| timeFormat | `'12h'`/`'24h'` | Displayed time format | Locale based on Home assistant language |
| title | `string` | Card title | Doesn't display a title by default | |

## Known issues
- Home assistant seems to provide next events instead today's one

## TODO
- [ ] Adjust styles
- [ ] Fix issue regarding next events
- [ ] Add to HACS (https://github.com/hacs/default/pull/951)
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export class Constants {
darkMode: true,
language: 'en',
showAzimuth: false,
showElevation: false
showElevation: false,
timeFormat: '24h'
}

static readonly EVENT_X_POSITIONS = {
Expand Down
16 changes: 11 additions & 5 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ export type TSunCardConfig = {
language?: string
showAzimuth?: boolean
showElevation?: boolean
timeFormat?: '12h' | '24h'
title?: string
}

export type TSunCardTime = {
time: string,
period?: 'AM' | 'PM'
}

export type TSunCardData = {
azimuth: number
dawnProgressPercent: number
Expand All @@ -18,11 +24,11 @@ export type TSunCardData = {
y: number
}
times: {
dawn: string | null | undefined
dusk: string | null | undefined
noon: string | null | undefined
sunrise: string | null | undefined
sunset: string | null | undefined
dawn: TSunCardTime
dusk: TSunCardTime
noon: TSunCardTime
sunrise: TSunCardTime
sunset: TSunCardTime
}
}

Expand Down

0 comments on commit 52d6c00

Please sign in to comment.