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

Commit

Permalink
Merge pull request #46 from KNXBroker/master
Browse files Browse the repository at this point in the history
Added optional wind sensor; removed '+' infront of wind icon
  • Loading branch information
Yevgenium authored Oct 19, 2020
2 parents f302098 + 8803cef commit b006d73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ Then you can add the card to the view:
| type | **No** | Should be `'custom:weather-card-chart'` |
| title | **No** | Card title |
| weather | **No** | An entity_id with the `weather` domain |
| wind | Yes | Entity_id of the wind sensor. Show wind value from sensor instead |
| 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 |
13 changes: 11 additions & 2 deletions weather-card-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,14 @@ class WeatherCardChart extends Polymer.Element {
</template>
</div>
<div>
+ <ha-icon icon="[[getWindDirIcon(windBearing)]]"></ha-icon> [[getWindDir(windBearing)]]<br>
<ha-icon icon="hass:weather-windy"></ha-icon> [[computeWind(weatherObj.attributes.wind_speed)]] [[ll('uSpeed')]]
<ha-icon icon="[[getWindDirIcon(windBearing)]]"></ha-icon> [[getWindDir(windBearing)]]<br>
<ha-icon icon="hass:weather-windy"></ha-icon>
<template is="dom-if" if="[[windObj]]">
[[roundNumber(windObj.state)]] [[ll('uSpeed')]]
</template>
<template is="dom-if" if="[[!windObj]]">
[[computeWind(weatherObj.attributes.wind_speed)]] [[ll('uSpeed')]]
</template>
</div>
</div>
<ha-chart-base hass="[[_hass]]" data="[[ChartData]]"></ha-chart-base>
Expand All @@ -190,6 +196,7 @@ class WeatherCardChart extends Polymer.Element {
config: Object,
sunObj: Object,
tempObj: Object,
windObj: Object,
mode: String,
weatherObj: {
type: Object,
Expand Down Expand Up @@ -229,6 +236,7 @@ class WeatherCardChart extends Polymer.Element {
this.title = config.title;
this.weatherObj = config.weather;
this.tempObj = config.temp;
this.windObj = config.wind;
this.mode = config.mode;
if (!config.weather) {
throw new Error('Please define "weather" entity in the card config');
Expand All @@ -241,6 +249,7 @@ class WeatherCardChart extends Polymer.Element {
this.weatherObj = this.config.weather in hass.states ? hass.states[this.config.weather] : null;
this.sunObj = 'sun.sun' in hass.states ? hass.states['sun.sun'] : null;
this.tempObj = this.config.temp in hass.states ? hass.states[this.config.temp] : null;
this.windObj = this.config.wind in hass.states ? hass.states[this.config.wind] : null;
this.forecast = this.weatherObj.attributes.forecast.slice(0,9);
this.windBearing = this.weatherObj.attributes.wind_bearing;
}
Expand Down

0 comments on commit b006d73

Please sign in to comment.