diff --git a/openweathermap/__init__.py b/openweathermap/__init__.py index a37863b20..93be4e6e4 100755 --- a/openweathermap/__init__.py +++ b/openweathermap/__init__.py @@ -46,7 +46,7 @@ def __init__(self, *args: object) -> None: class OpenWeatherMap(SmartPlugin): - PLUGIN_VERSION = "1.8.7" + PLUGIN_VERSION = "1.8.8" _base_url = 'https://api.openweathermap.org/' _base_img_url = 'https://tile.openweathermap.org/map/%s/%s/%s/%s.png?appid=%s' @@ -396,6 +396,21 @@ def get_value_with_meta(self, owm_matchstring, correlation_hint=""): else: raise Exception(f"Cannot make sense of {s}") s = updated_s + elif (s.startswith("current/") or s.startswith("daily/") or s.startswith("day/") or s.startswith("hour/")) and (s.endswith('/wind_gust/beaufort') or s.endswith('/wind_gust/description')): + wrk_typ = "onecall [bft-calculation]" + mps_string = s.replace('/wind_gust/beaufort', '/wind_gust') + mps_string = mps_string.replace( + '/wind_gust/description', '/wind_gust') + wind_mps, updated_s = self.__get_val_from_dict( + mps_string, wrk, correlation_hint, owm_matchstring) + bft_val = self.get_beaufort_number(wind_mps) + if s.endswith('/beaufort'): + ret_val = bft_val + elif s.endswith('/description'): + ret_val = self.get_beaufort_description(bft_val) + else: + raise Exception(f"Cannot make sense of {s}") + s = updated_s else: ret_val, s = self.__get_val_from_dict(s, wrk, correlation_hint, owm_matchstring) except Exception as e: diff --git a/openweathermap/plugin.yaml b/openweathermap/plugin.yaml index 6550508e6..0c0339e0b 100755 --- a/openweathermap/plugin.yaml +++ b/openweathermap/plugin.yaml @@ -11,7 +11,7 @@ plugin: keywords: weather precipation irrigation documentation: '' support: 'https://knx-user-forum.de/forum/supportforen/smarthome-py/1246998-support-thread-zum-openweathermap-plugin' - version: 1.8.7 # Plugin version + version: 1.8.8 # Plugin version sh_minversion: '1.9.0' # minimum shNG version to use this plugin # sh_maxversion: # maximum shNG version to use this plugin (leave empty if latest) multi_instance: True # plugin supports multi instance @@ -450,12 +450,12 @@ item_structs: beaufort_nr: name: wind speed as beaufort number type: num - owm_matchstring: current/wind_speed/beaufort + owm_matchstring@instance: current/wind_speed/beaufort beaufort_string: name: wind speed as beaufort string type: str - owm_matchstring: current/wind_speed/description + owm_matchstring@instance: current/wind_speed/description wind_gust: name: (where available) Wind gust. Units default metre/sec, metric metre/sec, imperial miles/hour. @@ -465,14 +465,12 @@ item_structs: beaufort_nr: name: wind gusts as beaufort number type: num - eval: sh.plugins.get('openweathermap').get_beaufort_number(sh....wind_gust()) - eval_trigger: ...wind_gust + owm_matchstring@instance: current/wind_gust/beaufort beaufort_string: name: wind gusts as beaufort string type: str - eval: sh.plugins.get('openweathermap').get_beaufort_description( sh...beaufort_nr() ) - eval_trigger: ..beaufort_nr + owm_matchstring@instance: current/wind_gust/description wind_deg: name: Wind direction, degrees (meteorological) @@ -630,13 +628,11 @@ item_structs: beaufort_nr: name: wind speed as beaufort number type: num - eval: sh.plugins.get('openweathermap').get_beaufort_number(sh...()) - eval_trigger: .. + owm_matchstring@instance: current/wind_speed/beaufort beaufort_string: name: wind speed as beaufort string type: str - eval: sh.plugins.get('openweathermap').get_beaufort_description( sh...beaufort_nr() ) - eval_trigger: ..beaufort_nr + owm_matchstring@instance: current/wind_speed/description wind_gust: name: (where available) Wind gust. Units default metre/sec, metric metre/sec, imperial miles/hour. @@ -646,13 +642,11 @@ item_structs: beaufort_nr: name: wind gusts as beaufort number type: num - eval: sh.plugins.get('openweathermap').get_beaufort_number(sh...()) - eval_trigger: .. + owm_matchstring@instance: current/wind_gust/beaufort beaufort_string: name: wind gusts as beaufort string type: str - eval: sh.plugins.get('openweathermap').get_beaufort_description( sh...beaufort_nr() ) - eval_trigger: ..beaufort_nr + owm_matchstring@instance: current/wind_gust/description wind_deg: name: Wind direction, degrees (meteorological)