diff --git a/README.md b/README.md index 96cacef..1b6010b 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ entity: sensor.rain_daily | show_warning | boolean | **Optional** | Show what a warning looks like for the card | `false` | | entity | string | **Required** | Home Assistant entity ID. | `none` | | language | string | **Optional** | The 2 character that determines the language| `en` | +| is_imperial | boolean | **Optional** | Switch to inches (`in`) instead of `mm` | `false` | | hourly_rate_entity| string | **Optional** | Home Assistant entity ID to hourly rate | `none` | | tap_action | object | **Optional** | Action to take on tap | `action: more-info` | | hold_action | object | **Optional** | Action to take on hold | `none` | diff --git a/package.json b/package.json index a8e30fa..cf3e8c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rain-gauge-card", - "version": "1.1.0", + "version": "1.2.0", "description": "A Lovelace card that shows the rain gauge for Home Assistant", "keywords": [ "home-assistant", diff --git a/src/const.ts b/src/const.ts index 78b357d..38e11f4 100644 --- a/src/const.ts +++ b/src/const.ts @@ -1 +1 @@ -export const CARD_VERSION = '1.1.0'; +export const CARD_VERSION = '1.2.0'; diff --git a/src/editor.ts b/src/editor.ts index 38b97ec..45d38ec 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -50,6 +50,10 @@ export class RainGaugeCardEditor extends ScopedRegistryHost(LitElement) implemen return this._config?.entity || ''; } + get _is_imperial(): boolean { + return this._config?.is_imperial || false; + } + get _language(): string { return this._config?.language || ''; } @@ -99,6 +103,13 @@ export class RainGaugeCardEditor extends ScopedRegistryHost(LitElement) implemen .configValue=${'name'} @input=${this._valueChanged} > + + +

${localize('common.total', '', '', this.config.language)}
- ${stateValue} mm + ${stateValue} ${unitOfMeasurement}

- ${this._showHourlyRate(hourlyRateEntityState, hourlyRateStateValue)} + ${this._showHourlyRate(hourlyRateEntityState, hourlyRateStateValue, unitOfMeasurement)}
@@ -156,11 +163,11 @@ export class RainGaugeCard extends LitElement { `; } - private _showHourlyRate(hourlyRateEntityState: any | undefined, hourlyRateStateValue: number): TemplateResult | void { + private _showHourlyRate(hourlyRateEntityState: any | undefined, hourlyRateStateValue: number, unitOfMeasurement: string): TemplateResult | void { if (hourlyRateEntityState === undefined) return return html`

${localize('common.rate', '', '', this.config.language)}
- ${hourlyRateStateValue} mm/h + ${hourlyRateStateValue} ${unitOfMeasurement}/h

` } diff --git a/src/types.ts b/src/types.ts index 68b5010..abe2606 100644 --- a/src/types.ts +++ b/src/types.ts @@ -16,6 +16,7 @@ export interface RainGaugeCardConfig extends LovelaceCardConfig { test_gui?: boolean; entity?: string; language?: string; + is_imperial?: boolean; hourly_rate_entity?: string; tap_action?: ActionConfig; hold_action?: ActionConfig;