Skip to content

Commit

Permalink
Rearrange and add details to config_flow (#310)
Browse files Browse the repository at this point in the history
* Rearrange and add details to config_flow

* Update README.md
  • Loading branch information
Snuffy2 authored Jan 11, 2025
1 parent 9b72625 commit 06b3a0e
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ Key | Required | Default | Description |
`Map Provider` | `No` | `apple` | `google`, `apple`, `osm`
`Map Zoom` | `No` | `18` | Level of zoom for the generated map link <1-20>
`Language` | `No` |location's local language | Requested<sup>\*</sup> language(s) for state and attributes. Two-Letter language code(s), separated by commas.<br /><sup>\*</sup>Refer to [Notes](#notes)
`Use GPS Accuracy` | `No` | `True` | Use GPS Accuracy when determining whether to update the places sensor (if 0, don't update the places sensor). By not updating when GPS Accuracy is 0, should prevent inaccurate locations from being set in the places sensors.<br /><br />**Set this to `False` if your Device Tracker has a GPS Accuracy (`gps_accuracy`) attribute, but it always shows 0 even if the latitude and longitude are correct.**
`Extended Attributes` | `No` | `False` | Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict *(if they exist)*. Provides many additional attributes for advanced logic. **Warning, this will make the attributes very long!**
`Show Last Updated` | `No` | `False` | Show last updated time at end of state `(since xx:yy)`
`Use GPS Accuracy` | `No` | `True` | Use GPS Accuracy when determining whether to update the places sensor (if 0, don't update the places sensor). By not updating when GPS Accuracy is 0, should prevent inaccurate locations from being set in the places sensors.<br /><br />**Set this to `False` if your Device Tracker has a GPS Accuracy (`gps_accuracy`) attribute, but it always shows 0 even if the latitude and longitude are correct.**

<details>
<summary><h3>Advanced Display Options</h3></summary>
Expand Down
14 changes: 7 additions & 7 deletions custom_components/places/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ async def async_step_user(
)
),
vol.Optional(CONF_LANGUAGE): str,
vol.Optional(CONF_USE_GPS, default=DEFAULT_USE_GPS): selector.BooleanSelector(
selector.BooleanSelectorConfig()
),
vol.Optional(
CONF_EXTENDED_ATTR, default=DEFAULT_EXTENDED_ATTR
): selector.BooleanSelector(selector.BooleanSelectorConfig()),
Expand All @@ -248,9 +251,6 @@ async def async_step_user(
mode=selector.SelectSelectorMode.DROPDOWN,
)
),
vol.Optional(CONF_USE_GPS, default=DEFAULT_USE_GPS): selector.BooleanSelector(
selector.BooleanSelectorConfig()
),
}
)
# If there is no user input or there were errors, show the form again, including any errors that were found with the input.
Expand Down Expand Up @@ -393,6 +393,10 @@ async def async_step_init(
"suggested_value": self.config_entry.data.get(CONF_LANGUAGE, None)
},
): str,
vol.Optional(
CONF_USE_GPS,
default=(self.config_entry.data.get(CONF_USE_GPS, DEFAULT_USE_GPS)),
): selector.BooleanSelector(selector.BooleanSelectorConfig()),
vol.Optional(
CONF_EXTENDED_ATTR,
default=(self.config_entry.data.get(CONF_EXTENDED_ATTR, DEFAULT_EXTENDED_ATTR)),
Expand All @@ -417,10 +421,6 @@ async def async_step_init(
mode=selector.SelectSelectorMode.DROPDOWN,
)
),
vol.Optional(
CONF_USE_GPS,
default=(self.config_entry.data.get(CONF_USE_GPS, DEFAULT_USE_GPS)),
): selector.BooleanSelector(selector.BooleanSelectorConfig()),
}
)

Expand Down
22 changes: 16 additions & 6 deletions custom_components/places/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@
"map_zoom": "Map Zoom",
"api_key": "Email to use as OpenStreetMap API Key (optional)",
"language": "Language (optional)",
"use_gps_accuracy": "Use GPS Accuracy",
"extended_attr": "Enable Extended Attributes",
"show_time": "Show last updated time at end of state '(since xx:yy)'",
"date_format": "Date format to show at end of state when not changed >24h",
"use_gps_accuracy": "Use GPS Accuracy"
"date_format": "Date format to show at end of state when not changed >24h"
},
"description": "Create a new sensor\nSee [Configuration Options]({component_config_url}) on GitHub for details"
"description": "Create a new sensor\nSee [Configuration Options]({component_config_url}) on GitHub for details",
"data_description": {
"options": "See [Configuration Options]({component_config_url}) on GitHub for details",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
},
Expand All @@ -34,12 +39,17 @@
"map_zoom": "Map Zoom",
"api_key": "Email to use as OpenStreetMap API Key (optional)",
"language": "Language (optional)",
"use_gps_accuracy": "Use GPS Accuracy",
"extended_attr": "Enable Extended Attributes",
"show_time": "Show last updated time at end of state '(since xx:yy)'",
"date_format": "Date format to show at end of state when not changed >24h",
"use_gps_accuracy": "Use GPS Accuracy"
"date_format": "Date format to show at end of state when not changed >24h"
},
"description": "**Updating sensor:&nbsp;{sensor_name}**\nSee [Configuration Options]({component_config_url}) on GitHub for details"
"description": "**Updating sensor:&nbsp;{sensor_name}**\nSee [Configuration Options]({component_config_url}) on GitHub for details",
"data_description": {
"options": "See [Configuration Options]({component_config_url}) on GitHub for details",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions custom_components/places/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"show_time": "Показать время последнего обновления в конце состояния '(начиная с xx:yy)'",
"use_gps_accuracy": "Используйте точность GPS"
},
"description": "Создайте новый датчик\nПодробнее см. [Параметры конфигурации]({component_config_url}) на GitHub."
"description": "Создайте новый датчик\nПодробнее см. [Параметры конфигурации]({component_config_url}) на GitHub.",
"data_description": {
"options": "Подробнее см. [Параметры конфигурации]({component_config_url}) на GitHub",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
},
Expand All @@ -37,7 +42,12 @@
"show_time": "Показать время последнего обновления в конце состояния '(начиная с xx:yy)'",
"use_gps_accuracy": "Используйте точность GPS"
},
"description": "**Обновление сенсора:&nbsp;{sensor_name}**\nПодробности см. в [Параметры конфигурации]({component_config_url}) на GitHub."
"description": "**Обновление сенсора:&nbsp;{sensor_name}**\nПодробности см. в [Параметры конфигурации]({component_config_url}) на GitHub.",
"data_description": {
"options": "Подробнее см. [Параметры конфигурации]({component_config_url}) на GitHub",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
}
Expand Down
16 changes: 13 additions & 3 deletions custom_components/places/translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
"date_format": "Formát dátumu, ktorý sa zobrazí na konci stavu, keď sa nezmení >24 hodín",
"use_gps_accuracy": "Použite presnosť GPS"
},
"description": "Vytvorte nový senzor\nPodrobnosti nájdete v [Možnosti konfigurácie] ({component_config_url}) na GitHub"
"description": "Vytvorte nový senzor\nPodrobnosti nájdete v [Možnosti konfigurácie] ({component_config_url}) na GitHub",
"data_description": {
"options": "Podrobnosti nájdete v [Možnosti konfigurácie] ({component_config_url}) na GitHub",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
},
Expand All @@ -27,7 +32,7 @@
"init": {
"title": "Miesta: OpenStreetMap snímač",
"data": {
"devicetracker_id": "Tracked Entity ID",
"devicetracker_id": "ID sledovanej entity",
"home_zone": "Domáca zóna",
"options": "Možnosti zobrazenia",
"map_provider": "Poskytovateľ mapy",
Expand All @@ -39,7 +44,12 @@
"date_format": "Formát dátumu, ktorý sa zobrazí na konci stavu, keď sa nezmení >24 hodín",
"use_gps_accuracy": "Použite presnosť GPS"
},
"description": "**Aktualizuje sa senzor:&nbsp;{sensor_name}**\nPodrobnosti nájdete v [Možnosti konfigurácie]({component_config_url}) na GitHub"
"description": "**Aktualizuje sa senzor:&nbsp;{sensor_name}**\nPodrobnosti nájdete v [Možnosti konfigurácie]({component_config_url}) na GitHub",
"data_description": {
"options": "Podrobnosti nájdete v [Možnosti konfigurácie] ({component_config_url}) na GitHub",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions custom_components/places/translations/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
"show_time": "Показати час останнього оновлення в кінці стану '(з xx:yy)'",
"use_gps_accuracy": "Використовуйте точність GPS"
},
"description": "Create a new sensor\nSee [Configuration Options]({component_config_url}) on GitHub for details"
"description": "Create a new sensor\nДетальніше див. [Параметри конфігурації]({component_config_url}) на GitHub",
"data_description": {
"options": "Детальніше див. [Параметри конфігурації]({component_config_url}) на GitHub",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
},
Expand All @@ -37,7 +42,12 @@
"show_time": "Показати час останнього оновлення в кінці стану '(з xx:yy)'",
"use_gps_accuracy": "Використовуйте точність GPS"
},
"description": "**Оновлення датчика:&nbsp;{sensor_name}**\nДетальніше див. [Параметри конфігурації]({component_config_url}) на GitHub"
"description": "**Оновлення датчика:&nbsp;{sensor_name}**\nДетальніше див. [Параметри конфігурації]({component_config_url}) на GitHub",
"data_description": {
"options": "Детальніше див. [Параметри конфігурації]({component_config_url}) на GitHub",
"extended_attr": "Show extended attributes: wikidata_id, osm_dict, osm_details_dict, wikidata_dict (if they exist). Provides many additional attributes for advanced logic. Warning, this will make the attributes very long!",
"use_gps_accuracy": "Set this to False if your Device Tracker has a GPS Accuracy (gps_accuracy) attribute, but it always shows 0 even if the latitude and longitude are correct."
}
}
}
}
Expand Down

0 comments on commit 06b3a0e

Please sign in to comment.