Skip to content

Commit

Permalink
- Added CALM as wind direction options when use letters unit.
Browse files Browse the repository at this point in the history
- Added check when there is a different number of direction and speeds measurements.
  • Loading branch information
aukedejong committed Jan 25, 2023
1 parent 5720c3e commit a9616f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/WindBarCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class WindBarCanvas {

drawWindBar(windBarData: WindBarData, canvasContext: CanvasRenderingContext2D) {

console.log('Data', windBarData);
// console.log('Data', windBarData);
if (this.config.orientation === 'horizontal') {
this.drawBarLegendHorizontal(windBarData.speedRangePercentages, canvasContext);

Expand Down
3 changes: 2 additions & 1 deletion src/WindDirectionConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export class WindDirectionConverter {
NW: 315,
NWXN: 326.25,
NNW: 337.5,
NXW: 348.5
NXW: 348.5,
CALM: 0
};
}

Expand Down
8 changes: 5 additions & 3 deletions src/WindRoseCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class WindRoseCard extends LitElement {

constructor() {
super();
console.log("constructor()");
// console.log("constructor()");
}

set hass(hass: HomeAssistant) {
Expand Down Expand Up @@ -168,7 +168,9 @@ export class WindRoseCard extends LitElement {
this.getHistory().then((history: any) => {
const directionData = history[this.cardConfig.windDirectionEntity];
const firstSpeedData = history[this.cardConfig.windspeedEntities[0].entity];

if (directionData.length !== firstSpeedData.length) {
throw new Error("The direction and speed entities should have the same number of measurements for a period.");
}
console.log('Historie', history)

this.windRoseCalculator?.clear();
Expand Down Expand Up @@ -205,7 +207,7 @@ export class WindRoseCard extends LitElement {
}

private updateCanvasSize(canvasWidth: number) {
console.log('updateCanvasSize()', canvasWidth);
// console.log('updateCanvasSize()', canvasWidth);

this.canvas.width = canvasWidth;
this.canvas.height = this.windRoseConfigFactory.canvasHeight as number;
Expand Down

0 comments on commit a9616f2

Please sign in to comment.