Пример #1
0
 def index(self):
     header = config.read_html('header', static_dir)
     menu_raw = config.read_html('top_menu', static_dir)
     menu = menu_raw.format(energy='', weather='', status='', temphumi='')
     body = self.body()
     footer = config.read_html('footer', static_dir)
     result = header\
            + menu\
            + body\
            + footer
     return result
Пример #2
0
 def body(self):
     current_values = self.measures_obj.FreshValues(type='dict')
     fresh_voltage_array = float(current_values['V_array'])
     self.set_battery_icon(current_values['perc_array'], 0)
     # Table with statistical values
     stat_header = ['Date',
                    'Pmax [W]',
                    'Pday [Wh]']
     stats_content = self.measures_obj.stat_values(days = 7)
     stats_table = self.tableConstructor(stat_header, stats_content)
     # Format and output HTML fot he whole page
     admin_preformat = config.read_html('voltage_admin', config._templates)
     admin_html = admin_preformat.format(
         timestamp = current_values['time'],
         array_voltage = fresh_voltage_array,
         charge_current = current_values['ChCurr'],
         solar_power = current_values['Psol'],
         pmax_day = current_values['Pmax_day'],
         charge_current_icon = self.charge_current_icon,
         solar_power_icon = self.solar_power_icon,
         array_voltage_icon = self.battery_icon,
         array_percent = current_values['perc_array'],
         stats_table = stats_table
     )
     return admin_html
Пример #3
0
 def body(self):
     admin_preformat = config.read_html('status_admin', config._templates)
     current_status = self.LastKnownState()
     admin_html = admin_preformat.format(
         timestamp=time.strftime("%d.%m.%Y %H:%M:%S",
                                 current_status['time']),
         sol_icon=fs_sol_icon,
         cap_icon=fs_cap_icon,
         sol_value=round(current_status['solar'] / 100, 2),
         cap_value=current_status['cap'],
         uptime=current_status['uptime'])
     return admin_html
Пример #4
0
 def body(self):
     admin_preformat = config.read_html('temphumi_admin', config._templates)
     current_temphumi = self.currentState()
     admin_html = admin_preformat.format(
         timestamp=time.strftime("%d.%m.%Y %H:%M:%S",
                                 current_temphumi['time']),
         temp_value=current_temphumi['temperature'],
         hum_value=current_temphumi['humidity'],
         bat_value=round(current_temphumi['battery'] / 1023, 2),
         tea_temp_icon=tea_temp_icon,
         tea_hum_icon=tea_hum_icon,
         tea_bat_icon=tea_bat_icon)
     return admin_html
Пример #5
0
 def body(self):
     admin_preformat = config.read_html('weather_admin', config._templates)
     current_weather = self.LastKnownState()
     admin_html = admin_preformat.format(
         timestamp=time.strftime("%d.%m.%Y %H:%M:%S",
                                 current_weather['time']),
         w_speed_icon=fs_wind_icon,
         w_speed_km=current_weather['speed'],
         w_speed_ms=round(current_weather['speed'] / 3.6, 1),
         w_gust_icon=fs_windgust_icon,
         w_gust_km=current_weather['windgust'],
         w_gust_ms=round(current_weather['windgust'] / 3.6, 1),
         w_dir_icon=fs_winddirection_icon,
         w_dir_name=self.winddirName(current_weather['direction']),
         w_dir_deg=current_weather['direction'],
         out_temp_icon=fs_out_temperature_icon,
         out_temp=current_weather['temp_ext'],
         in_temp_icon=fs_in_temperature_icon,
         in_temp=current_weather['temp_int'],
         pressure_icon=fs_pressure_icon,
         pressure=current_weather['pressure'],
         raw_pressure=current_weather['pressure_raw'])
     return admin_html
Пример #6
0
 def body(self):
     admin_preformat = config.read_html('landing_page', static_dir)
     admin_html = admin_preformat
     return admin_html