Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# environment/__init__.py
|
||||
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
from constants import HOME_LOCATION
|
||||
from tools.geometry import Coordinate
|
||||
|
||||
from .local_sensors import Sensors
|
||||
from .pysky import Moon, Sun
|
||||
from .smhi import SMHI
|
||||
from .wireless_sensor import WirelessSensor
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Weather:
|
||||
def __init__(self, location: Coordinate = HOME_LOCATION) -> None:
|
||||
self.location = location
|
||||
self.session = requests.Session()
|
||||
self.smhi_api = SMHI(self.location, self.session)
|
||||
self.sensor_data = Sensors()
|
||||
self.wireless_sensor = WirelessSensor(self.session)
|
||||
|
||||
def get(self, date: datetime) -> dict:
|
||||
logger.debug("Collecting weather data from all sensors...")
|
||||
return (
|
||||
self.sensor_data.get()
|
||||
| self.wireless_sensor.get()
|
||||
| Moon.get_illumination(date)
|
||||
| Sun.get_sunset_sunrise(self.location, date)
|
||||
| self.smhi_api.get()
|
||||
)
|
||||
Reference in New Issue
Block a user