Skip to content

Commit

Permalink
Stash
Browse files Browse the repository at this point in the history
  • Loading branch information
jinglemansweep committed Nov 23, 2023
1 parent 64eff73 commit 3592038
Showing 1 changed file with 62 additions and 63 deletions.
125 changes: 62 additions & 63 deletions wideboy/scenes/default/tile_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,53 +364,6 @@ def value(self):
return float(self.state.get("sensor.bedroom_temperature_sensor_temperature", 0))


# Weather Tiles


class CellWeatherTemperature(BaseCellTemperate):
icon_codepoint = FontAwesomeIcons.ICON_FA_HOUSE

@property
def value(self):
return float(self.state.get("sensor.openweathermap_temperature", 0))


class CellWeatherWindSpeed(GridCell):
icon_codepoint = FontAwesomeIcons.ICON_FA_WIND

@property
def value(self):
return int(self.state.get("sensor.openweathermap_wind_speed", 0))

@property
def label(self):
return f"{convert_ms_to_mph(self.value)}mph"

@property
def open(self):
return self.value > 10


class CellWeatherRainProbability(GridCell):
icon_codepoint = FontAwesomeIcons.ICON_FA_UMBRELLA

@property
def value(self):
return int(
self.state.get(
"sensor.openweathermap_forecast_precipitation_probability", 0
)
)

@property
def label(self):
return f"{self.value}%"

@property
def open(self):
return self.value > 0


# Energy Tiles


Expand Down Expand Up @@ -672,6 +625,53 @@ def label(self):
return format_minutes(self.value)


# Weather Tiles


class CellWeatherTemperature(BaseCellTemperate):
icon_codepoint = FontAwesomeIcons.ICON_FA_HOUSE

@property
def value(self):
return float(self.state.get("sensor.openweathermap_temperature", 0))


class CellWeatherWindSpeed(GridCell):
icon_codepoint = FontAwesomeIcons.ICON_FA_WIND

@property
def value(self):
return int(self.state.get("sensor.openweathermap_wind_speed", 0))

@property
def label(self):
return f"{convert_ms_to_mph(self.value)}mph"

@property
def open(self):
return self.value > 10


class CellWeatherRainProbability(GridCell):
icon_codepoint = FontAwesomeIcons.ICON_FA_UMBRELLA

@property
def value(self):
return int(
self.state.get(
"sensor.openweathermap_forecast_precipitation_probability", 0
)
)

@property
def label(self):
return f"{self.value}%"

@property
def open(self):
return self.value > 0


rainbox_idx = 0


Expand Down Expand Up @@ -729,21 +729,6 @@ class GridColumnHomeLab(HorizontalCollapseTileGridColumn):
rainbox_idx += 1


class GridColumnWeather(HorizontalCollapseTileGridColumn):
border_width = 1
border_color = rainbox_colors[rainbox_idx % len(rainbox_colors)]
cells = [
CellWeatherTemperature,
CellTemperatureLounge,
CellTemperatureBedroom,
CellWeatherWindSpeed,
CellWeatherRainProbability,
]


rainbox_idx += 1


class GridColumnElectricity(HorizontalCollapseTileGridColumn):
border_width = 1
border_color = rainbox_colors[rainbox_idx % len(rainbox_colors)]
Expand All @@ -757,6 +742,20 @@ class GridColumnElectricity(HorizontalCollapseTileGridColumn):
]


class GridColumnWeather(HorizontalCollapseTileGridColumn):
border_width = 1
border_color = rainbox_colors[rainbox_idx % len(rainbox_colors)]
cells = [
CellWeatherTemperature,
CellWeatherWindSpeed,
CellWeatherRainProbability,
CellTemperatureLounge,
CellTemperatureBedroom,
]


rainbox_idx += 1

# CUSTOM GRID


Expand All @@ -765,6 +764,6 @@ class CustomTileGrid(TileGrid):
GridColumnSensors,
GridColumnMotion,
GridColumnHomeLab,
GridColumnWeather,
GridColumnElectricity,
GridColumnWeather,
]

0 comments on commit 3592038

Please sign in to comment.