Skip to content

Commit

Permalink
feat: add apparent temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
pilotak committed Nov 26, 2024
1 parent 20c1626 commit a9c5114
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ Configuration variables:
- **wind_chill_min**: Today MIN Wind Chill (°C or °F)
- **vp_solar**: Solar Irradiation (W/m² or BTU/(h×ft²))
- **uv_index**: UV Index
- **apparent_temp**: Apparent temperature (°C or °F)
- **apparent_temp_min**: Min pparent temperature (°C or °F)
- **apparent_temp_maz**: Max pparent temperature (°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
Expand Up @@ -7,5 +7,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/pilotak/homeassistant-clientraw/issues",
"requirements": [],
"version": "2.6.1"
"version": "2.7.0"
}
31 changes: 29 additions & 2 deletions custom_components/clientraw/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
async_call_later)
from homeassistant.util.unit_system import METRIC_SYSTEM

__version__ = '2.6.1'
__version__ = '2.7.0'

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -79,7 +79,13 @@
'vp_solar': ['VP solar', UnitOfIrradiance.WATTS_PER_SQUARE_METER,
UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT,
'mdi:solar-power'],
'uv_index': ['UV index', UV_INDEX, UV_INDEX, 'mdi:white-balance-sunny']
'uv_index': ['UV index', UV_INDEX, UV_INDEX, 'mdi:white-balance-sunny'],
'apparent_temp': ['Apparent temperature', TEMP_CELSIUS, TEMP_FAHRENHEIT,
'mdi:thermometer'],
'apparent_temp_min': ['Apparent temperature', TEMP_CELSIUS, TEMP_FAHRENHEIT,
'mdi:thermometer'],
'apparent_temp_max': ['Apparent temperature', TEMP_CELSIUS, TEMP_FAHRENHEIT,
'mdi:thermometer']
}

CONF_URL = 'url'
Expand Down Expand Up @@ -598,6 +604,27 @@ def try_again(err: str):
else:
new_state = STATE_UNAVAILABLE

elif dev.type == 'apparent_temp':
if self.data[130] != '-' and self.data[130] != '--' \
and self.data[130] != '---':
new_state = float(self.data[130])
else:
new_state = STATE_UNAVAILABLE

elif dev.type == 'apparent_temp_max':
if self.data[136] != '-' and self.data[136] != '--' \
and self.data[136] != '---':
new_state = float(self.data[136])
else:
new_state = STATE_UNAVAILABLE

elif dev.type == 'apparent_temp_min':
if self.data[137] != '-' and self.data[137] != '--' \
and self.data[137] != '---':
new_state = float(self.data[137])
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 @@ -49,6 +49,9 @@ Configuration variables:
- **wind_chill_min**: Today MIN Wind Chill (°C or °F)
- **vp_solar**: Solar Irradiation (W/m² or BTU/(h×ft²))
- **uv_index**: UV Index
- **apparent_temp**: Apparent temperature (°C or °F)
- **apparent_temp_min**: Min pparent temperature (°C or °F)
- **apparent_temp_maz**: Max pparent temperature (°C or °F)
A full configuration example can be found below:
Expand Down

0 comments on commit a9c5114

Please sign in to comment.