#!/usr/bin/env python3
# -*- coding: utf-8 -*-


# Third-party modules
from flask import Response, make_response, render_template, request
from flask_restx import Model, Namespace, Resource, fields

# Custom modules
import devices

############################
# WEB VIEW
############################

web = Namespace('environment', description='Meteo Weather page')

@web.route("/")
class EnvironmentWeb(Resource):
    """ Weatherpage  """

    def get(self):
        """ Display the meteo """
        data = Status().get()

        exclude = ["Barometric_trend", "Battery_status", "Battery_volts",
                   "ET_day", "ET_month", "ET_year",
                   "Storm_start_date", "Forecast_rule_number", "Forecast_icon"
                   ]

        for e in exclude:
            data["external"].pop(e, None)
        
        return make_response(render_template("meteo.html", data=data))
