Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Add chartOnly mode #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ custom_updater:

#### Configuration variables:

| Name | Optional | Description |
| ------- | -------- | -------------------------------------------------------------------------------------------------- |
| type | **No** | Should be `'custom:weather-card-chart'` |
| title | **No** | Card title |
| weather | **No** | An entity_id with the `weather` domain |
| temp | Yes | Entity_id of the temperature sensor. Show temperature value from sensor instead |
| mode | Yes | Default value: `daily`. Set mode to `hourly` to display hours instead weekdays on the chart |
| Name | Optional | Description |
| ---------- | -------- | -------------------------------------------------------------------------------------------------- |
| type | **No** | Should be `'custom:weather-card-chart'` |
| title | **No** | Card title |
| weather | **No** | An entity_id with the `weather` domain |
| temp | Yes | Entity_id of the temperature sensor. Show temperature value from sensor instead |
| mode | Yes | Default value: `daily`. Set mode to `hourly` to display hours instead weekdays on the chart |
| chart_only | Yes | Hides the current conditions to only display the temperature/precipitation chart itself |
9 changes: 7 additions & 2 deletions custom-weather-card-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ class WeatherCardChart extends Polymer.Element {
align-items: center;
margin: 0px 3px 0px 16px;
}
[hidden] {
display: none !important;
}
</style>
<ha-card header="[[title]]">
<div class="card">
<div class="main">
<div class="main" hidden="[[chartOnly]]">
<ha-icon icon="[[getWeatherIcon(weatherObj.state)]]"></ha-icon>
<template is="dom-if" if="[[tempObj]]">
<div on-click="_tempAttr">[[roundNumber(tempObj.state)]]<sup>[[getUnit('temperature')]]</sup></div>
Expand All @@ -131,7 +134,7 @@ class WeatherCardChart extends Polymer.Element {
<div on-click="_weatherAttr">[[roundNumber(weatherObj.attributes.temperature)]]<sup>[[getUnit('temperature')]]</sup></div>
</template>
</div>
<div class="attributes" on-click="_weatherAttr">
<div class="attributes" on-click="_weatherAttr" hidden="[[chartOnly]]">
<div>
<ha-icon icon="hass:water-percent"></ha-icon> [[roundNumber(weatherObj.attributes.humidity)]] %<br>
<ha-icon icon="hass:gauge"></ha-icon> [[roundNumber(weatherObj.attributes.pressure)]] [[ll('uPress')]]
Expand Down Expand Up @@ -166,6 +169,7 @@ class WeatherCardChart extends Polymer.Element {
sunObj: Object,
tempObj: Object,
mode: String,
chartOnly: Boolean,
weatherObj: {
type: Object,
observer: 'dataChanged',
Expand Down Expand Up @@ -205,6 +209,7 @@ class WeatherCardChart extends Polymer.Element {
this.weatherObj = config.weather;
this.tempObj = config.temp;
this.mode = config.mode;
this.chartOnly = config.chart_only;
if (!config.weather) {
throw new Error('Please define "weather" entity in the card config');
}
Expand Down