OpenVoiceOS / ovos-personal-backend

personal backend - self-hosted backend to manage multiple OVOS devices
Apache License 2.0
78 stars 26 forks source link

support ovos backend services #19

Closed JarbasAl closed 2 years ago

JarbasAl commented 2 years ago

for weather and wolfram alpha support should be added for ovos api - https://github.com/OpenVoiceOS/ovos_api_service

example weather integration

import requests
from ovos_utils import ovos_service_api

class OvosWeather:
    def __init__(self):
        self.api = ovos_service_api.OVOSApiService()
        self.api.register_device()

    def get_weather_onecall(self, query):
        self.api.get_session_challenge()
        headers = {'session_challenge': self.api.get_session_token(),  'backend': 'OWM'}
        reqdata = {"lat": query.get("lat"), 
                   "lon": query.get("lon"), 
                   "units": query.get("units"),
                   "lang": query.get("lang")}
        url = 'https://api.openvoiceos.com/weather/onecall_weather_report/' + self.api.get_uuid()
        r = requests.post(url, data=reqdata, headers=headers)
        return r.json()

this should also be made the default to ensure functionality is always available, users will still be able and encouraged to use their own keys

JarbasAl commented 2 years ago

blocked by https://github.com/OpenVoiceOS/ovos_api_service/issues/1 and https://github.com/OpenVoiceOS/ovos_api_service/issues/2