Skip to content

Commit

Permalink
Merge pull request #401 from tomvanswam/dev
Browse files Browse the repository at this point in the history
v1.6.1
  • Loading branch information
tomvanswam committed Apr 24, 2022
2 parents a87c94a + 0ef994d commit 3b477f6
Show file tree
Hide file tree
Showing 9 changed files with 1,755 additions and 2,094 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
- npm
npm:
container_name: ha-dev-npm
image: "node:current-alpine3.12"
image: "node:current-alpine3.14"
working_dir: /home/node/app
environment:
- NODE_ENV=development
Expand All @@ -30,7 +30,7 @@ services:
- install
install:
container_name: ha-install-npm
image: "node:current-alpine3.12"
image: "node:current-alpine3.14"
working_dir: /home/node/app
environment:
- NODE_ENV=development
Expand Down
3,731 changes: 1,692 additions & 2,039 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "compass-card",
"version": "1.6.0",
"version": "1.6.1",
"description": "Lovelace compass-card",
"keywords": [
"home-assistant",
Expand All @@ -15,33 +15,33 @@
"author": "Tom van Swam <tom@vanswam.com>",
"license": "MIT",
"dependencies": {
"custom-card-helpers": "^1.8.0",
"home-assistant-js-websocket": "^5.11.1",
"lit": "^2.0.2"
"custom-card-helpers": "^1.9.0",
"home-assistant-js-websocket": "^6.1.1",
"lit": "^2.2.2"
},
"devDependencies": {
"@babel/core": "^7.15.8",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.15.8",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.0",
"@babel/core": "^7.17.9",
"@babel/eslint-parser": "^7.17.0",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-decorators": "^7.17.9",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.5",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-lit": "^1.6.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"eslint": "^8.13.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-lit": "^1.6.1",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.4.1",
"rollup": "^2.58.0",
"prettier": "^2.6.2",
"rollup": "^2.70.2",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.4.3"
"rollup-plugin-typescript2": "^0.31.2",
"typescript": "^4.6.3"
},
"scripts": {
"start": "rollup -c --watch",
Expand Down
6 changes: 5 additions & 1 deletion src/cardTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ export interface CCProperties {

export interface CCDynamicStyle extends CCEntity {
bands: CCStyleBand[];
unknown: CCStyle;
}

export interface CCStyleBand {
export interface CCStyleBand extends CCStyle {
from_value: number;
}

export interface CCStyle {
color: string;
show: boolean;
}
Expand Down
6 changes: 1 addition & 5 deletions src/compass-card.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LitElement, html, CSSResult, TemplateResult, PropertyValues, svg, SVGTemplateResult } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { getLovelace, HomeAssistant, LovelaceCardEditor, LovelaceCard } from 'custom-card-helpers';
import { HassEntities, HassEntity } from 'home-assistant-js-websocket';
import { HassEntities } from 'home-assistant-js-websocket';
import { CompassCardConfig } from './editorTypes';
import { CCColors, CCCompass, CCDirectionInfo, CCEntity, CCHeader, CCIndicatorSensor, CCValueSensor, CCValue, CCProperties } from './cardTypes';
import handleClick from './utils/handleClick';
Expand Down Expand Up @@ -380,10 +380,6 @@ export class CompassCard extends LitElement {
`;
}

private getSecondaryEntity(entity: HassEntity): TemplateResult {
return html`<span class="value">${entity.state}</span> <span class="measurement">${entity.attributes.unit_of_measurement}</span>`;
}

private getValue(entity: CCEntity): CCValue {
if (entity.is_attribute) {
const entityStr = entity.sensor.slice(0, entity.sensor.lastIndexOf('.'));
Expand Down
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { localize } from './localize/localize';

export const CARD_VERSION = '1.6.0';
export const CARD_VERSION = '1.6.1';
export const ICONS = {
compass: 'mdi:compass',
};
Expand Down
6 changes: 5 additions & 1 deletion src/editorTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ export interface CCDynamicStyleConfig {
sensor?: string;
attribute?: string;
bands: CCStyleBandConfig[];
unknown?: CCStyleConfig;
}

export interface CCStyleBandConfig {
export interface CCStyleBandConfig extends CCStyleConfig {
from_value: number;
}

export interface CCStyleConfig {
color?: string;
show?: boolean;
}
Expand Down
46 changes: 23 additions & 23 deletions src/localize/languages/se.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
{
"common": {
"version": "Version",
"description": "Visa en kompass med en indikering för bäringen av entitetens värde",
"description": "Visa en kompass med en indikering för bäringen av entitetens värde",
"invalid_configuration": "Felaktig konfiguration",
"missing_direction_entity": "Bäringsentitet saknas",
"no_entity": "Entiteten är inte konfigurerad",
"offset_not_a_number": "Bäringens offset är inte en siffra",
"missing_direction_entity": "Bäringsentitet saknas",
"no_entity": "Entiteten är inte konfigurerad",
"offset_not_a_number": "Bäringens offset är inte en siffra",
"invalid": "felaktig",
"on": "",
"on": "",
"off": "Av"
},
"editor": {
"name": "Namn",
"optional": "Valbar",
"entity": "Entitet",
"required": "Obligatorisk",
"primary": "Primär",
"secondary": "Sekundär",
"primary": "Primär",
"secondary": "Sekundär",
"indicator": "Indikator",
"direction": "Bäring",
"direction": "Bäring",
"offset": "Offset",
"show": "Visa",
"abbreviations": "Förkortningar",
"toggle": "Växla",
"language": "Språk",
"primary entity description": "Primär entitetsbeskrivning",
"secondary entity description": "Sekundär entitetsbeskrivning",
"language description": "Språkbeskrivning",
"abbreviations": "Förkortningar",
"toggle": "Växla",
"language": "Språk",
"primary entity description": "Primär entitetsbeskrivning",
"secondary entity description": "Sekundär entitetsbeskrivning",
"language description": "Språkbeskrivning",
"offset description": "Offsetbeskrivning"
},
"directions": {
"north": "Nord",
"east": "Öst",
"east": "Öst",
"south": "Syd",
"west": "Väst",
"west": "Väst",
"N": "N",
"NNE": "NNÖ",
"NE": "",
"ENE": "ÖNÖ",
"E": "Ö",
"ESE": "ÖSÖ",
"SE": "",
"SSE": "SSÖ",
"NNE": "NNÖ",
"NE": "",
"ENE": "ÖNÖ",
"E": "Ö",
"ESE": "ÖSÖ",
"SE": "",
"SSE": "SSÖ",
"S": "S",
"SSW": "SSV",
"SW": "SV",
Expand Down
4 changes: 4 additions & 0 deletions src/utils/objectHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ function getDynamicStyle(
bands: getBands(dynamicStyle?.bands, startColor, startVisibility),
decimals: decimals,
units: units,
unknown: {
color: dynamicStyle?.unknown?.color || startColor,
show: dynamicStyle?.unknown?.show || startVisibility,
},
};
}

Expand Down

0 comments on commit 3b477f6

Please sign in to comment.