Skip to content

Commit

Permalink
Added Wind Chill
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak authored Jan 31, 2023
1 parent 7da1112 commit 5c72969
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ Configuration variables:
- **cloud_height**: Cloud Height (m or ft)
- **forecast**: string based output ie.: night showers
- **station**: station name with time added
- **date**: current date
- **date**: current date
- **wind_chill**: Wind Chill (°C or °F)
- **wind_chill_max**: Today MAX Wind Chill (°C or °F)
- **wind_chill_min**: Today MIN Wind Chill (°C or °F)
## Install via [HACS](https://github.com/custom-components/hacs)
You can find this integration in a store.
Expand Down
2 changes: 1 addition & 1 deletion custom_components/clientraw/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "clientraw",
"name": "Clientraw",
"version": "2.3.1",
"version": "2.4.0",
"documentation": "https://github.com/pilotak/homeassistant-clientraw",
"issue_tracker": "https://github.com/pilotak/homeassistant-clientraw/issues",
"requirements": [],
Expand Down
49 changes: 47 additions & 2 deletions custom_components/clientraw/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
async_call_later)
from homeassistant.util.unit_system import METRIC_SYSTEM

__version__ = '2.3.1'
__version__ = '2.4.0'

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -70,7 +70,13 @@
'mdi:cloud-outline'],
'forecast': ['Forecast', None, None, "mdi:card-text-outline"],
'station': ['Station', None, None, "mdi:home-thermometer-outline"],
'date': ['Date', None, None, "mdi:calendar"]
'date': ['Date', None, None, "mdi:calendar"],
'wind_chill': ['Wind Chill', TEMP_CELSIUS, TEMP_FAHRENHEIT,
'mdi:thermometer'],
'wind_chill_max': ['Today MAX Wind Chill', TEMP_CELSIUS, TEMP_FAHRENHEIT,
'mdi:thermometer'],
'wind_chill_min': ['Today MIN Wind Chill', TEMP_CELSIUS, TEMP_FAHRENHEIT,
'mdi:thermometer'],
}

CONF_URL = 'url'
Expand Down Expand Up @@ -531,6 +537,45 @@ def try_again(err: str):
else:
new_state = STATE_UNAVAILABLE

elif dev.type == 'wind_chill':
if self.data[44] != '-' and self.data[44] != '--' \
and self.data[44] != '---':
temperature = float(self.data[44])

if self.hass.config.units is not METRIC_SYSTEM:
temperature = TemperatureConverter.convert(
temperature, TEMP_CELSIUS, TEMP_FAHRENHEIT)

new_state = round(temperature, 2)
else:
new_state = STATE_UNAVAILABLE

elif dev.type == 'wind_chill_max':
if self.data[77] != '-' and self.data[77] != '--' \
and self.data[77] != '---':
temperature = float(self.data[77])

if self.hass.config.units is not METRIC_SYSTEM:
temperature = TemperatureConverter.convert(
temperature, TEMP_CELSIUS, TEMP_FAHRENHEIT)

new_state = round(temperature, 2)
else:
new_state = STATE_UNAVAILABLE

elif dev.type == 'wind_chill_min':
if self.data[78] != '-' and self.data[78] != '--' \
and self.data[78] != '---':
temperature = float(self.data[78])

if self.hass.config.units is not METRIC_SYSTEM:
temperature = TemperatureConverter.convert(
temperature, TEMP_CELSIUS, TEMP_FAHRENHEIT)

new_state = round(temperature, 2)
else:
new_state = STATE_UNAVAILABLE

_LOGGER.debug("%s %s", dev.type, new_state)

# pylint: disable=protected-access
Expand Down
3 changes: 3 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Configuration variables:
- **forecast**: string based output ie.: night showers
- **station**: station name with time added
- **date**: current date
- **wind_chill**: Wind Chill (°C or °F)
- **wind_chill_max**: Today MAX Wind Chill (°C or °F)
- **wind_chill_min**: Today MIN Wind Chill (°C or °F)
A full configuration example can be found below:
Expand Down

0 comments on commit 5c72969

Please sign in to comment.