|
14 | 14 | from homeassistant.const import ( |
15 | 15 | CONF_MONITORED_CONDITIONS, TEMP_CELSIUS, TEMP_FAHRENHEIT, PRESSURE_HPA, |
16 | 16 | PRESSURE_INHG, LENGTH_METERS, LENGTH_FEET, LENGTH_INCHES, STATE_UNKNOWN, |
17 | | - STATE_UNAVAILABLE) |
| 17 | + STATE_UNAVAILABLE, UV_INDEX, UnitOfIrradiance) |
18 | 18 | from homeassistant.util import slugify |
19 | 19 | from homeassistant.util.unit_conversion import ( |
20 | 20 | TemperatureConverter, PressureConverter) |
|
25 | 25 | async_call_later) |
26 | 26 | from homeassistant.util.unit_system import METRIC_SYSTEM |
27 | 27 |
|
28 | | -__version__ = '2.4.1' |
| 28 | +__version__ = '2.5.0' |
29 | 29 |
|
30 | 30 | _LOGGER = logging.getLogger(__name__) |
31 | 31 |
|
|
77 | 77 | 'mdi:thermometer'], |
78 | 78 | 'wind_chill_min': ['Today MIN Wind Chill', TEMP_CELSIUS, TEMP_FAHRENHEIT, |
79 | 79 | 'mdi:thermometer'], |
| 80 | + 'vp_solar': ['VP solar', UnitOfIrradiance.WATTS_PER_SQUARE_METER, |
| 81 | + UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT, |
| 82 | + 'mdi:solar-power'], |
| 83 | + 'uv_index': ['UV index', UV_INDEX, UV_INDEX, 'mdi:white-balance-sunny'] |
80 | 84 | } |
81 | 85 |
|
82 | 86 | CONF_URL = 'url' |
@@ -576,6 +580,25 @@ def try_again(err: str): |
576 | 580 | else: |
577 | 581 | new_state = STATE_UNAVAILABLE |
578 | 582 |
|
| 583 | + elif dev.type == 'vp_solar': |
| 584 | + if self.data[127] != '-' and self.data[127] != '--' \ |
| 585 | + and self.data[127] != '---': |
| 586 | + solar = float(self.data[127]) |
| 587 | + |
| 588 | + if self.hass.config.units is not METRIC_SYSTEM: |
| 589 | + solar *= 0.3169983306 |
| 590 | + |
| 591 | + new_state = round(solar, 2) |
| 592 | + else: |
| 593 | + new_state = STATE_UNAVAILABLE |
| 594 | + |
| 595 | + elif dev.type == 'uv_index': |
| 596 | + if self.data[79] != '-' and self.data[79] != '--' \ |
| 597 | + and self.data[79] != '---': |
| 598 | + new_state = float(self.data[79]) |
| 599 | + else: |
| 600 | + new_state = STATE_UNAVAILABLE |
| 601 | + |
579 | 602 | _LOGGER.debug("%s %s", dev.type, new_state) |
580 | 603 |
|
581 | 604 | # pylint: disable=protected-access |
|
0 commit comments