Skip to content

Commit

Permalink
add navigation config
Browse files Browse the repository at this point in the history
  • Loading branch information
warmfire540 committed Jan 30, 2025
1 parent 62d1eb1 commit 9c4409b
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 26 deletions.
35 changes: 19 additions & 16 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
{
"singleQuote": true,
"endOfLine": "lf",
"tabWidth": 2,
"trailingComma": "all",
"semi": true,
"importOrder": [
"^@core/(.*)$",
"<THIRD_PARTY_MODULES>",
"^@server/(.*)$",
"^@ui/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderParserPlugins": ["typescript", "decorators-legacy"],
"plugins": ["@trivago/prettier-plugin-sort-imports"]
"singleQuote": true,
"endOfLine": "lf",
"tabWidth": 2,
"trailingComma": "all",
"semi": true,
"importOrder": [
"^@core/(.*)$",
"<THIRD_PARTY_MODULES>",
"^@server/(.*)$",
"^@ui/(.*)$",
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderParserPlugins": ["typescript", "decorators-legacy"],
"plugins": [
"@trivago/prettier-plugin-sort-imports",
"prettier-plugin-organize-imports"
]
}
35 changes: 34 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"@parcel/transformer-inline-string": "^2.8.3",
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
"parcel": "^2.8.3",
"prettier": "3.4.2"
"prettier": "3.4.2",
"prettier-plugin-organize-imports": "^4.1.0"
},
"dependencies": {
"@lit/task": "^1.0.1",
Expand Down
1 change: 0 additions & 1 deletion src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
ActionHandlerElement,
ActionHandlerOptions,
ActionHandlerType,
EntityConfig,
EntityInformation,
} from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { state } from 'lit/decorators.js';
import { version } from '../package.json';
import { actionHandler } from './action-handler';
import { handleClickAction } from './handle-action';
import { createStateIcon } from './helpers';
import {
createStateIcon,
getDevice,
getEntity,
getIconEntities,
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const getRoomEntity = (hass: HomeAssistant, config: Config) => {
icon: getArea(hass, config.area)?.icon,
tap_action: {
action: 'navigate',
navigation_path: config.area.replace('_', '-'),
navigation_path: config.navigate ?? config.area.replace('_', '-'),
},
hold_action: { action: 'more-info' },
double_tap_action: { action: 'none' },
Expand Down
11 changes: 6 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
*/
export interface Config {
area: string;
entity: EntityConfig | string;
entities: (EntityConfig | string)[];
problem_entities: string[];
remove_fan: boolean;
skip_climate_colors: boolean;
entity?: EntityConfig | string;
entities?: (EntityConfig | string)[];
problem_entities?: string[];
remove_fan?: boolean;
skip_climate_colors?: boolean;
navigate?: string;
}

export interface EntityConfig {
Expand Down

0 comments on commit 9c4409b

Please sign in to comment.