14
14
import random
15
15
16
16
from flask import make_response
17
+ from ovos_utils .log import LOG
17
18
from ovos_utils .ovos_service_api import OvosWolframAlpha , OvosWeather
18
19
from ovos_backend_client .api import GeolocationApi , WolframAlphaApi , OpenWeatherMapApi
19
20
@@ -60,7 +61,7 @@ def dict_to_camel_case(data):
60
61
61
62
62
63
class ExternalApiManager :
63
- def __int__ (self ):
64
+ def __init__ (self ):
64
65
self .config = CONFIGURATION .get ("microservices" , {})
65
66
self .units = CONFIGURATION ["system_unit" ]
66
67
@@ -69,7 +70,11 @@ def __int__(self):
69
70
70
71
self .ovos_wolfram = OvosWolframAlpha ()
71
72
self .ovos_owm = OvosWeather ()
72
-
73
+ if not self .ovos_owm .uuid :
74
+ try :
75
+ self .ovos_owm .api .register_device ()
76
+ except Exception as e :
77
+ LOG .debug (f"Error registering device { e } " )
73
78
self .geo = Geocoder ()
74
79
75
80
self .selene_owm = None
@@ -183,7 +188,7 @@ def wolfram_xml(self, query, units=None, lat_lon=None):
183
188
q = {"input" : query , "units" : units , "output" : "xml" }
184
189
return self ._wolfram .get_wolfram_full (q )
185
190
186
- def own_current (self , lat , lon , units , lang = "en-us" ):
191
+ def owm_current (self , lat , lon , units , lang = "en-us" ):
187
192
if isinstance (self ._owm , LocalWeather ): # local
188
193
return self ._owm .current (lat , lon , units , lang )
189
194
if isinstance (self ._owm , OvosWeather ): # ovos
@@ -201,7 +206,7 @@ def owm_onecall(self, lat, lon, units, lang="en-us"):
201
206
if isinstance (self ._owm , OpenWeatherMapApi ): # selene
202
207
return self ._owm .get_weather ((lat , lon ), lang , units )
203
208
204
- def own_hourly (self , lat , lon , units , lang = "en-us" ):
209
+ def owm_hourly (self , lat , lon , units , lang = "en-us" ):
205
210
if isinstance (self ._owm , LocalWeather ): # local
206
211
return self ._owm .hourly (lat , lon , units , lang )
207
212
if isinstance (self ._owm , OvosWeather ): # ovos
@@ -210,7 +215,7 @@ def own_hourly(self, lat, lon, units, lang="en-us"):
210
215
if isinstance (self ._owm , OpenWeatherMapApi ): # selene
211
216
return self ._owm .get_hourly ((lat , lon ), lang , units )
212
217
213
- def own_daily (self , lat , lon , units , lang = "en-us" ):
218
+ def owm_daily (self , lat , lon , units , lang = "en-us" ):
214
219
if isinstance (self ._owm , LocalWeather ): # local
215
220
return self ._owm .daily (lat , lon , units , lang )
216
221
if isinstance (self ._owm , OvosWeather ): # ovos
@@ -221,7 +226,7 @@ def own_daily(self, lat, lon, units, lang="en-us"):
221
226
222
227
223
228
class LocalWeather :
224
- def __int__ (self , key ):
229
+ def __init__ (self , key ):
225
230
self .key = key
226
231
227
232
def current (self , lat , lon , units , lang ):
@@ -266,7 +271,7 @@ def onecall(self, lat, lon, units, lang):
266
271
267
272
268
273
class LocalWolfram :
269
- def __int__ (self , key ):
274
+ def __init__ (self , key ):
270
275
self .key = key
271
276
272
277
def spoken (self , query , units ):
0 commit comments