diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/README.md b/README.md index 2523cfd..d89fe4a 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,16 @@ Then you can add the card to the view: #### 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 | +| Name | Optional | Description | +| -------- | -------- | -------------------------------------------------------------------------------------------------- | +| type | **No** | Should be `'custom:weather-card-chart'` | +| title | Yes | Default value: ``. Card title | +| weather | **No*** | An entity_id with the `weather` domain. Use only one: 'weather' or 'entity' option. | +| entity | **No*** | (For backward compatibility with Weather Forecast Card) An entity_id with the `weather` domain. Use only one: 'weather' or 'entity' option. | +| temp | Yes | Entity_id of the temperature sensor. Show temperature value from sensor instead | +| temp_apparent | Yes | Entity_id of the apparent temperature sensor | +| mode | Yes | Default value: `daily`. Set mode to `hourly` to display hours instead weekdays on the chart | | 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 | +| wind_unit | Yes | Default value: `ms`. Set wind_unit to `kmh` to display wind speed in km/h | +| pressure2mmhg | Yes | Default value: False. Set pressure2mmhg to True to display pressure in mmHg | +| chart_only | Yes | Default value: False. Set chart_only to True to display only temperature chart | diff --git a/weather-card-chart.js b/weather-card-chart.js index 31a3bfe..7aef345 100644 --- a/weather-card-chart.js +++ b/weather-card-chart.js @@ -4,7 +4,10 @@ const locale = { tempLo: "Temperatur nat", precip: "Nedbør", uPress: "hPa", - uSpeed: "m/s", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NØ', 'NØ', 'Ø-NØ', 'Ø', 'Ø-SØ', 'SØ', 'S-SØ', @@ -16,7 +19,10 @@ const locale = { tempLo: "Tiefsttemperatur", precip: "Niederschlag", uPress: "hPa", - uSpeed: "m/s", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NO', 'NO', 'O-NO', 'O', 'O-SO', 'SO', 'S-SO', @@ -26,9 +32,14 @@ const locale = { en: { tempHi: "Temperature", tempLo: "Temperature night", + tempApp: "Feels like", precip: "Precipitations", uPress: "hPa", - uSpeed: "m/s", + uPressMmHg: "mmHg", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NE', 'NE', 'E-NE', 'E', 'E-SE', 'SE', 'S-SE', @@ -40,7 +51,10 @@ const locale = { tempLo: "Temperatura mínima", precip: "Precipitations", uPress: "hPa", - uSpeed: "m/s", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NE', 'NE', 'E-NE', 'E', 'E-SE', 'SE', 'S-SE', @@ -52,7 +66,10 @@ const locale = { tempLo: "Température nuit", precip: "Précipitations", uPress: "hPa", - uSpeed: "m/s", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NE', 'NE', 'E-NE', 'E', 'E-SE', 'SE', 'S-SE', @@ -64,7 +81,10 @@ const locale = { tempLo: "Minimum temperatuur", precip: "Neerslag", uPress: "hPa", - uSpeed: "m/s", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NO', 'NO', 'O-NO', 'O', 'O-ZO', 'ZO', 'Z-ZO', @@ -74,9 +94,14 @@ const locale = { ru: { tempHi: "Температура", tempLo: "Температура ночью", + tempApp: "Ощущается как", precip: "Осадки", uPress: "гПа", - uSpeed: "м/с", + uPressMmHg: "мм", + uSpeed: { + "ms": "м/с", + "kmh": "км/ч" + }, uPrecip: "мм", cardinalDirections: [ 'С', 'С-СВ', 'СВ', 'В-СВ', 'В', 'В-ЮВ', 'ЮВ', 'Ю-ЮВ', @@ -88,7 +113,10 @@ const locale = { tempLo: "Temperatur natt", precip: "Nederbörd", uPress: "hPa", - uSpeed: "m/s", + uSpeed: { + "ms": "m/s", + "kmh": "km/h" + }, uPrecip: "mm", cardinalDirections: [ 'N', 'N-NO', 'NO', 'O-NO', 'O', 'O-SO', 'SO', 'S-SO', @@ -106,37 +134,55 @@ class WeatherCardChart extends Polymer.Element { color: var(--paper-item-icon-color); } .card { - padding: 0 18px 18px 18px; + padding: 0 10px 10px 10px; + } + .content { + display: flex; + flex-wrap: wrap; + justify-content: space-between; } .main { display: flex; align-items: center; - font-size: 60px; - font-weight: 350; margin-top: -10px; } .main ha-icon { --iron-icon-height: 74px; --iron-icon-width: 74px; --mdc-icon-size: 74px; - margin-right: 20px; + margin-right: 10px; + } + .main sup { + font-size: 50%; } - .main div { + .main ha-icon, .main .temp { + font-size: 400%; + font-weight: 300; + } + .main .temp { cursor: pointer; - margin-top: -11px; } - .main sup { - font-size: 32px; + .main .apparent { + cursor: pointer; + margin-top: 0.75em; } .attributes { cursor: pointer; display: flex; justify-content: space-between; align-items: center; - margin: 10px 0px 10px 0px; + margin: 0px 0px 10px 0px; } .attributes div { - text-align: center; + text-align: left; + } + .sun { + display: flex; + justify-content: space-evenly; + margin: 10px 0; + } + .sun div { + flex: 0 0 auto; } .conditions { display: flex; @@ -144,40 +190,51 @@ class WeatherCardChart extends Polymer.Element { align-items: center; margin: 0px 3px 0px 16px; } + [hidden] { + display: none !important; + }
-
- - - -
-
-
- [[roundNumber(weatherObj.attributes.humidity)]] %
- [[roundNumber(weatherObj.attributes.pressure)]] [[ll('uPress')]] -
-
- -
-
- [[getWindDir(windBearing)]]
- -