-
-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Remove monitored conditions from OpenUV #31019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ | |
| DATA_OPENUV_CLIENT, | ||
| DATA_UV, | ||
| DOMAIN, | ||
| SENSORS, | ||
| TOPIC_UPDATE, | ||
| TYPE_CURRENT_OZONE_LEVEL, | ||
| TYPE_CURRENT_UV_INDEX, | ||
|
|
@@ -43,17 +42,52 @@ | |
| UV_LEVEL_MODERATE = "Moderate" | ||
| UV_LEVEL_LOW = "Low" | ||
|
|
||
| SENSORS = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the constants maybe into
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I traditionally haven't done this; instead, I've followed the pattern used by HASS itself (centralize a constant into |
||
| TYPE_CURRENT_OZONE_LEVEL: ("Current Ozone Level", "mdi:vector-triangle", "du"), | ||
| TYPE_CURRENT_UV_INDEX: ("Current UV Index", "mdi:weather-sunny", "index"), | ||
| TYPE_CURRENT_UV_LEVEL: ("Current UV Level", "mdi:weather-sunny", None), | ||
| TYPE_MAX_UV_INDEX: ("Max UV Index", "mdi:weather-sunny", "index"), | ||
| TYPE_SAFE_EXPOSURE_TIME_1: ( | ||
| "Skin Type 1 Safe Exposure Time", | ||
| "mdi:timer", | ||
| "minutes", | ||
| ), | ||
| TYPE_SAFE_EXPOSURE_TIME_2: ( | ||
| "Skin Type 2 Safe Exposure Time", | ||
| "mdi:timer", | ||
| "minutes", | ||
| ), | ||
| TYPE_SAFE_EXPOSURE_TIME_3: ( | ||
| "Skin Type 3 Safe Exposure Time", | ||
| "mdi:timer", | ||
| "minutes", | ||
| ), | ||
| TYPE_SAFE_EXPOSURE_TIME_4: ( | ||
| "Skin Type 4 Safe Exposure Time", | ||
| "mdi:timer", | ||
| "minutes", | ||
| ), | ||
| TYPE_SAFE_EXPOSURE_TIME_5: ( | ||
| "Skin Type 5 Safe Exposure Time", | ||
| "mdi:timer", | ||
| "minutes", | ||
| ), | ||
| TYPE_SAFE_EXPOSURE_TIME_6: ( | ||
| "Skin Type 6 Safe Exposure Time", | ||
| "mdi:timer", | ||
| "minutes", | ||
| ), | ||
| } | ||
|
|
||
|
|
||
| async def async_setup_entry(hass, entry, async_add_entities): | ||
| """Set up a Nest sensor based on a config entry.""" | ||
| openuv = hass.data[DOMAIN][DATA_OPENUV_CLIENT][entry.entry_id] | ||
|
|
||
| sensors = [] | ||
| for sensor_type in openuv.sensor_conditions: | ||
| name, icon, unit = SENSORS[sensor_type] | ||
| sensors.append( | ||
| OpenUvSensor(openuv, sensor_type, name, icon, unit, entry.entry_id) | ||
| ) | ||
| for kind, attrs in SENSORS.items(): | ||
| name, icon, unit = attrs | ||
| sensors.append(OpenUvSensor(openuv, kind, name, icon, unit, entry.entry_id)) | ||
|
|
||
| async_add_entities(sensors, True) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.